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.



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

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.



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

def listener
  @listener
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#on_conn_close_procObject

Returns the value of attribute on_conn_close_proc.



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

def on_conn_close_proc
  @on_conn_close_proc
end

#on_local_connection_procObject

Returns the value of attribute on_local_connection_proc.



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

def on_local_connection_proc
  @on_local_connection_proc
end

#on_other_data_procObject

Returns the value of attribute on_other_data_proc.



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

def on_other_data_proc
  @on_other_data_proc
end

#optsObject

Returns the value of attribute opts.



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

def opts
  @opts
end

Instance Method Details

#closeObject



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

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

#shutdownObject



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

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