un-break reverse handler for ipv6

git-svn-id: file:///home/svn/framework3/trunk@5972 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2008-11-21 05:34:39 +00:00
parent b76d3e1560
commit 4b082a77a8
1 changed files with 5 additions and 1 deletions

View File

@ -60,7 +60,11 @@ module ReverseTcp
ex = false
# Switch to IPv6 ANY address if the LHOST is also IPv6
addr = Rex::Socket.resolv_nbo(datastore['LHOST'])
[ Rex::Socket.addr_ntoa(addr), "0.0.0.0" ].each { |ip|
# First attempt to bind LHOST. If that fails, the user has probably
# set LHOST to a gateway for forwarding back through NAT and we need to
# bind any address; use the any addr for LHOST was.
any = (addr.length == 4) ? "0.0.0.0" : "::0"
[ Rex::Socket.addr_ntoa(addr), any ].each { |ip|
begin
print_status("Handler binding to LHOST #{ip}")
self.listener_sock = Rex::Socket::TcpServer.create(