Accept IPv6 addresses in the return if getaddress

This commit is contained in:
HD Moore 2011-12-10 08:16:47 -06:00
parent 1cc68d1ed5
commit e3f121929c
2 changed files with 3 additions and 4 deletions

View File

@ -1490,7 +1490,7 @@ class DBManager
end end
# Force addr to be the address and not hostname # Force addr to be the address and not hostname
addr = Rex::Socket.getaddress(addr) addr = Rex::Socket.getaddress(addr, true)
end end
ret = {} ret = {}

View File

@ -320,7 +320,7 @@ class OptAddress < OptBase
if (value != nil and value.empty? == false) if (value != nil and value.empty? == false)
begin begin
::Rex::Socket.getaddress(value) ::Rex::Socket.getaddress(value, true)
rescue rescue
return false return false
end end
@ -351,8 +351,7 @@ class OptAddressRange < OptBase
ret = '' ret = ''
count.times { count.times {
ret << " " if not ret.empty? ret << " " if not ret.empty?
ip = "%u.%u.%u.%u" % [1+rand(0xfe),1+rand(0xfe),1+rand(0xfe),1+rand(0xfe)] ret << [ rand(0x100000000) ].pack("N").unpack("C*").join(".")
ret << ip
} }
return ret return ret
end end