2005-07-14 22:45:10 +00:00
|
|
|
require 'rex/ui'
|
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Ui
|
|
|
|
module Text
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This class implements output against standard out.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class Output::Stdio < Rex::Ui::Text::Output
|
|
|
|
|
2009-11-10 03:27:48 +00:00
|
|
|
def supports_color?
|
2009-11-10 06:58:01 +00:00
|
|
|
case config[:color]
|
|
|
|
when true
|
|
|
|
return true
|
|
|
|
when false
|
|
|
|
return false
|
|
|
|
else # auto
|
|
|
|
term = Rex::Compat.getenv('TERM')
|
|
|
|
return (term and term.match(/(?:vt10[03]|xterm(?:-color)?|linux|screen|rxvt)/i) != nil)
|
|
|
|
end
|
2009-11-10 03:27:48 +00:00
|
|
|
end
|
|
|
|
|
2005-11-15 05:22:13 +00:00
|
|
|
#
|
|
|
|
# Prints the supplied message to standard output.
|
|
|
|
#
|
2009-11-10 03:27:48 +00:00
|
|
|
def print_raw(msg = '')
|
2005-07-14 22:45:10 +00:00
|
|
|
$stdout.print(msg)
|
2005-07-18 04:07:56 +00:00
|
|
|
$stdout.flush
|
2005-10-02 03:21:26 +00:00
|
|
|
|
|
|
|
msg
|
2005-07-14 22:45:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
2009-11-10 03:27:48 +00:00
|
|
|
end
|
2010-03-11 18:58:20 +00:00
|
|
|
|