Skip to content

Commit 16b64ff

Browse files
peregrinoperegrino
authored andcommitted
Rex::Socket.to_sockaddr changed
1 parent 16a9450 commit 16b64ff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/post/windows/recon/outbound_ports.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ def icmp_setup
5151
end
5252
vprint_status("ICMP raw socket created successfully")
5353

54-
sockaddr = Rex::Socket.to_sockaddr(session.session_host, 0)
55-
r = client.railgun.ws2_32.bind(handler['return'],sockaddr,16)
54+
r = client.railgun.ws2_32.bind(handler['return'],"\x02\x00\x00\x00" << Rex::Socket.addr_aton(session.session_host) << "\x00"*8 ,16)
5655
if r['GetLastError'] != 0
5756
print_error("There was an error binding the ICMP socket to #{session.session_host}; GetLastError: #{r['GetLastError']}")
5857
return nil
@@ -120,7 +119,8 @@ def tcp_setup(ttl)
120119

121120
def connections(remote, dst_port, h_icmp, h_tcp, to)
122121
sock_addr = Rex::Socket.to_sockaddr(remote, dst_port)
123-
r = client.railgun.ws2_32.connect(h_tcp, sock_addr, 16)
122+
r = client.railgun.ws2_32.connect(h_tcp, "\x02\x00" << [dst_port].pack("n") << Rex::Socket.addr_aton(remote) << "\x00"*8 , 16)
123+
124124
# A GetLastError == 1035 is expected since the socket is set to non-blocking mode
125125
if r['GetLastError'] != 10035
126126
print_error("There was an error creating the connection to the peer #{remote}; GetLastError: #{r['GetLastError']}")

0 commit comments

Comments
 (0)