Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created September 3, 2015 02:36
Show Gist options
  • Save anonymous/4aad95936b66e47300e0 to your computer and use it in GitHub Desktop.
Save anonymous/4aad95936b66e47300e0 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'ipaddr'
network1 = IPAddr.new("10.0.0.0/8")
network2 = IPAddr.new("172.16.0.0/16")
addresses = ['10.10.10.10', '10.10.10.20', '10.10.10.30']
addresses.each do |address|
if network1.include?(address)
puts "In 10.0.0.0/8"
end
if network2.include?(address)
puts "In 10.0.0.0/8"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment