try any before specific LHOST

git-svn-id: file:///home/svn/framework3/trunk@6177 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2009-01-23 23:03:53 +00:00
parent 1d499a9756
commit 077c201f10
1 changed files with 4 additions and 4 deletions

View File

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