Sunday, June 8, 2014

Bash Script for Active IP Address Detection within a Range

The bash script that aims to ping a range of IP addresses in order to determine which ones are active on a network. 

Execute the script by running ./up_ip.sh followed by the base IP address you want to use. For example, if you want to ping the IP addresses in the range of "192.188.20.1" to "192.188.20.254", you would run ./up_ip.sh '192.188.20'



#!/bin/bash

if ["$1" == ""]
then
	echo "Syntax: ./up_ip.sh 192.188.20"
else
for ip in `seq 1 254`; do
	ping -c 1 $1.$ip | grep "64 bytes" | cut -d " " -f 4 | tr -d ":" &
done
fi

No comments:

Post a Comment