2005-07-14 22:45:10 +00:00
|
|
|
require 'rex/ui'
|
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Ui
|
|
|
|
module Text
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This class implements text-based output but is not
|
|
|
|
# tied to an output medium.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class Output < Rex::Ui::Output
|
|
|
|
|
|
|
|
require 'rex/ui/text/output/stdio'
|
2005-11-28 16:36:06 +00:00
|
|
|
require 'rex/ui/text/output/socket'
|
2005-07-14 22:58:09 +00:00
|
|
|
require 'rex/ui/text/output/buffer'
|
2009-11-10 03:27:48 +00:00
|
|
|
require 'rex/ui/text/color'
|
|
|
|
|
|
|
|
include Rex::Ui::Text::Color
|
2005-07-14 22:45:10 +00:00
|
|
|
|
2009-11-10 06:58:01 +00:00
|
|
|
def initialize
|
|
|
|
@config = {
|
|
|
|
:color => :auto, # true, false, :auto
|
|
|
|
}
|
|
|
|
super
|
|
|
|
end
|
|
|
|
attr_reader :config
|
|
|
|
|
|
|
|
def disable_color
|
|
|
|
@config[:color] = false
|
|
|
|
end
|
|
|
|
def enable_color
|
|
|
|
@config[:color] = true
|
|
|
|
end
|
|
|
|
def auto_color
|
|
|
|
@config[:color] = :auto
|
|
|
|
end
|
|
|
|
|
|
|
|
def update_prompt(prompt)
|
|
|
|
substitute_colors(prompt)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2005-07-14 22:45:10 +00:00
|
|
|
def print_error(msg = '')
|
2009-11-10 07:12:56 +00:00
|
|
|
print_line("%red[-]%clr #{msg}")
|
2005-07-14 22:45:10 +00:00
|
|
|
end
|
2009-11-10 03:27:48 +00:00
|
|
|
|
2005-07-14 22:45:10 +00:00
|
|
|
def print_good(msg = '')
|
2009-11-10 07:12:56 +00:00
|
|
|
print_line("%grn[+]%clr #{msg}")
|
2005-07-14 22:45:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def print_status(msg = '')
|
2009-11-10 07:12:56 +00:00
|
|
|
print_line("%blu[*]%clr #{msg}")
|
2005-07-14 22:45:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def print_line(msg = '')
|
|
|
|
print(msg + "\n")
|
|
|
|
end
|
|
|
|
|
2009-11-10 03:27:48 +00:00
|
|
|
def print(msg = '')
|
2009-11-10 06:58:01 +00:00
|
|
|
print_raw(substitute_colors(msg))
|
2009-11-10 03:27:48 +00:00
|
|
|
end
|
|
|
|
|
2005-07-14 22:58:09 +00:00
|
|
|
def reset
|
|
|
|
end
|
|
|
|
|
2005-07-14 22:45:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
2009-11-10 03:27:48 +00:00
|
|
|
end
|