Module: Rex::Proto::Ssh::ServerClient

Defined in:
lib/rex/proto/ssh/server.rb

Overview

Runtime extension of the SSH clients that connect to the server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection


32
33
34
# File 'lib/rex/proto/ssh/server.rb', line 32

def connection
  @connection
end

#serverObject (readonly)

Returns the value of attribute server


32
33
34
# File 'lib/rex/proto/ssh/server.rb', line 32

def server
  @server
end

Instance Method Details

#closeObject


27
28
29
30
# File 'lib/rex/proto/ssh/server.rb', line 27

def close
  @connection_thread.kill if @connection_thread and @connection_thread.alive?
  super
end

#init_cli(server, do_not_start = false) ⇒ Object

Initialize a new connection instance.


17
18
19
20
21
22
23
24
25
# File 'lib/rex/proto/ssh/server.rb', line 17

def init_cli(server, do_not_start = false)
  @server          = server
  @connection      = Rex::Proto::Ssh::Connection.new(
    self, server.server_options.merge(ssh_server: server), server.context
  )
  @connection_thread = Rex::ThreadFactory.spawn("SshConnectionMonitor-#{self}", false) {
    self.connection.start
  } unless do_not_start
end