A Minimal Cross-platform Port Scanner in Python
Posted by appusajeev on July 6, 2009
A Port Scanner is one of the most basic tools in the arsenal of an attacker/administrator. Basically a port scanner is a tool which can identify the open ports on a remote system. Given an ip address and an optional port range,a port scanner tries to connect to the ports on the machine sequentially and a successful connection means an open port. Open ports can sometimes prove to be a juicy entry point for an attacker,when there is a vulnerable application/service on the other side with an open port.
With that basic idea,presented here is a minimal port scanner i developed Python.
No rocket science,pretty straight forward code. The source can be altered to make it a portsweeper even
You can download the source here
The source is displayed below. And remember,this is a simple portscanner .So no advanced features
First,the program checks for the right number of command line arguments which includes the remote IP address,starting port and ending port. After extracting these parameters , a TCP socket is created each time to connect to the different ports sequentially on the same machine. A successful connection means that that port is open and some application/service is listening to it.
Currently what bothers me is the time taken to complete the scan. It takes quite some time :d
Suggestions and bug reports are welcome…….
neo2904 said
hey…thats simple yet powerful..good work
smogger said
thats sme serious stuff out ther…
hey people..it may sound simple but u cant imagine hw powerfull this is..
i hope u learnt is so that u may be spared 😉
Nikhil said
great
simple one and working very well
saintah said
well its wonderful!!!!
saint