Class: Rex::Ui::Text::Output::Socket

Inherits:
Rex::Ui::Text::Output show all
Defined in:
lib/rex/ui/text/output/socket.rb

Overview

This class implements the output interface against a socket.

Constant Summary

Constants included from Color

Color::AnsiAttributes

Instance Attribute Summary

Attributes inherited from Rex::Ui::Text::Output

#config

Instance Method Summary collapse

Methods inherited from Rex::Ui::Text::Output

#auto_color, #disable_color, #enable_color, #print, #print_debug, #print_error, #print_good, #print_line, #print_status, #print_warning, #reset, #update_prompt

Methods included from Color

#ansi, #colorize, #do_colorize, #reset_color, #substitute_colors

Methods inherited from Output

#flush, #print, #print_debug, #print_error, #print_good, #print_line, #print_status, #print_warning, #prompting, #prompting?

Constructor Details

#initialize(sock) ⇒ Socket


15
16
17
18
# File 'lib/rex/ui/text/output/socket.rb', line 15

def initialize(sock)
  @sock = sock
  super()
end

Instance Method Details

Prints the supplied message to the socket.


33
34
35
36
37
38
# File 'lib/rex/ui/text/output/socket.rb', line 33

def print_raw(msg = '')
  @sock.write(msg)
  @sock.flush

  msg
end

#supports_color?Boolean


20
21
22
23
24
25
26
27
28
# File 'lib/rex/ui/text/output/socket.rb', line 20

def supports_color?
  case config[:color]
  when true
    # Allow color if the user forces it on
    return true
  else
    false
  end
end