Class: Rex::Socket::SSHFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/socket/ssh_factory.rb

Overview

This class exists to abuse the Proxy capabilities in the Net::SSH library to allow the use of Rex::Sockets for the transport layer in Net::SSH. The SSHFactory object will respond to the #open method and create the Tcp

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(framework, msfmodule, proxies) ⇒ SSHFactory



19
20
21
22
23
# File 'lib/rex/socket/ssh_factory.rb', line 19

def initialize(framework, msfmodule, proxies)
  @framework = framework
  @msfmodule   = msfmodule
  @proxies     = proxies
end

Instance Attribute Details

#frameworkObject

Returns the value of attribute framework.



11
12
13
# File 'lib/rex/socket/ssh_factory.rb', line 11

def framework
  @framework
end

#msfmoduleObject



14
15
16
# File 'lib/rex/socket/ssh_factory.rb', line 14

def msfmodule
  @msfmodule
end

#msfraemworkObject



11
# File 'lib/rex/socket/ssh_factory.rb', line 11

attr_accessor :framework

#proxiesString



17
18
19
# File 'lib/rex/socket/ssh_factory.rb', line 17

def proxies
  @proxies
end

Instance Method Details

#open(host, port, options = {}) ⇒ Object

Responds to the proxy setup routine Net::SSH will call when initialising the Transport Layer. This will instead create our Tcp and tie the socket back to the calling module



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rex/socket/ssh_factory.rb', line 31

def open(host, port, options={})
  socket = Rex::Socket::Tcp.create(
    'PeerHost' => host,
    'PeerPort' => port,
    'Proxies' => proxies,
    'Context'  => {
      'Msf'          => framework,
      'MsfExploit'   => msfmodule
    }
  )
  socket
end