Below you will find a simple script made with awk and bash to create network maps.
The script basically needs to know the base ip address and the range of ips to explore and it will try to ping every single ip. If an ip address is alive then it will be added to the map file.
The script generates a mapfile.txt archive with the resulting network map.
Its useful either to understand how you can use the powerful awk with bash scripting or simply as a network tool.
The Script Below:
# - IP MAPPER BY FELIPE CRUZ
baseip="10.0.0."
range=256 # - Number of ips to trace
cont=1
echo "Starting Mapping Process, this may take a while ..."
echo "MAP FILE will be saves in ./mapfile.txt"
while [ $cont -lt $range ]; do
res=`ping -c 1 -W 1 $baseip$cont | sed '1d'| awk '{printf "%1-s",$6}'`
#echo $res
process=` echo $res | awk -F"=" '{printf "%1-s",$1}'`
if [ "$process" == "ttl" ]; then
echo "IP $baseip$cont IS ALIVE!"
echo "IP $baseip$cont IS ALIVE" >> ./mapfile.txt
fi
let cont=cont+1
done
Recent Comments