Friday, December 15, 2006
SimpleIP Ruby IP Address Management Library
This is Ruby library for handling simple IP related tasks such as forward and reverse DNS lookups as well as providing a basic IP address management class.
require 'SimpleIP'
ipaddress = SimpleIP.host2ip("www.pentester.com.au")
server = SimpleIP.ip2host(ipaddress)
network = SimpleIPNetwork.new("10.0.0.1-10")
network.each do | ip |
print ip
end
network.set("10.0.0.1-1.255")
print network.first()
print network.last()
network.set("10.0.0.0/28")
print network.includes?("10.0.0.1")
print network.includes?("10.1.1.1")
The class handles IP ranges including CIDR blocks.
The SimpleIP library can be downloaded from here.
require 'SimpleIP'
ipaddress = SimpleIP.host2ip("www.pentester.com.au")
server = SimpleIP.ip2host(ipaddress)
network = SimpleIPNetwork.new("10.0.0.1-10")
network.each do | ip |
print ip
end
network.set("10.0.0.1-1.255")
print network.first()
print network.last()
network.set("10.0.0.0/28")
print network.includes?("10.0.0.1")
print network.includes?("10.1.1.1")
The class handles IP ranges including CIDR blocks.
The SimpleIP library can be downloaded from here.