Class: Rex::Socket::SSHFactory
- Inherits:
-
Object
- Object
- Rex::Socket::SSHFactory
- 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
-
#framework ⇒ Object
Returns the value of attribute framework.
-
#msfmodule ⇒ Object
The metasploit module this socket belongs to.
-
#msfraemwork ⇒ Object
The framework instance object.
-
#proxies ⇒ String
Any proxies to use for the connection.
Instance Method Summary collapse
-
#initialize(framework, msfmodule, proxies) ⇒ SSHFactory
constructor
A new instance of SSHFactory.
-
#open(host, port, options = {}) ⇒ Object
Responds to the proxy setup routine Net::SSH will call when initialising the Transport Layer.
Constructor Details
#initialize(framework, msfmodule, proxies) ⇒ SSHFactory
Returns a new instance of 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
#framework ⇒ Object
Returns the value of attribute framework.
11 12 13 |
# File 'lib/rex/socket/ssh_factory.rb', line 11 def framework @framework end |
#msfmodule ⇒ Object
Returns The metasploit module this socket belongs to.
14 15 16 |
# File 'lib/rex/socket/ssh_factory.rb', line 14 def msfmodule @msfmodule end |
#msfraemwork ⇒ Object
Returns The framework instance object.
11 |
# File 'lib/rex/socket/ssh_factory.rb', line 11 attr_accessor :framework |
#proxies ⇒ String
Returns Any proxies to use for the connection.
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, ={}) socket = Rex::Socket::Tcp.create( 'PeerHost' => host, 'PeerPort' => port, 'Proxies' => proxies, 'Context' => { 'Msf' => framework, 'MsfExploit' => msfmodule } ) socket end |