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.

Instance Attribute Summary

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

#config, #input

Instance Method Summary collapse

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

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

Methods inherited from Output

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

Constructor Details

#initialize(sock) ⇒ Socket

Returns a new instance of Socket.



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

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

Instance Method Details

Prints the supplied message to the socket.



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

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

  msg
end

#supports_color?Boolean

Returns:

  • (Boolean)


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

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