A basic TCP port scanner written in Python to explore/learn socket programming, TCP connections and port states.
The scanner uses a TCP socket to connect to every port in the given range that the user has given. When the TCP handshake is successful, it responds back as open if its not it won't display. The scanner also uses a timeout mechannism to prevent filtered from causing the scan to get stuck.
I scanned my local lab machine showing that SSH (port 22) is detected as open.
Scanned my lab again showing that it has the ability to detect multiple active services I host.
Basic input validation is included to handle invalid inputs. Typing letters where port numbers are expected to be wont crash the program and prompt the user a error message.
- How TCP connect scans work and how the TCP handshake determines if a port is open.
- The difference between open and filtered ports.
- Basic exception handling and input validation in Python.
- Learning how to use Python's socket module to create TCP connections.
This project was inspired by CarterPerez-dev's Cybersecurity-Projects repository. Also a video I watched on sockets. Tech With Tim


