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
# Force addr to be the address and not hostname
addr = Rex::Socket.getaddress(addr)
addr = Rex::Socket.getaddress(addr, true)
end
ret = {}

View File

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