As an easy reference, here’s 3 ways to generate an IP address list for use with other scripts using three common scripting methods.
1. Windows For command
Command: FOR /L %variable IN (start,step,end) DO command [command-parameters]
Example: for /L %I (1,1,255) DO echo 192.168.1.%I >> IPs.txt
2. Bash Shell
Example: for (( i=1; i<=5; i++)); do echo "192.168.1.$i"; done
3. Perl Script
#!/usr/bin/perl
for ( $i = 0; $i< 255; $i++)
{
print "192.168.52.$i\n";
}
Obviously you can do this for any class subnet you’d just have to use nested for loops.