Class: Rex::Services::LocalRelay::Relay

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/services/local_relay.rb

Overview

This class acts as an instance of a given local relay.

Direct Known Subclasses

ReverseRelay

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, listener, opts = {}) ⇒ Relay

Returns a new instance of Relay.


73
74
75
76
77
78
79
80
81
82
83
# File 'lib/rex/services/local_relay.rb', line 73

def initialize(name, listener, opts = {})
  self.name                     = name
  self.listener                 = listener
  self.opts                     = opts
  self.on_local_connection_proc = opts['OnLocalConnection']
  self.on_conn_close_proc       = opts['OnConnectionClose']
  self.on_other_data_proc       = opts['OnOtherData']
  if (not $dispatcher['rex'])
    register_log_source('rex', $dispatcher['core'], get_log_level('core'))
  end
end

Instance Attribute Details

#listenerObject

Returns the value of attribute listener


100
101
102
# File 'lib/rex/services/local_relay.rb', line 100

def listener
  @listener
end

#nameObject

Returns the value of attribute name


100
101
102
# File 'lib/rex/services/local_relay.rb', line 100

def name
  @name
end

#on_conn_close_procObject

Returns the value of attribute on_conn_close_proc


102
103
104
# File 'lib/rex/services/local_relay.rb', line 102

def on_conn_close_proc
  @on_conn_close_proc
end

#on_local_connection_procObject

Returns the value of attribute on_local_connection_proc


101
102
103
# File 'lib/rex/services/local_relay.rb', line 101

def on_local_connection_proc
  @on_local_connection_proc
end

#on_other_data_procObject

Returns the value of attribute on_other_data_proc


103
104
105
# File 'lib/rex/services/local_relay.rb', line 103

def on_other_data_proc
  @on_other_data_proc
end

#optsObject

Returns the value of attribute opts


100
101
102
# File 'lib/rex/services/local_relay.rb', line 100

def opts
  @opts
end

Instance Method Details

#closeObject


92
93
94
95
96
97
98
# File 'lib/rex/services/local_relay.rb', line 92

def close
  begin
    listener.close if listener
  rescue ::Exception
  end
  listener = nil
end

#shutdownObject


85
86
87
88
89
90
# File 'lib/rex/services/local_relay.rb', line 85

def shutdown
  begin
    listener.shutdown if listener
  rescue ::Exception
  end
end