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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



37
38
39
# File 'lib/rex/proto/ssh/server.rb', line 37

def connection
  @connection
end

#serverObject (readonly)

Returns the value of attribute server.



37
38
39
# File 'lib/rex/proto/ssh/server.rb', line 37

def server
  @server
end

Instance Method Details

#closeObject



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

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.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rex/proto/ssh/server.rb', line 16

def init_cli(server, do_not_start = false)
  # Ssh relies on PTY not available on Windows, limiting the `require` here
  # ensures eager_load patterns from zeitwerk will not attempt to load `hrr_rb_ssh`
  # during startup.
  require 'rex/proto/ssh/connection'
  @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
rescue LoadError => e
  wlog(e)
end