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-b9f4589650daunstable
parent
b14a4ddf0b
commit
dac1251cb7
|
@ -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
|
||||
|
@ -749,6 +771,7 @@ protected
|
|||
merge_info_options(info, val, false, true)
|
||||
end
|
||||
|
||||
|
||||
attr_accessor :module_info # :nodoc:
|
||||
attr_writer :author, :arch, :platform, :references, :datastore, :options # :nodoc:
|
||||
attr_writer :privileged # :nodoc:
|
||||
|
|
Loading…
Reference in New Issue