#1# Copyright (c) 2006-2025 Wade Alcorn - [email protected]2# Browser Exploitation Framework (BeEF) - https://beefproject.com3# See the file 'doc/COPYING' for copying permission4#56# Function used to print errors to the console7# @param [String] s String to be printed8def print_error(s)9puts Time.now.localtime.strftime('[%k:%M:%S]') + '[!]' + ' ' + s.to_s10BeEF.logger.error s.to_s11end1213# Function used to print information to the console14# @param [String] s String to be printed15def print_info(s)16puts Time.now.localtime.strftime('[%k:%M:%S]') + '[*]' + ' ' + s.to_s17BeEF.logger.info s.to_s18end1920# Function used to print information to the console (wraps print_info)21# @param [String] s String to be printed22def print_status(s)23print_info(s)24end2526# Function used to print warning information27# @param [String] s String to be printed28def print_warning(s)29puts Time.now.localtime.strftime('[%k:%M:%S]') + '[!]' + ' ' + s.to_s30BeEF.logger.warn s.to_s31end3233# Function used to print debug information34# @param [String] s String to be printed35# @note This function will only print messages if the debug flag is set to true36def print_debug(s)37config = BeEF::Core::Configuration.instance38return unless config.get('beef.debug') || BeEF::Core::Console::CommandLine.parse[:verbose]3940puts Time.now.localtime.strftime('[%k:%M:%S]') + '[>]' + ' ' + s.to_s41BeEF.logger.debug s.to_s42end4344# Function used to print successes to the console45# @param [String] s String to be printed46def print_success(s)47puts Time.now.localtime.strftime('[%k:%M:%S]') + '[+]' + ' ' + s.to_s48BeEF.logger.info s.to_s49end5051# Function used to print successes to the console (wraps print_success)52# @param [String] s String to be printed53def print_good(s)54print_success(s)55end5657# Print multiple lines with decoration split by the return character58# @param [String] s String to be printed59# @note The string passed needs to be separated by the "\n" for multiple lines to be printed60def print_more(s)61time = Time.now.localtime.strftime('[%k:%M:%S]')6263lines = if s.instance_of?(Array)64s65else66s.split("\n")67end6869lines.each_with_index do |line, index|70if (index + 1) == lines.size71puts "#{time} |_ #{line}"72BeEF.logger.info "#{time} |_ #{line}"73else74puts "#{time} | #{line}"75BeEF.logger.info "#{time} | #{line}"76end77end78end7980# Function used to print over the current line81# @param [String] s String to print over current line82# @note To terminate the print_over functionality your last print_over line must include a "\n" return83def print_over(s)84time = Time.now.localtime.strftime('[%k:%M:%S]')85print "\r#{time}" + '[*]'.blue + " #{s}"86BeEF.logger.info s.to_s87end888990