Python for Security Automation
Learn just enough Python to parse logs, extract indicators, automate repetitive analysis, and build a tested log triage tool.
Basic Python syntax helps, but the module includes a short refresher. You need a working Python 3 environment.
Parse logs, enrich indicators, handle errors, build a lab-only port scanner with rate limits and banner grabbing, and ship a triage tool that produces consistent, reviewable output.
Read in order, or jump to what you need.
Every lesson builds on the one before it. Open any lesson to read the explanation, run the examples, and try the practice challenges.
- 06.01Python for Security: First Steps5 min
Use variables, collections, functions, files, and exceptions to turn a repetitive security task into a small, reliable program.
- 06.02Parse Logs and Extract Indicators5 min
Turn raw logs into structured evidence with regular expressions, JSON, CSV, and careful de-duplication.
- 06.03Build a Port Scanner and Banner Grabber in Python7 min
Use sockets, timeouts, thread pools, rate limiting, and banner grabbing to build a lab-only TCP scanner that writes reproducible JSON and CSV output.
- 06.04Project: Build a Tested Log Triage ScriptProject4 min
Turn a messy authentication log into a deterministic JSON and Markdown triage report with tests and documented assumptions.
Ready to move on?
Your log-triage script reads synthetic data and writes a summary with clear limits, and your port scanner returns reproducible JSON and CSV against a lab host.
Open the module self-check