UnixServerAdmin

Server Administration & Management

network_scan.sh

#!/bin/bash
ip=$( ifconfig | grep “192.168” | cut -d: -f2  | awk ‘{print $1}’ )
echo
echo “Current IP Address of the box $ip”
sub=$( echo $ip | awk -F. ‘{print $3}’ )
echo
echo “Subnet used is 192.168.’$sub’.”
echo
echo “Checking for Computers Online on Local Network”
nmap -sP 192.168.$sub.0-255 | grep -v ‘MAC’ | awk ‘{print $2,$3}’

Advertisements

March 27, 2012 - Posted by | Shell Script |

No comments yet.

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: