Class: Arachni::HTTP::ProxyServer::Tunnel

Inherits:
Reactor::Connection
  • Object
show all
Includes:
UI::Output
Defined in:
lib/arachni/http/proxy_server/tunnel.rb

Overview

Author:

Instance Method Summary collapse

Methods included from UI::Output

#caller_location, #debug?, #debug_level, #debug_level_1?, #debug_level_2?, #debug_level_3?, #debug_level_4?, #debug_off, #debug_on, #disable_only_positives, #error_buffer, #error_log_fd, #error_logfile, #has_error_log?, #included, #log_error, #mute, #muted?, #only_positives, #only_positives?, #print_bad, #print_debug, #print_debug_backtrace, #print_debug_exception, #print_debug_level_1, #print_debug_level_2, #print_debug_level_3, #print_debug_level_4, #print_error, #print_error_backtrace, #print_exception, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?, reset_output_options, #set_error_logfile, #unmute, #verbose?, #verbose_off, #verbose_on

Constructor Details

#initialize(options) ⇒ Tunnel

Returns a new instance of Tunnel.



18
19
20
21
22
# File 'lib/arachni/http/proxy_server/tunnel.rb', line 18

def initialize( options )
    print_debug_level_3 'New tunnel.'

    @client = options[:client]
end

Instance Method Details

#on_close(reason = nil) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/arachni/http/proxy_server/tunnel.rb', line 33

def on_close( reason = nil )
    print_debug_level_3 "Closed because: [#{reason.class}] #{reason}"

    # ap self.class
    # ap 'CLOSE'
    # ap reason

    @client.close reason
end

#on_connectObject



24
25
26
# File 'lib/arachni/http/proxy_server/tunnel.rb', line 24

def on_connect
    print_debug_level_3 'Connected.'
end

#on_read(data) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/arachni/http/proxy_server/tunnel.rb', line 43

def on_read( data )
    # ap self.class
    # ap 'READ'
    # ap data
    print_debug_level_3 "<- Forwarding #{data.size} bytes to client."
    @client.write data
end

#write(data) ⇒ Object



28
29
30
31
# File 'lib/arachni/http/proxy_server/tunnel.rb', line 28

def write( data )
    print_debug_level_3 " -> Forwarding #{data.size} bytes."
    super data
end