From 11945786c943254a9b457fbccc9b907a5001a370 Mon Sep 17 00:00:00 2001 From: Rob Fuller Date: Mon, 17 Feb 2014 11:22:15 -0500 Subject: [PATCH] standalone iplist creator --- tools/makeiplist.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tools/makeiplist.rb diff --git a/tools/makeiplist.rb b/tools/makeiplist.rb new file mode 100644 index 0000000000..838952c1b2 --- /dev/null +++ b/tools/makeiplist.rb @@ -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