A shell script for scanning the network with Class C IP Addresses from 192.168.0.1 to 192.168.255.255 and listing the active IP addresses. It writes it to a file called IP_list as well as echoes it.
ip_scan.sh:
-------------------------------------------------------------------
#!/bin/bashCheers
# A Useless network scanner
# by Shashank Shekhar
# - Scans the Class C network from 192.168.0.1 to 192.168.255.255
# - Note: Ping doesn't always return the true state of a network node
##
for ((i = 1; i < 256; i++))
do
for ((j = 0; j < 256; j++))
do
ping -c 1 -w 1 192.168.$j.$i > opFile
cnt=$(grep -c -i " 0% packet loss" opFile)
if test $cnt -eq 1
then
echo "192.168.$j.$i is there" >> IP_list
echo "192.168.$j.$i is there"
fi
done
done
~Shashank
PS: I was so bored.
Edit: Evil text-garbling spirits, Stay Away!
2 comments:
err.. I do hope that this is a copy/paste error. That script is not syntactically correct.
Hey thanks for pointing it out. Shucks have no idea how that text got so badly garbled. Just look at the for loop.. LOL!
Just pasted the correct one.
Thanks
Shashank
Post a Comment