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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Relay.



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

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.



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

def listener
  @listener
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#on_conn_close_procObject

Returns the value of attribute on_conn_close_proc.



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

def on_conn_close_proc
  @on_conn_close_proc
end

#on_local_connection_procObject

Returns the value of attribute on_local_connection_proc.



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

def on_local_connection_proc
  @on_local_connection_proc
end

#on_other_data_procObject

Returns the value of attribute on_other_data_proc.



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

def on_other_data_proc
  @on_other_data_proc
end

#optsObject

Returns the value of attribute opts.



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

def opts
  @opts
end

Instance Method Details

#closeObject



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

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

#shutdownObject



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

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