All projects

Case study / Security tooling

CyberToolkit

Five network security utilities in standard-library Python, built to understand every layer rather than import it.

Role
Author
Status
Public on GitHub
License
MIT
Tests
pytest
Stack
Python 3.8+, sockets, ThreadPoolExecutor, hashlib, secrets

Concurrent sweep of ports 20 to 100, as in the README example

Overview

Why build it

CyberToolkit started as a hands-on way to work with sockets, hashing, and the everyday building blocks of network security work. I kept it standard-library only, so every piece, from socket handling to thread pooling, is something I had to understand rather than import.

  • Port scannerConcurrent TCP scan with ranges
  • SHA-256 file hashChunked, so large files work
  • Password generatorBuilt on secrets, not random
  • DNS lookupAll IPs for a domain
  • Banner grabberPrints the service banner
  • Python 3.8+No dependencies

Interface

A real session

cybertoolkit.py (example from the README)
$ python cybertoolkit.py
Choice: 1
Enter IP or hostname: scanme.nmap.org
Ports [Enter for common ports]: 20-100
 
Scanning 45.33.32.156 (81 ports)...
 
Open ports:
22/tcp SSH
80/tcp HTTP

Output from the example in the project README. scanme.nmap.org is a host Nmap provides specifically for testing.

Implementation

Design decisions

  • Threaded scanning. A sequential scan of 1,000 ports at a 0.5s timeout could take minutes when ports are filtered. A ThreadPoolExecutor overlaps the waiting, so the scan is bounded by the slowest port rather than the sum of all of them.
  • secrets, not random. Python's random is a pseudo-random generator and unsafe for anything security-related.
  • Chunked hashing. Files are read 64 KB at a time, so hashing doesn't depend on a file fitting in memory.
  • Specific exception handling. Each tool catches the errors it actually expects and reports them distinctly, instead of a bare except that hides problems and swallows Ctrl+C.
  • Hostnames resolved once. A bad hostname fails immediately instead of erroring on every port.

Testing

Tests and scope

A pytest suite covers the port-specification parser: ranges, lists, de-duplication, and invalid input. The network functions are verified manually against a local listener.

Authorized use only. The README spells it out: the scanner and banner grabber should only be pointed at systems you own or have explicit written permission to test.

Repository

Source

Public on GitHub under the MIT license. A separate lab copy, cybertoolkit-lab, is where I experiment with AI coding agents without touching the main repository.

Possible extensions

  • UDP scanning
  • Export results to JSON or CSV
  • Concurrent banner grabbing across multiple ports
  • Reverse DNS lookups

Related projects