Created
July 18, 2014 19:30
-
-
Save fluxrad/89bfd8a114c09b32dfde to your computer and use it in GitHub Desktop.
Explode a list of netmasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'netaddr' | |
| File.open("networks.txt").each_line do |line| | |
| line.chomp! | |
| puts "### #{line} ###" | |
| NetAddr::CIDR.create(line).enumerate.each do |ip| | |
| puts "#{ip}" | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'https://rubygems.org' | |
| gem 'netaddr' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 10.0.0.0/23 | |
| 192.168.0.4/16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment