Skip to content

devogabs/port-scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple Python Port Scanner

I built this project to get comfortable with Python's socket library and to understand how network connections work under the hood. It started as a basic script and I've been refactoring it to make it faster and more efficient.

What it does

  • Scans a range of TCP ports on a target IP address.
  • Uses multithreading (ThreadPoolExecutor) to scan ports in parallel (much faster than a basic loop).
  • Identifies your own public IP for testing purposes.

How to run it

  1. Clone the repo: git clone https://github.com/devogabs/python-port-scanner.git cd python-port-scanner

  2. Install dependencies: pip install -r requirements.txt

  3. Run the scanner: python src/scanner.py

What I learned building this

  • Sockets: I learned how the TCP three-way handshake works and how connect_ex returns error codes instead of crashing the program.
  • Concurrency: My first version was very slow. I learned how to use ThreadPoolExecutor to handle hundreds of port checks at the same time.
  • Lambda Functions: I used lambdas to pass arguments into my threaded functions—which was confusing at first, but makes the code a lot cleaner.

Next Steps / Roadmap

  • Add a SYN scan (stealth scan) using Scapy.
  • Add the ability to export results to a .csv file.
  • Implement a GUI or a more robust CLI with argparse.

Disclaimer: This tool is for educational purposes only. Do not use it to scan networks you do not own or have explicit permission to test.

About

a little port scanner to learn about networks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages