Author: Not specified Language: bash
Description: Not specified Timestamp: 2017-09-04 17:34:17 +0000
View raw paste Reply
  1. require 'netaddr'
  2. require 'net/ping'
  3. puts "Welcome to Ruby IP"
  4. print "Please enter an ip CIDR range (ex. 10.11.1.0/24): "
  5. input = gets
  6. puts input
  7. #iprange = IP.new("#{input}")
  8. #puts "#{iprange}"
  9. #puts iprange.netmask
  10.  
  11. ips = NetAddr::CIDR.create(input.strip).enumerate
  12. ips.each do |address|
  13.         p1 = Net::Ping::External.new(address)
  14.         puts "#{address} #{p1.ping?}"
  15.         end
View raw paste Reply