2005-11-28 16:36:06 +00:00
|
|
|
require 'rex/ui'
|
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Ui
|
|
|
|
module Text
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This class implements the output interface against a socket.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class Output::Socket < Rex::Ui::Text::Output
|
|
|
|
|
|
|
|
def initialize(sock)
|
|
|
|
@sock = sock
|
|
|
|
end
|
|
|
|
|
2009-11-10 03:27:48 +00:00
|
|
|
def supports_color?
|
2009-11-10 06:58:01 +00:00
|
|
|
case config[:color]
|
|
|
|
when true
|
|
|
|
# Allow color if the user forces it on
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
false
|
|
|
|
end
|
2009-11-10 03:27:48 +00:00
|
|
|
end
|
|
|
|
|
2005-11-28 16:36:06 +00:00
|
|
|
#
|
|
|
|
# Prints the supplied message to the socket.
|
|
|
|
#
|
2009-11-10 03:27:48 +00:00
|
|
|
def print_raw(msg = '')
|
2005-11-28 16:36:06 +00:00
|
|
|
@sock.write(msg)
|
|
|
|
@sock.flush
|
|
|
|
|
|
|
|
msg
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
2009-11-10 03:27:48 +00:00
|
|
|
end
|