in this post i am gonna show you how to make your computer an ip scanner
Note: Give our network interface with which u r connected to the network(eg. instead ofppp0 u can give eth0 or wlan0 )
Read the script and make changes accordingly.
(DOWNLOAD THE IMAGE FOR REFERENCE AS IT IS A LITTLE BIT SMALL)
this is the complete script:
#!/bin/bash
#Name : autoping.sh
#author : ashy
#date : 27/12/2010
#purpose : ping neibouring ips
#########Start################
#finds your ip addr
myip=`ifconfig ppp0 | grep “inet addr” | cut -d: -f2 |cut -d” ” -f1`
echo “Your IP : $myip”
#Name : autoping.sh
#author : ashy
#date : 27/12/2010
#purpose : ping neibouring ips
#########Start################
#finds your ip addr
myip=`ifconfig ppp0 | grep “inet addr” | cut -d: -f2 |cut -d” ” -f1`
echo “Your IP : $myip”
#finds neibouring ip addresses
byte4=`ifconfig ppp0 | grep “inet addr” | cut -d: -f2 |cut -d” ” -f1 | cut -d. -f4`
byte123=`ifconfig ppp0 | grep “inet addr” | cut -d: -f2 |cut -d” ” -f1 | cut -d. -f1,2,3`
i=1
byte123=`ifconfig ppp0 | grep “inet addr” | cut -d: -f2 |cut -d” ” -f1 | cut -d. -f1,2,3`
i=1
echo “!Hosts Alive!”
startip=$1
endip=$2
if [ $startip -ge $endip ]startip=$1
endip=$2
then
echo “Error Occured!!! Check the following.”
echo “Enter Start and Ending IP !!”
echo “OR”
echo “Start and Ending IP should not be equal!!”
echo “OR”
echo “Startip should not be greater than Endip”
exit 0
fi
while [ $startip != $endip ]
do
newip=”$byte123″.”$startip”
ping_result=`ping -c 1 $newip |grep “64 bytes from” |cut -d: -f1 |cut -d ” ” -f4`do
newip=”$byte123″.”$startip”
echo $ping_result
let startip+=1;
done
THANK YOU
No comments:
Post a Comment