I was playing around with sockets yesterday and for no reason whatsoever decided to write my own very simple/naive port scanner. After I was finished I discovered through Google that there is a nice Python-Nmap Library I could have used, that would have saved me the time I spent implementing my own.
Port scanners are used to probe a host or server for open ports. It is a handy way of identifying certain services running on said machine. It is ethically questionable to run a port scan on a machine or network you don't own as it may be looked at as a precursor to launching an attack. Port scans could potentially reveal a lot of sensitive information about the host. There have been cases where people have been charged criminally for running port scans, this is basically because of an ethical problem; it being hard to prove whether there was malicious intent involved.
This simple_port_scan.py script is easy to use. All you need to do is run python simple_port_scan.py -H someHost.com -p 80,8080...[any_ports] I didn't put a whole lot of time into writing it so don't expect a lot! I'm just playing around with python a bit more and getting more familiar with some of it's libraries/features. Go forth and don't scan any ports :')