$ seq 1 255 | parallel -j+0 ‘nc -w 1 -z -v 192.168.1.{} 80′

It takes over 5 seconds to scan a single port on a single host using nmap

time (nmap -p 80 192.168.1.1 &> /dev/null)

real 0m5.109s

user 0m0.102s

sys 0m0.004s

It took netcat about 2.5 minutes to scan port 80 on the class C

time (for NUM in {1..255} ; do nc -w 1 -z -v 192.168.1.${NUM} 80 ; done &> /dev/null)

real 2m28.651s

user 0m0.136s

sys 0m0.341s

Using parallel, I am able to scan port 80 on the entire class C in under 2 seconds

time (seq 1 255 | parallel -j255 ‘nc -w 1 -z -v 192.168.1.{} 80′ &> /dev/null)

real 0m1.957s

user 0m0.457s

sys 0m0.994s

View this command to comment, vote or add to favourites
View all commands by devrick0

commandlinefu.com

by David Winterbottom (codeinthehole.com)


Tags: