Code

Python (Systems & Security)

Beyond testing: clean CLI tools, asyncio, raw sockets, struct, scapy, and pwntools.

Chapter 1: CPython Internals, Bytecode & Object Model

Tracing Python from source text to CPython bytecode, PyObject memory headers, reference counting, cyclic GC, mutability invariants, and the GIL.

6 scenes · 3 min

Chapter 2: Clean CLI Engineering

Building scriptable, composable Unix-grade command-line tools with argparse, pathlib, structured logging, POSIX exit codes, config precedence, and packaging.

6 scenes · 3 min

Chapter 3: Processes, Subprocess Safety & OS Signals

Spawning external commands without shell injection, streaming pipes with Popen, enforcing timeouts, handling POSIX signals, and sanitizing child environments.

6 scenes · 3 min

Chapter 4: Binary Data, `bytes`, `memoryview` & `struct`

Mastering the boundary between Unicode text and raw octets, zero-copy memory views, endian-safe struct packing, bitfields, framing, and untrusted bounds validation.

6 scenes · 3 min

Chapter 5: Concurrency: Threading, Multiprocessing & `concurrent.futures`

Choosing threads vs processes deliberately, eliminating race conditions with locks and queues, scaling fan-out with executors, and preventing deadlocks.

6 scenes · 3 min

Chapter 6: Modern `asyncio`

Mastering single-threaded cooperative concurrency: event loops, TaskGroup structured concurrency, semaphores, timeouts, async TCP streams, and offloading blocking calls.

6 scenes · 3 min

Chapter 7: Low-Level Sockets & Custom Network Protocols

Mastering the BSD socket lifecycle, TCP stream framing, UDP datagrams, non-blocking selectors multiplexing, hardened TLS contexts, and socket timeouts.

6 scenes · 3 min

Chapter 8: HTTP Clients, Scraping & API Security Testing

Driving HTTP cleanly with urllib and http.client, URL parsing hygiene, auth headers and token redaction, rate-limiting with jitter, structured HTML/JSON parsing, and API header audits.

6 scenes · 3 min

Chapter 9: Cryptography & Hashing in Python

Choosing the right cryptographic primitives: streaming hashlib digests, HMAC with constant-time comparison, CSPRNG tokens via secrets, scrypt password KDFs, AEAD, and envelope encryption.

6 scenes · 4 min

Chapter 10: Packet Crafting & Traffic Inspection

Dissecting layered network headers with struct, verifying RFC 1071 checksums, reading and writing standard PCAP captures, BPF filtering concepts, layered packet models, and flow triage.

6 scenes · 3 min

Chapter 11: Binary Analysis & Exploit Automation Patterns

Inspecting ELF and Mach-O binary headers with struct, verifying segment permissions and hardening mitigations, understanding De Bruijn offset triage, endian packing helpers, and entropy analysis.

6 scenes · 3 min

Chapter 12: Defensive Python: Static Analysis, Input Validation & Common Pitfalls

Eliminating Python's highest-severity vulnerability classes: unsafe deserialization, eval/exec injection, path traversal, SSRF, SQL injection, and custom AST security linters.

6 scenes · 3 min

Chapter 13: Profiling, Memory Leaks & C Extensions

Measuring real CPU hotspots with cProfile, pinpointing memory growth with tracemalloc, trimming object overhead with __slots__, and bridging native libraries safely via ctypes FFI.

6 scenes · 3 min

Chapter 14: Building a Production Recon & Health-Check Tool

Synthesizing everything into a production-ready asynchronous service discovery and health-check tool: typed dataclasses, bounded async probes, retries, NDJSON telemetry, deterministic tests, and CLI exit codes.

6 scenes · 3 min