1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-12 11:52:01 +01:00

Fixes #522. Allow RHOSTS to contain hostnames with dashes

git-svn-id: file:///home/svn/framework3/trunk@7547 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
HD Moore 2009-11-16 23:20:59 +00:00
parent dc0dc98771
commit 9b1935eb2a

View File

@ -365,9 +365,21 @@ class OptAddressRange < OptBase
ranges = value.split(',')
ranges.each do |range|
tmp = nil
tmp = range.split('-')
tmp[1] ||= tmp[0]
# Only split into a range when the input is an IPv4 address
if(range.index('-') and range =~ /^[0-9\.\-]+$/)
tmp = range.split('-')
tmp[1] ||= tmp[0]
else
# Check for an IPv6 range
if(range =~ /^[a-f0-9\.:\-]+$/)
tmp = range.split('-')
tmp = nil if Rex::Socket.addr_aton(tmp[0]).length != 16
end
tmp = [range,range] if tmp.nil?
end
if(tmp[0] == tmp[1] and tmp[0] =~ /\//)
tmp = Rex::Socket.cidr_crack(tmp[0])