Add print_warning()

unstable
sinn3r 2012-10-12 21:48:15 -05:00
parent 90ae5c1178
commit d36f642edc
10 changed files with 69 additions and 0 deletions

View File

@ -80,6 +80,12 @@ module Exploit::Remote::HttpServer
def print_debug(msg='')
(cli) ? super("#{cli.peerhost.ljust(16)} #{self.shortname} - #{msg}") : super
end
#
# :category: print_* overrides
# Prepends client and module name if inside a thread with a #cli
def print_warning(msg='')
(cli) ? super("#{cli.peerhost.ljust(16)} #{self.shortname} - #{msg}") : super
end
# :category: print_* overrides
# Prepends client and module name if inside a thread with a #cli
@ -101,6 +107,11 @@ module Exploit::Remote::HttpServer
def vprint_debug(msg='')
(cli) ? super("#{cli.peerhost.ljust(16)} #{self.shortname} - #{msg}") : super
end
# :category: print_* overrides
# Prepends client and module name if inside a thread with a #cli
def vprint_warning(msg='')
(cli) ? super("#{cli.peerhost.ljust(16)} #{self.shortname} - #{msg}") : super
end
#

View File

@ -208,6 +208,10 @@ class Module
super(print_prefix + msg)
end
def print_warning(msg='')
super(print_prefix + msg)
end
#
# Overwrite the Subscriber print_line to do custom prefixes
@ -241,6 +245,10 @@ class Module
def vprint_debug(msg)
print_debug(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_warning
def vprint_warning(msg)
print_warning(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
#
# Returns the module's framework full reference name. This is the

View File

@ -140,6 +140,14 @@ class Plugin
output.print_line(msg) if (output)
end
#
# Prints a warning
#
def print_warning(msg='')
output.print_warning(msg) if (output)
end
#
# Prints a message with no decoration.
#

View File

@ -98,6 +98,10 @@ class BidirectionalPipe < Rex::Ui::Text::Input
print_line('[*] ' + msg)
end
def print_warning(msg='')
print_warning('[!] ' + msg)
end
#
# Wrappers for the pipe_input methods
#

View File

@ -9,6 +9,7 @@ class Base
def print_status(msg); end
def print_good(msg); end
def print_error(msg); end
def print_warning(msg); end
end
attr_accessor :client, :framework, :path, :error, :args

View File

@ -45,6 +45,12 @@ class Output
def print_line(msg='')
end
#
# Prints a warning
#
def print_warning(msg='')
end
#
# Prints a message with no decoration.
#

View File

@ -66,6 +66,16 @@ module Subscriber
end
end
#
# Wraps user_output.print_warning
#
def print_warning(msg='')
if (user_output)
print_blank_line if user_output.prompting?
user_output.print_warning(msg)
end
end
#
# Wraps user_output.print
#

View File

@ -81,6 +81,13 @@ module DispatcherShell
shell.print_good(msg)
end
#
# Wraps shell.print_warning
#
def print_warning(msg = '')
shell.print_warning(msg)
end
#
# Wraps shell.print
#

View File

@ -67,6 +67,10 @@ class Output < Rex::Ui::Output
print(msg + "\n")
end
def print_warning(msg = '')
print_line("%bld%yel[!]%clr #{msg}")
end
def print(msg = '')
print_raw(substitute_colors(msg))
end

View File

@ -303,6 +303,16 @@ module Shell
log_output(output.print_line(msg))
end
#
# Prints a warning message to the output handle.
#
def print_warning(msg='')
return if (disable_output == true)
self.on_print_proc.call(msg) if self.on_print_proc
log_output(output.print_warning(msg))
end
#
# Prints a raw message to the output handle.
#