Sixteen self-contained, runnable Python security tools that turn the course's language and library skills into working scanners, crackers, monitors, and recon utilities.
Part of the [[Readme|Python for Security Professionals]] course.
This module is the hands-on capstone of the course: each note is a complete mini-project with a fully commented, runnable script (argparse CLI where appropriate), an architecture sketch, a source layout, and improvement ideas. The projects progress from raw sockets to web tooling, cryptography, host monitoring, and OSINT — the same building blocks real security tools are made of. Everything defaults to localhost or authorized targets.
[!warning] Authorized use only Every tool here is for learning and for systems you own or are explicitly authorized to test. Unauthorized scanning, brute-forcing, or access is illegal. Keep all experiments in your own lab.
- Build networking tools directly on
socket(TCP/UDP clients, servers, scanners). - Automate web reconnaissance with
requestsandBeautifulSoup. - Apply
hashlib/secretsto password generation, hashing, and integrity monitoring. - Parse and analyze logs with
reandcollections.Counterto detect brute-force activity. - Perform DNS, WHOIS, and subdomain OSINT with
dnspythonand friends. - Structure a small tool: CLI parsing, concurrency, error handling, and clean output.
- Modules 1–14 and the [[Practical-Labs/Readme|Practical Labs]] — projects assume the labs are done.
- A Python 3.9+ interpreter in a virtual environment.
- A lab environment you control for anything that touches the network.
[!warning] Authorized use only Only run these projects against systems you own or are explicitly authorized to test.
- [[Port-Scanner|Port Scanner]] — threaded TCP connect scanner with an argparse CLI.
- [[Banner-Grabber|Banner Grabber]] — fingerprint services by their connection banners.
- [[TCP-Client|TCP Client]] — interactive client for sending data and reading replies.
- [[TCP-Server|TCP Server]] — threaded echo server used as a safe local target.
- [[UDP-Scanner|UDP Scanner]] — connectionless scanning and open/filtered inference.
- [[Web-Crawler|Web Crawler]] — same-domain crawler with
requests+BeautifulSoup. - [[Directory-Bruteforcer|Directory Bruteforcer]] — wordlist-driven HTTP content discovery.
- [[API-Client|API Client]] — reusable
requestssession with auth, retries, and pagination.
- [[Password-Generator|Password Generator]] —
secrets-based, policy-driven generator. - [[Hash-Cracker|Hash Cracker]] — educational dictionary attack with
hashlib. - [[File-Integrity-Monitor|File Integrity Monitor]] — hash baseline and change detection.
- [[Whois-Lookup|Whois Lookup]] — domain/IP registration data with a raw-socket fallback.
- [[DNS-Enumeration|DNS Enumeration]] — A/MX/NS/TXT/SOA record lookups via
dnspython. - [[Subdomain-Enumerator|Subdomain Enumerator]] — wordlist subdomain discovery over DNS.
- [[Log-Analyzer|Log Analyzer]] — parse auth/access logs and flag brute-force sources with
Counter. - [[Network-Inventory-Tool|Network Inventory Tool]] — subnet host discovery plus local inventory with
psutil.
- Run [[TCP-Server]] on
127.0.0.1:9000, then reach it with [[TCP-Client]], [[Port-Scanner]], and [[Banner-Grabber]]. - Generate a hash of your own password and recover it with [[Hash-Cracker]]; then baseline a directory with [[File-Integrity-Monitor]] and detect a change.
- Serve a local site (
python -m http.server), crawl it with [[Web-Crawler]], and discover hidden paths with [[Directory-Bruteforcer]]. - Enumerate a domain you own end-to-end: [[Whois-Lookup]] → [[DNS-Enumeration]] → [[Subdomain-Enumerator]].
The sixteen projects group into five domains, each mapping to a phase of real assessment work:
| Domain | Projects | Used for |
|---|---|---|
| Networking | [[Port-Scanner|Port Scanner]] · [[Banner-Grabber|Banner Grabber]] · [[TCP-Client|TCP Client]] · [[TCP-Server|TCP Server]] · [[UDP-Scanner|UDP Scanner]] | Service discovery and enumeration |
| Web | [[Web-Crawler|Web Crawler]] · [[Directory-Bruteforcer|Directory Enumerator]] · [[API-Client|API Client]] | Attack-surface mapping |
| Crypto & passwords | [[Password-Generator|Password Generator]] · [[Hash-Cracker|Hash Utility/Cracker]] | Credential generation and authorized auditing |
| Recon & OSINT | [[Whois-Lookup|WHOIS Lookup]] · [[DNS-Enumeration|DNS Enumeration]] · [[Subdomain-Enumerator|Subdomain Enumerator]] | Passive and active reconnaissance |
| Monitoring | [[File-Integrity-Monitor|File Integrity Monitor]] · [[Log-Analyzer|Log Analyzer]] · [[Network-Inventory-Tool|Network Inventory Tool]] | Defensive baselining and detection |
Each project is a complete tool rather than a snippet: it has a CLI, structured output, error handling, and a test approach — the difference between a script and something a teammate can use.
- Building the whole tool before running anything — follow the implementation plan and get a minimal version working first.
- Mixing engine and presentation, producing a tool that cannot be reused or given a JSON mode.
- Skipping error handling — network code fails constantly, and a project without it dies on the first unreachable host.
- No timeouts, so one unresponsive target hangs the run.
- Hardcoding targets or credentials in the source instead of taking them from arguments or the environment.
- Ignoring the Testing section — untested tools produce findings nobody should trust.
- Scaling up concurrency without adding rate limiting.
- Follow each project's implementation plan in order; it is sequenced to keep you running code.
- Separate the engine from the CLI from the first commit.
- Support both human-readable and JSON output.
- Set a timeout on every network call and handle failures per target.
- Enforce an authorization/scope check inside the engine.
- Write at least one test per project with the network mocked.
- Attempt one extension idea per project — that is where the design thinking happens.
- Which projects require raw-socket or root privileges, and why?
- What is the difference between the port scanner project and the corresponding practical lab?
- What security issue can occur if a directory enumerator is pointed at a host without authorization?
- How would you add JSON output to a project that currently only prints text?
- Which project would you extend into a scheduled monitoring service, and what would need to change?
# Set up an isolated environment for the project dependencies
python -m venv .venv && source .venv/bin/activate
pip install requests beautifulsoup4 dnspython python-whois psutil
# Run a couple of the tools against your own machine / lab
python port_scanner.py 127.0.0.1 -p 1-1024
python fim.py baseline ./myapp --db baseline.json- Python Standard Library
- Requests · Beautiful Soup · dnspython · psutil
- OWASP Web Security Testing Guide
- MITRE ATT&CK
- [[Socket-Programming-for-Networking]] — the networking foundation for the socket-based tools
- [[Hashlib-Module]] · [[Argparse-Module]] — library notes these projects build on
- [[Readme|Python for Security Professionals]]
- Previous: [[Practical-Labs/Readme|Practical Labs]]
- Home: [[Readme|Course Home]]