1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-05 14:57:30 +01:00

standalone iplist creator

This commit is contained in:
Rob Fuller 2014-02-17 11:22:15 -05:00
parent 52ac85be11
commit 11945786c9

27
tools/makeiplist.rb Normal file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env ruby
#
#
# This script takes a list of ranges and converts it to a per line ip list
#
msfbase = __FILE__
while File.symlink?(msfbase)
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', 'lib')))
require 'msfenv'
require 'rex'
f = File.open('rangelist.txt', 'r')
w = File.open('iplist.txt', 'a')
f.each_line do |range|
ips = Rex::Socket::RangeWalker.new(range)
ips.each do |ip|
w.write("#{ip}\n")
end
end
f.close
w.close