Port scanner in bash (TCP)
First, source the functions:
. scanner
Execute the scan with the following syntax:
scan <host> <port, ports, port-range>
Examples:
scan google.com 80 scan google.com 78-82 scan google.com 25,80,443
user@host:~/bash-port-scanner$ . scanner user@host:~/bash-port-scanner$ scan google.com 78-82 78/tcp closed 79/tcp closed 80/tcp open 81/tcp closed 82/tcp closed user@host:~/bash-port-scanner$ scan google.com 25,80,443 25/tcp closed 80/tcp open 443/tcp open
Original concept found here: http://www.catonmat.net/blog/tcp-port-scanner-in-bash/
I made a couple tweaks in the formatting. I plan to abstract it a little further to incorporate UDP.