mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
add a rand: special case for OptAddress options
git-svn-id: file:///home/svn/framework3/trunk@11071 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
b42a04a7aa
commit
fe9710b836
@ -344,6 +344,16 @@ class OptAddressRange < OptBase
|
||||
path = $1
|
||||
return false if not File.exists?(path) or File.directory?(path)
|
||||
return File.readlines(path).map{ |s| s.strip}.join(" ")
|
||||
elsif (value =~ /^rand:(.*)/)
|
||||
count = $1.to_i
|
||||
return false if count < 1
|
||||
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
|
||||
}
|
||||
return ret
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user