mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-05 14:57:30 +01:00
fix ipv6 handling for single addresses
git-svn-id: file:///home/svn/framework3/trunk@7706 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
5952e29040
commit
1e6b6b3d62
@ -39,8 +39,8 @@ class RangeWalker
|
||||
# Then it's IPv6
|
||||
# Can't really do much with IPv6 right now, just return it and
|
||||
# hope for the best
|
||||
addr = Rex::Socket.addr_itoa(Rex::Socket.addr_atoi(arg))
|
||||
ranges.push [addr, addr]
|
||||
addr = Rex::Socket.addr_atoi(arg)
|
||||
ranges.push [addr, addr, true]
|
||||
elsif arg.include?("/")
|
||||
# Then it's CIDR notation and needs special case
|
||||
if arg =~ /[,-]/
|
||||
@ -95,7 +95,7 @@ class RangeWalker
|
||||
@curr_range += 1
|
||||
@curr_addr = @ranges[@curr_range][0]
|
||||
end
|
||||
addr = Rex::Socket.addr_itoa(@curr_addr)
|
||||
addr = Rex::Socket.addr_itoa(@curr_addr, @ranges[@curr_range][2])
|
||||
@curr_addr += 1
|
||||
return addr
|
||||
end
|
||||
|
@ -4,6 +4,11 @@ require 'rex/socket'
|
||||
require 'rex/socket/range_walker'
|
||||
|
||||
describe Rex::Socket::RangeWalker do
|
||||
it "should handle single ipv6 addresses" do
|
||||
walker = Rex::Socket::RangeWalker.new("::1")
|
||||
walker.should be_valid
|
||||
walker.length.should == 1
|
||||
end
|
||||
it "should handle ranges" do
|
||||
walker = Rex::Socket::RangeWalker.new("10.1.1.1-2")
|
||||
walker.should be_valid
|
||||
|
Loading…
Reference in New Issue
Block a user