metasploit-framework/tools/makeiplist.rb

28 lines
575 B
Ruby
Raw Normal View History

2014-02-17 16:22:15 +00:00
#!/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