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
This version uses netcat to check a particular service.
`while true`: do forever `nc -l -p 4300 -c 'echo hello'`: this is the but anything can go here really `test $? -gt 0 && break`: this checks the return code for ctrl^c or the like and quite the loop, otherwise in order to kill the loop you'd have to get the parent process id and kill it. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: