Pejman Moghadam / Scripts

IP range scanner

Public domain


#!/bin/bash

ip="192.168.10."

RED='\E[1;31m'
GRN='\E[1;32m'
RES='\E[0m'

for n in $(seq 1 254); do
  echo -ne "$ip$n\t"
  alive=""
  alive=$(ping "$ip$n" -c 1 -W 1 | grep "time=")
  if [ "$alive" == "" ]; then
    echo -ne "${RED}Timeout${RES}\x0d"
  else
    echo -e "${GRN}Alive  ${RES}"
  fi
done
echo

BY: Pejman Moghadam
TAG: bash, bash-script
DATE: 2007-10-09 15:24:29


Pejman Moghadam / Scripts [ TXT ]