#A script to identify any device that is using factory settings within the network ie default username and password. #The script is designed so that the user (Network Admin) enters in both the start and end of the IP range of the network and a address list #is then generated and logged.After logging the range of the network each address will be pinged to detect if a device is located on that address #A second log file is created and the active address are then listed. On a second round the script will grab any information the device is #showing and log this as well. The known device locatations are then to be cross referenced with a default list of device usernames and passwords. #If a device is able to be access with one of the defaults it will be listed as TRUE in the log and the device will be identified as well. #Once complete an email will be sent to the admin containing the three log files. #!/usr/bin/perl -w use strict; use warnings; use diagnostics; #Enter and Validate IP Address Range. use Data::Validate::IP qw(is_ipv4 is_ipv6); print "Enter IP Range Starting Address:"; my $answera = ; if(is_ipv4($answera)){ print "Looks like an ipv4 address\n"; } else { print "Not an ipv4 address\n"; print "\nReEnter Address:"; my $answera = ; } print "\nEnter IP Range Finishing Address:"; my $answerb = ; if(is_ipv4($answerb)){ print "Looks like an ipv4 address"; } else { print "Not an ipv4 address\n"; print "\nReEnter Address:\n"; my $answerb = ; } use Net::IP; use NetAddr::IP; my $ipa = new NetAddr::IP->new($answera); my $ipb = new NetAddr::IP->new($answerb); print "\nNetwork starts at $ipa and finshes at $ipb\n"; #Create a log file with the active IP address and corresponding device names. open (MYLOG, '>>addressrange.txt'); print MYLOG "Network starts at $ipa and finshes at $ipb"; print MYLOG "$ipa +(1)"; close (MYLOG); #Create range between the two entered IP address' #Ping address' within the range. Log these in the log file. use Net::Ping; my $p = Net::Ping->new(); $p->ping($ipa [,5]); print "$ipa ia alive.\n" if $p->ping($ipa); $p->close();