O'Reilly logo

Wicked Cool Ruby Scripts by Steve Pugh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required