MapSweeper version 1.0 ping sweeping script.
78c58f4e6a6537b3dfef8851eccfd453b7b677c8f62d6b7760cde32ccbb49583
#!/usr/bin/env bash
# MapSweeper V1.0
# coded By 0x90 2009
# 0x90[at]bsdmail.org
# www.sec-r1z.com
# This tool will ping sweep networks to discover live devices
# It support Class A,B, C Network's
#
# I do not take any responsibility for what you do with this tool
# Hopefully it will make your life easier rather then making other
# peoples lives more difficult!
##############################
# ___ ___ ___
# / _ \ / _ \ / _ \
#| | | |_ _| (_) | | | |
#| | | \ \/ /\__, | | | |
#| |_| |> < / /| |_| |
# \___//_/\_\ /_/ \___/
##############################
echo ".:: MapSweeper, Coded By 0x90 ::."
echo
#Discover Network with ICMP
echo -n "Enter Start IP: "
read Strange
if [ -z "$Strange" ] ; then
echo Example: $0 192.168.1.1
exit 1
fi
echo -n "Enter End IP: "
read Enrange
if [ -z "$Enrange" ]; then
echo Example: $0 192.168.255.255
exit 1
fi
Stoct1=`echo $Strange | cut -d"." -f1`
Stoct2=`echo $Strange | cut -d"." -f2`
Stoct3=`echo $Strange | cut -d"." -f3`
Stoct4=`echo $Strange | cut -d"." -f4`
Enoct1=`echo $Enrange | cut -d"." -f1`
Enoct2=`echo $Enrange | cut -d"." -f2`
Enoct3=`echo $Enrange | cut -d"." -f3`
Enoct4=`echo $Enrange | cut -d"." -f4`
#Class A Function
class_A () {
for (( x="$Stoct2"; x <= "$Enoct2"; x++));
do
if [ "$x" != "$Stoct2" ]; then
for (( e=1; e <= "$Enoct3"; e++));
do
if [ "$e" != "$Stoct3" ]; then
for (( i=1; i <= "$Enoct4"; i++));
do
ip=""$Stoct1"."$x"."$e"."$i""
p=`ping -t 1 -c 1 $ip | grep icmp |awk '{print $8}'`
if [ "$p" == "ms" ]; then
echo $ip Live
else
echo $ip Dead
fi
done
else
for (( i="$Stoct4"; i <= 255; i++));
do
ip=""$Stoct1"."$x"."$e"."$i""
p=`ping -t 1 -c 1 $ip | grep icmp |awk '{print $8}'`
if [ "$p" == "ms" ]; then
echo $ip Live
else
echo $ip Dead
fi
done
fi
done
else
for (( e="$Stoct3"; e <= 255; e++));
do
if [ "$e" != "$Stoct3" ]; then
for (( i=1; i <= "$Enoct4"; i++));
do
ip=""$Stoct1"."$x"."$e"."$i""
p=`ping -t 1 -c 1 $ip | grep icmp |awk '{print $8}'`
if [ "$p" == "ms" ]; then
echo $ip Live
else
echo $ip Dead
fi
done
else
for (( i="$Stoct4"; i <= 255; i++));
do
ip=""$Stoct1"."$x"."$e"."$i""
p=`ping -t 1 -c 1 $ip | grep icmp |awk '{print $8}'`
if [ "$p" == "ms" ]; then
echo $ip Live
else
echo $ip Dead
fi
done
fi
done
fi
done
}
#Class B Function
class_B () {
for (( e="$Stoct3"; e <= "$Enoct3"; e++));
do
if [ "$e" != "$Stoct3" ]; then
for (( i=1; i <= "$Enoct4"; i++));
do
ip=""$Stoct1"."$Stoct2"."$e"."$i""
p=`ping -t 1 -c 1 $ip | grep icmp |awk '{print $8}'`
if [ "$p" == "ms" ]; then
echo $ip Live
else
echo $ip Dead
fi
done
else
for (( i="$Stoct4"; i <= 255; i++));
do
ip=""$Stoct1"."$Stoct2"."$e"."$i""
p=`ping -t 1 -c 1 $ip | grep icmp |awk '{print $8}'`
if [ "$p" == "ms" ]; then
echo $ip Live
else
echo $ip Dead
fi
done
fi
done
}
#Class C Function
class_C () {
for (( i="$Stoct4"; i <= "$Enoct4"; i++));
do
ip=""$Stoct1"."$Stoct2"."$Stoct3"."$i""
p=`ping -t 1 -c 1 $ip | grep icmp |awk '{print $8}'`
if [ "$p" == "ms" ]; then
echo $ip Live
else
echo $ip Dead
fi
done
}
#start counting scan time
BEGINTIME=`perl -e 'printf "%d\n", time;'`
echo
if [ "$Stoct1" == "$Enoct1" ] && [ "$Stoct2" != "$Enoct2" ]; then
echo "Scan Class A Network ..."
class_A
elif [ "$Stoct1" == "$Enoct1" ] && [ "$Stoct2" == "$Enoct2" ] && [ "$Stoct3" != "$Enoct3" ]; then
echo "Scan Class B Network ..."
class_B
elif [ "$Stoct1" == "$Enoct1" ] && [ "$Stoct2" == "$Enoct2" ] && [ "$Stoct3" == "$Enoct3" ] && [ "$Stoct4" != "$Enoct4" ]; then
echo "Scan Class C Network ..."
class_C
fi
echo
ENDTIME=`perl -e 'printf "%d\n", time;'`
totaltime=`expr ${ENDTIME} - ${BEGINTIME}`
echo Scan Complete in $totaltime seconds
exit 0