Matteo Michelini

Saturday, October 09, 2010

OSCP: script for host discovery on a LAN

# for ip in $(seq 1 254); do ping -c 1 192.168.10.$ip>/dev/null; [ $? -eq 0 ] && echo "192.168.10.$ip UP" || : ; done


[ $? -eq 0 ] && echo "192.168.10.$ip UP" || :

This is a Ternal Operator
if $? (exit status of the last job) is eq 0 echo otherwise do nothing

0 Comments:

Post a Comment

<< Home