From dac1251cb7c555e9231438de5c2be0056b2c794f Mon Sep 17 00:00:00 2001 From: HD Moore Date: Tue, 18 Aug 2009 03:02:37 +0000 Subject: [PATCH] Add support for timestamping all print_status and print_error calls made by modules. Suggested by Mia git-svn-id: file:///home/svn/framework3/trunk@6959 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/module.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/msf/core/module.rb b/lib/msf/core/module.rb index 6d284ff351..a3c7a172b5 100644 --- a/lib/msf/core/module.rb +++ b/lib/msf/core/module.rb @@ -144,6 +144,28 @@ class Module obj end + # + # Overwrite the Subscriber print_line to do time stamps + # + + def print_prefix + if( + datastore['TimestampOutput'] =~ /^(t|y|1)/i or + framework.datastore['TimestampOutput'] =~ /^(t|y|1)/i + ) + return "[#{Time.now.strftime("%Y.%m.%d-%H:%M:%S")}] " + end + "" + end + + def print_status(msg='') + print_line(print_prefix + "[*] " + msg) + end + + def print_error(msg='') + print_line(print_prefix + "[-] " + msg) + end + # # Returns the module's framework full reference name. This is the # short name that end-users work with (refname) plus the type @@ -748,6 +770,7 @@ protected def merge_info_evasion_options(info, val) merge_info_options(info, val, false, true) end + attr_accessor :module_info # :nodoc: attr_writer :author, :arch, :platform, :references, :datastore, :options # :nodoc: