Method: Rex::Proto::DCERPC::Client#socket_setup
- Defined in:
- lib/rex/proto/dcerpc/client.rb
#socket_setup ⇒ Object
Create the appropriate socket based on protocol
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/rex/proto/dcerpc/client.rb', line 77 def socket_setup() ctx = { 'Msf' => self.['Msf'], 'MsfExploit' => self.['MsfExploit'] } self.socket = case self.handle.protocol when 'ncacn_ip_tcp' Rex::Socket.create_tcp( 'PeerHost' => self.handle.address, 'PeerPort' => self.handle.[0], 'Context' => ctx, 'Timeout' => self.['connect_timeout'] ) when 'ncacn_np' begin socket = Rex::Socket.create_tcp( 'PeerHost' => self.handle.address, 'PeerPort' => 445, 'Context' => ctx, 'Timeout' => self.['connect_timeout'] ) rescue ::Timeout::Error, Rex::ConnectionRefused socket = Rex::Socket.create_tcp( 'PeerHost' => self.handle.address, 'PeerPort' => 139, 'Context' => ctx, 'Timeout' => self.['connect_timeout'] ) end socket else nil end # Add this socket to the exploit's list of open sockets ['MsfExploit'].add_socket(self.socket) if (['MsfExploit']) end |