IP Address Generation

IP Address Generation

ipAdderGen.rb

Ever need to generate a range of IPs? I have found myself in several situations that called for just that, and I knew I didn't want to generate the list by hand. There isn't any magic involved, but the sheer usefulness of this script makes it noteworthy.

Working with networks on a day-to-day basis means dealing with IP addresses. Sometimes a simple ping sweep is used to identify machines on a network. This script generates a pre-defined list of IPs in any format I choose.

The IPs can then be fed into other utility scripts that perform tasks with each machine. This script can be converted into a reusable library and integrated into a variety of situations.

The Code

 class IP
 def initialize(ip) ...

Get Wicked Cool Ruby Scripts now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.