1deacad2be
Came up on Twitter, where Justin may have been trolling a little: https://twitter.com/jstnkndy/status/798671298302017536 We have a `print_good` method, but not a `print_bad`, which seems a little weird for Ruby -- opposite methods should be intuitive as Justin is implying. Anyway, I went with alias_method, thanks to the compelling argument at https://github.com/bbatsov/ruby-style-guide#alias-method ...since Metasploit is all about the singleton, and didn't want to risk some unexpected scoping thing. Also dang, we define the `print_` methods like fifty billion times! Really should fix that some day.
41 lines
872 B
Ruby
41 lines
872 B
Ruby
# Methods for print messages with status indicators
|
|
module Msf::Module::UI::Message
|
|
autoload :Verbose, 'msf/core/module/ui/message/verbose'
|
|
|
|
include Msf::Module::UI::Message::Verbose
|
|
|
|
def print_error(msg='')
|
|
super(print_prefix + msg)
|
|
end
|
|
|
|
alias_method :print_bad, :print_error
|
|
|
|
def print_good(msg='')
|
|
super(print_prefix + msg)
|
|
end
|
|
|
|
def print_prefix
|
|
prefix = ''
|
|
if datastore['TimestampOutput'] ||
|
|
(framework && framework.datastore['TimestampOutput'])
|
|
prefix << "[#{Time.now.strftime("%Y.%m.%d-%H:%M:%S")}] "
|
|
|
|
xn ||= datastore['ExploitNumber']
|
|
xn ||= framework.datastore['ExploitNumber']
|
|
if xn.is_a?(Fixnum)
|
|
prefix << "[%04d] " % xn
|
|
end
|
|
|
|
end
|
|
prefix
|
|
end
|
|
|
|
def print_status(msg='')
|
|
super(print_prefix + msg)
|
|
end
|
|
|
|
def print_warning(msg='')
|
|
super(print_prefix + msg)
|
|
end
|
|
end
|