LinuX

Make your own ip scanner

This is the simple bash script to scan your neighbouring ips. You just have to give starting  and ending ips.

Note: Give our network interface with which u r connected to the network(eg. instead of ppp0 u can give eth0 or wlan0 )

Read the script and make changes accordingly.

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”

#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

echo “!Hosts Alive!”
startip=$1
endip=$2

if [ $startip -ge $endip ]
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`
echo $ping_result
let startip+=1;
done

#########End##################

@@@@@@@@@@@@@@@@@@@@@@@@@


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: