A hands-on, book-style course for learning on a Mac: macOS Terminal (zsh), how to write code at all (Python and JavaScript side by side, with a robot you can watch), networking (including VPNs and tunnels), Python, web development (HTML, CSS, JavaScript, DevTools, DOM, cookies and tracking, XML, Node.js, web APIs), servers and cloud, and security (an eleven-chapter Security part: cryptography from plaintext and ciphers to PKI, blockchain, and network security from firewalls to TLS and IPsec; an Ethical Hacking part; and, in Projects, Wireshark packet analysis (with a Lua dissector you write yourself), nmap scanning, an HTTP client workbench, hardening, log triage and incident response). It is one self-contained web page with runnable Python and JavaScript, a simulated terminal, interactive labs, exercises with automatic checks, quizzes and projects.
- 92 chapters in 12 parts, 887 command cards, 421 exercises
- A Wireless section at the end of Networking: five chapters on Wi-Fi (WPA2, WPA3, 802.1X), Bluetooth and BLE, Zigbee, Thread and Matter, LoRa and LoRaWAN, and testing wireless security. Each has real protocol captures made for the book that you can open in the page (a field tree with hex and bit views), download as
.pcapand open in Wireshark or a hex viewer, plus scripts that verify the keys, MICs and replay rules and a Lua module for Wireshark (see The Wireless section below) - An Ethical Hacking part between Security and Projects: 12 chapters from scope and law through OSINT, DNS, enumeration, physical/local access, user and identity security, SSH, spoofing, web and API attacks, privilege escalation and the modern (cloud, container, supply-chain) attack surface, to detection and reporting, with a capstone (see below); each opens with a picture of its central idea and carries 42 interactive models (kill chain, scope checker, ARP poisoning, attack-path graphs, a detection scatter plot built from the lab's own log and more)
- A Security part of eleven chapters (cryptography, encryption, trust and PKI, blockchain, network security), with twenty interactive labs, seven step-through message sequences and a dozen diagrams placed inside the sections that teach them (see The Security part below)
- A Learn to Code part right after the shell, for readers who have never programmed: ten short chapters in which every idea is shown as a picture of the program running, tried in editable Python and JavaScript side by side, and used to steer a small robot called Bit (see below)
- A Cookies, Tracking and Privacy chapter in the Web part (what a cookie is,
Set-Cookieattributes, sessions and their attacks, third-party cookies, fingerprinting, profiles and prediction, browser defences, cookie forensics), with nine interactive labs whose rules are checked against a real Chromium - An HTTP Client Workbench chapter in the Projects part (after Nmap): the three modes of an HTTP client (send and read requests, map a site from
robots.txtand sitemaps, look up a name or an address), the rules that keep it safe to point at anything, and the real work each is for, with five interactive labs (see below) - A VPNs and Tunnels chapter in the Networking part (WireGuard, IPsec/IKEv2, OpenVPN, MTU, leaks) and an Nmap chapter in the Projects part (scan types, host discovery, version and OS detection, NSE, ndiff, the defender's view), each with interactive diagrams
- A Cisco IOS cheat sheet in the Reference part: modes, help keys, output filters, 69 IOS command cards with examples, and a DHCP & DNS lab infographic
- Python runs in the browser (Pyodide); JavaScript runs in a sandbox with a built-in practice REST API
- Light, dark and system themes; works on phones
- Nothing is downloaded when you open it: the fonts are bundled in the page, and
test/offline.pyfails CI if a request ever leaves it - 19 interactive labs in the first lab set, placed inside the sections they teach (bit switches, logic gates, packet dissector, cron explainer and more); the chapters listed above bring their own, described in the sections below
Twelve parts, in the order of the sidebar. The numbers are the ones the sidebar and each chapter's header show; they follow the order of the chapter files, so
they move when a chapter is added. Links, saved progress and the app's table of contents use the chapter id (for example net-reach), which does not.
| Part | Numbers | Count | What is in it |
|---|---|---|---|
| Start here | 00-01 | 2 | Welcome, Setting Up Your Lab |
| Foundations | 02-05 | 4 | How Computers Work, How Networks Work, Addressing & Subnetting, Thinking Like a Programmer |
| The shell (zsh) | 06-11 | 6 | zsh Fundamentals, Files, Folders & Permissions, Streams, Redirection & Pipes, The Text-Processing Toolkit, Shell Scripting in zsh, System, Processes & macOS Tools |
| Learn to Code | 12-21 | 10 | Meet Bit, Variables and Values, Decisions, Loops, Functions, Lists, Dictionaries, Errors and Debugging, Objects and Classes, Capstone: Bit’s Delivery Run |
| Networking | 22-35 | 14 | See Your Own Network, Reachability, Latency & Path, DNS, HTTP and TLS, Ports and Scanning, Packet Capture, Remote Access with SSH, VPNs and Tunnels, Troubleshooting a Network, then the Wireless section: Wi-Fi, Bluetooth and Bluetooth Low Energy, Zigbee, Thread and Matter, LoRa and LoRaWAN, Testing Wireless Security |
| Python | 36-44 | 9 | Getting Started with Python, Python Basics, Python Control Flow, Python Data Structures, Files and Regular Expressions, Errors, Debugging & Testing, Modules and Packages, Classes and Idiomatic Python, Python for Networking |
| Web development | 45-55 | 11 | How the Web Works, HTML, CSS, JavaScript Fundamentals, JavaScript in Depth, Browser DevTools, The DOM, Cookies, Tracking and Privacy, XML and Friends, Node.js, Web APIs |
| Servers & Cloud | 56-57 | 2 | Server Basics, Cloud Computing |
| Security | 58-68 | 11 | Cryptography Foundations, Classical Ciphers, Hashing and MACs, Symmetric Encryption, Asymmetric Cryptography, Digital Signatures, Digital Certificates and PKI, Blockchain, Network Security Fundamentals, TLS: Encryption in Transit, IPsec in Depth |
| Ethical Hacking | 69-80 | 12 | Rules, Law and Your Lab, OSINT and Passive Reconnaissance, DNS Through an Attacker's Eyes, Active Reconnaissance, Physical and Local Access, User and Identity Security, SSH, Attack, Pivot, Defend, Spoofing and Man-in-the-Middle, Web and API Attacks, Privilege Escalation, The Modern Attack Surface, Defence and Reporting |
| Projects | 81-87 | 7 | Wireshark Packet Analysis, Scanning with Nmap, The HTTP Client Workbench, Defending Your Mac and Servers, Capstone: netkit, Capstone: a LAN Dashboard, Where to Go From Here |
| Reference | 88-91 | 4 | Cheat Sheets, Cisco IOS Cheat Sheet, Wireshark Cheat Sheet, Fixes |
dist/toc.json carries the same list, and the Welcome chapter's map of the book (a diagram and a table) repeats it, so it has to be updated with it whenever a chapter is added or moved.
cd dist
python3 -m http.server 8765
Then open http://localhost:8765/index.html. Opening index.html by double-clicking works for reading, but the
in-page Python needs to be served over HTTP.
- Theme: the button in the top bar cycles System, Light, Dark. System follows your operating system live. The choice is saved with your progress.
- Palette: neutral greys, black and white with a single accent colour. Code keeps desaturated syntax colours so it stays readable.
- Layout: a reading column up to 868 px wide, with Inter at 16.5 px (16 px on a phone) for text and JetBrains Mono for code, both bundled in the page (
src/fonts/), so there is no font server to contact. - Diagrams and command output sit on a strict monospace grid.
tools/lint_ascii.pyandtest/ascii.pyfail the build if a box border drifts or if anything meant to line up falls back to a proportional font.
| Light | Dark |
|---|---|
![]() |
![]() |
A ten-chapter part between the shell and Networking (chapters/ch_code_*.py). It follows one robot, Bit, who lives on a grid and does exactly what the program says. Every idea comes three ways: see it
(a stepper that runs a short program one line at a time), try it (editable code in the page) and why it exists (the problem the idea was invented to solve). Every example is written in Python and in
JavaScript, line for line; a switch at the top of each widget shows one language or both, and the choice is remembered.
| Chapter | Bit learns | The idea |
|---|---|---|
| Meet Bit | to move and turn | a program is exact instructions run in order; bugs; reading code |
| Variables and Values | to remember | variables, the kinds of value, arithmetic, joining text, names |
| Decisions | to look before stepping | comparisons, if/elif/else, and/or/not, sensors |
| Loops | to repeat | for, while, accumulators, nesting, break, endless loops |
| Functions | to learn new skills | define and call, parameters, return, scope, the call stack |
| Lists | to carry many things | indexes, adding and removing, going through, filtering, aliasing |
| Dictionaries | to look things up | keys and values, counting, nested data, JSON, sets |
| Errors and Debugging | to find its own bugs | the three kinds of problem, reading errors, off-by-one, tests |
| Objects and Classes | to be one of a fleet | classes, methods, self and this |
| Capstone: Bit's Delivery Run | to work a shift | three delivery runs and a small project that uses everything |
The pieces behind it:
| Widget | Source | What it does |
|---|---|---|
codestep |
src/ws-code-b-step.js |
steps a program line by line: highlighted line, variables drawn as pictures (number tiles, switches, shelves, cards), the call stack, what was printed, a sentence of narration, and a gutter that marks the path taken |
codetry |
src/ws-code-c-try.js |
the same program in Python and JavaScript, both editable and runnable; "Run both and compare" shows that they print the same thing |
bitgrid |
src/ws-code-d-grid.js |
Bit's world: the learner's own code runs in either language and Bit acts it out. Missions can have several maps and a "Check all maps" button, so a solution has to be general, and some limit the number of lines |
Authoring helpers are in chapters/lib.py: STEP(...), TRY(...) and BITGRID(...). A stepper's trace is recorded at build time by really running the Python version under sys.settrace
(chapters/codetrace.py), so the pictures cannot drift from what the code does; the JavaScript version is lined up with it line for line, and the build refuses a pair that does not line up.
test/code_pairs.py runs every JavaScript example with node and checks that it prints what the Python version printed. test/codeviz.py checks every mission in a real browser: the solution wins
on every map in Python and in JavaScript and both leave the same log of events, the starter code does not already win, the steppers and editors work, and nothing overflows a 390 px screen.
Each lab sits next to the explanation it belongs to, not in a separate gallery. They are keyboard-operable, work on phones, and
respect reduced-motion settings. Nineteen of these rows are the labs built from packages/labs (see Adding a lab); the TCP flags byte is a figure in the Wireshark Cheat
Sheet. The VPN, nmap, cookie, HTTP client, Security and Ethical Hacking labs have their own sections below.
| Lab | Where you find it | What it shows |
|---|---|---|
| Bit switches | How Computers Work, bits | flip bits; decimal, hex, two's complement, overflow |
| Text to bytes | How Computers Work, UTF-8 | code points and the 1 to 4 bytes UTF-8 uses |
| Bit mask lab | How Computers Work, bit operations; Python Basics, operators | AND, OR, XOR, clear; TCP flag byte; masking an IP address |
| Logic gates and adders | How Computers Work, the machine | gate symbols, truth tables, full adder, 4-bit ripple adder |
| Latency ladder | How Computers Work, the machine | cache, RAM, SSD, network scaled to human time |
| PATH lookup | How Computers Work, PATH; Python Modules, import | first match wins; shadowing (python3, a local random.py) |
| Search and sort racer | Thinking Like a Programmer | linear vs binary search; bubble, insertion and merge sort |
| Cron explainer | Shell Scripting, scheduling | plain-English meaning and the next five run times |
| Signals and process states | System, signals | STOP, CONT, TERM, KILL; zombies and wait() |
| ssh config builder | Remote Access with SSH | a Host block and the long command it replaces |
| HTML to DOM tree | HTML, the parser | what the browser builds from broken markup |
| Predict the result | JavaScript Fundamentals, operators | 14 coercion puzzles with explanations |
| Request waterfall | DevTools, Network | DNS, connect, TLS, TTFB, download; curl -w output |
| Semver ranges | Node.js, npm | which versions ^, ~ and comparators allow |
| TTL and traceroute | Reachability, Latency and Path | why each hop answers |
| Take a packet apart | Packet Capture | hex dump of a TCP SYN and a DNS query, field by field |
| TCP flags byte | Reference, Wireshark Cheat Sheet | click flag bits; the hex value, the tcp.flags filter and what the combination means |
| Avalanche effect | Hashing and MACs, hashes | one changed character flips about half the SHA-256 bits |
| How long to guess it? | Hashing and MACs, passwords | entropy vs fast and slow hashes |
| Decode, forge, verify a JWT | APIs | the payload is readable; editing it breaks the signature |
The VPNs and Tunnels chapter (Networking, after Remote Access with SSH) and the Nmap chapter (Projects, after Wireshark) each carry five interactive diagrams, drawn as theme-aware SVG and HTML in src/ws-9-vpn.js
and src/ws-9-nmap.js. Message sequences share one step-through component, src/ws-9-seq.js.
| Diagram | Where you find it | What it shows |
|---|---|---|
| Who can see what | VPNs, what a VPN is for | no VPN, full tunnel, split tunnel and site-to-site: what is on each link, and what the café, the ISP, the VPN operator and the site can learn; HTTPS vs HTTP; a DNS leak |
| Tunnel overhead and MTU | VPNs, overhead | WireGuard, IPsec ESP, OpenVPN and GRE headers drawn to scale; the tunnel MTU, TCP MSS and ping -D -s size; what happens when a packet is too big |
| Cryptokey routing | VPNs, WireGuard | edit AllowedIPs and see which peer a packet goes to, which source addresses are accepted, and what happens when two peers claim a range |
| Handshakes | VPNs, setting up a tunnel | WireGuard, IKEv2 and OpenVPN as step-through message sequences with the Wireshark filter for each |
| Which VPN fits? | VPNs, choosing | three questions rank eight protocols |
| Read an nmap command | Nmap, what nmap does | type a command: which of the eleven phases run, what each flag does, who must be root, probe count, scope check |
| Host discovery | Nmap, host discovery | ARP, ICMP and TCP probes by privilege and distance |
| One probe, one reply | Nmap, port states | 28 combinations of scan type and port condition, packet by packet, with the --packet-trace lines and the verdict |
| Exposure map | Nmap, reading a result | the lab's scan.txt as a host-by-port grid, with the risk and the fix for each open port |
| NSE categories | Nmap, scripting engine | 14 categories with real script counts, risk and examples |
wg show is simulated in the practice terminal, so the VPN chapter's parsing exercises can be tried without a tunnel.
The Cookies, Tracking and Privacy chapter (Web development, after the DOM; pointers from HTTP and TLS, DevTools and Defending Your Mac and Servers) carries nine interactive labs in src/ws-9-cookies.js and
src/ws-9-cookies-track.js. They share one rules engine, src/ws-9-cookies-engine.js (what a browser does with a Set-Cookie header and which requests carry a cookie back), which test/cookie_rules.py compares with a real Chromium.
| Lab | Where you find it | What it shows |
|---|---|---|
| The cookie dance | What a cookie is | three step-through exchanges: a first visit, a login, a third-party image seen on two sites |
| Set-Cookie workbench | Anatomy of a cookie | build a header; is it kept, and do seven kinds of request carry it back (same site, subdomain, plain http, image, link click, form POST) and can a script read it |
| Who baked this cookie? | Who uses cookies | a sorting game with 14 real cookie names: necessary, preferences, analytics or advertising, and who uses each |
| Delete it, edit it, steal it | A session cookie is a temporary password | a server-side session, a plain cookie and a signed cookie: log in, delete, tamper, replay in a stranger's browser |
| Three attacks, three attributes | the same section | HttpOnly, Secure and SameSite against script theft, a forged request and Wi-Fi snooping |
| From a random ID to a profile | What a website can learn | browse a made-up web; interests with confidence, an identity bridge by login, and what clearing cookies does not undo |
| The tracker's-eye view | Third-party cookies | one tracker on three sites under third-party cookies allowed, blocked (Safari) and partitioned (Firefox), with a hashed-email shortcut |
| Does deleting cookies end tracking? | Tracking without cookies | six tracking methods against six things you can do, with the reason for each of 36 cells |
| One browser in a crowd | the same section | a made-up population of 100,000 browsers narrowed by device, browser, screen, time zone, language, fonts and graphics; plus the details your own browser gives away |
A chapter in the Projects part, between Nmap and Defending Your Mac and Servers (chapters/ch_http_client.py, file 43p-2a-httpclient.gm, id httpclient). It uses the HTTP client pane of the iTERMiNAL terminal app as its tool, and teaches the ideas so that they carry to curl, Postman, Insomnia, DevTools, dig and openssl: each feature is set beside the command that does the same job, and the labs are models of the client's rules that run in the page. The facts about the app were first taken from an HTTP client brief and then checked against its Swift source (JUPiTER-JVCK/iTERMiNAL, version 4.2.0, commit 7e644b7); where the app and the chapter disagree, the app is right.
It covers, in order: what a client is for and who asks which question; the rules the client keeps (nothing happens by itself; plain http:// only to this Mac; no way to ignore a certificate error; what is written to history); Request (methods, headers, body, timeouts and size limits, errors, cURL in both directions, History); collections of .http files with environments, request chaining and secrets that can only go to their own hosts; the Connection tab (timing phases, the certificate chain, security headers read as notes); Extract (lists, CSS, XPath, JSONPath and regex queries, safe export, downloads, previews, a polite crawl, and Ask with the lid off); Explore (robots.txt and sitemaps, the map, the commands, why robots.txt is a request and not a lock); Lookup (address kinds, DNS record types, which IP-intelligence provider is told what, Check Certificate); three workflows (a slow API, a pre-launch review, a link you do not trust); a settings, keys and limits reference; nine exercises, a checkpoint and a project.
| Lab | Where you find it | What it shows |
|---|---|---|
| Would the client send that? | The rules the client keeps | one address judged two ways, as the client's own rules do it: typed in the address field (plain http:// only to a host written exactly localhost, 127.0.0.1 or ::1), and as a link in a fetched page that a download, preview or crawl is asked to follow (this Mac and its network are refused unless the page is local; a number written any way but four plain decimal parts is refused, not decoded). The cloud metadata address, 127.1, 0x08080808 and the stated DNS-rebinding gap are presets |
| Resolve a .http request | Collections, environments and secrets | eight cases: where each {{variable}} comes from (an earlier response, the environment with its $shared values, the file, a built-in such as $randomInt), a typo or an unsaved secret that stops the request, a secret that cannot go to another host, {{$processEnv}} refused |
| Security header notes | The Connection tab | paste a response's headers (or pick a case, including a plain-http dev server) and switch between https and plain http: HSTS, CSP, framing, nosniff, referrer, cross-origin policies and each cookie's flags (never its value) read as the client's own notes, with the same few warnings, not a grade |
| Map a site from what it publishes | Explore | a made-up shop with an editable robots.txt, an index of three sitemaps (one compressed) and a page that redirects off the site; the explorer's command line (open, ls -l, cd, tree, find, get, req, pwd, refresh, info) with the S, A, D and L source flags of each entry, and a switch for adding links from fetched pages; and a table of who may fetch what by RFC 9309 (the longest rule wins, Allow wins a tie, * and $, /robots.txt always open) |
| Who learns what? | Lookup | five IP-intelligence providers against a public and a private address: what you get, and whether the address leaves your Mac |
The rules the labs apply are in src/ws-9-httpclient-engine.js (window.__hc). test/httpclientviz.py checks them against independent work: a second implementation, written from the app's Swift source, of the address rules (isLocalHost, the plain-http list) and of how robots.txt is read for the map, run on over a thousand generated inputs; address meanings against Python's ipaddress and socket.inet_aton; 400 random robots.txt files against RFC 9309; the security-header notes and the explorer's output against what the source produces; and each lab by clicks and typing, in both themes and at phone width. A .http file contains {{double braces}} that the page would otherwise take for placeholders to fill in, so FILE(name, code, literal=True) (and attrs.literal in the engine) keeps them as they are, including in the Copy button.
Eleven chapters listed under one Security heading in the sidebar, in an order that builds: every chapter uses tools the earlier ones introduced. They fall into five groups (the first column below). The sidebar does not show the groups, but a chapter's section= argument would make it draw a sub-heading.
The chapter id crypto and the ids of every exercise and checkpoint that already existed are unchanged, so saved progress and links keep working. Wireshark, Nmap, the HTTP Client Workbench and Defending Your Mac and Servers are in the Projects part, and Ethical Hacking has its own part.
| Group | Chapter (id) | Covers |
|---|---|---|
| Cryptography | Cryptography Foundations (crypto) |
security goals; plaintext, ciphertext and clear text; Kerckhoffs's principle and how ciphers are attacked; key length, key space, block, digest and other sizes, security strength and NIST equivalences; entropy, TRNG/PRNG/CSPRNG and predictability (a Mersenne Twister clone, a cracked LCG, famous randomness failures); computational overhead, size, latency and longevity limits; levels of encryption; steganography, tokenization and masking |
Classical Ciphers (crypto-classical) |
substitution (Caesar, ROT13, affine, general), frequency analysis, Vigenère and the index of coincidence, transposition, the XOR cipher (single byte, repeating key, known plaintext), the one-time pad and the two-time pad, stream ciphers and malleability | |
Hashing and MACs (crypto-hashing) |
the three hash resistances and the birthday bound (found live), MD5/SHA-1 and length extension, uses of hashes, salt, pepper and key stretching (Argon2id, scrypt, bcrypt, PBKDF2), HMAC built by hand, constant-time comparison | |
| Encryption | Symmetric Encryption (crypto-symmetric) |
DES to AES to ChaCha20, block and stream ciphers, a Feistel network, AES round by round (a verified pure-Python AES-128), modes (ECB, CBC, CTR, GCM, XTS), padding oracles, AEAD, HKDF and envelope encryption, overhead, encrypting on a Mac |
Asymmetric Cryptography (crypto-asymmetric) |
trapdoor functions, RSA from scratch, why textbook RSA needs padding, Diffie-Hellman and its man in the middle, forward secrecy, elliptic curves on a toy curve and on secp256k1, hybrid encryption, post-quantum standards and sizes | |
| Trust and PKI | Digital Signatures (crypto-signatures) |
what a signature proves, RSA-PSS, ECDSA and Ed25519, the repeated-nonce attack that leaks the key, signatures on a Mac, algorithm confusion, why trusting the key is a separate question |
Digital Certificates and PKI (crypto-pki) |
trust models, X.509 field by field, roots, intermediates and trust stores, chain validation, certificate types, ACME and lifetimes, a private CA, CRL/OCSP/stapling, Certificate Transparency and CA failures, TPM/HSM/Secure Enclave, key lifecycle, escrow and Shamir sharing, the vault project | |
| Blockchain | Blockchain (blockchain) |
hash chains, Merkle trees and proofs, proof of work and consensus, keys, addresses and wallets, signed transactions, smart contracts, attacks, and when a blockchain is the right tool |
| Network Security | Network Security Fundamentals (netsec) |
defence in depth and the layer map, firewalls (stateless, stateful, NGFW, WAF), segmentation and DMZs, IDS/IPS, Wi-Fi security and 802.1X, zero trust, and a table of which control stops which attack |
TLS (tls) |
versions, the TLS 1.3 handshake, cipher suites, forward secrecy, resumption and 0-RTT, SNI/ECH/HSTS/mTLS, the attacks that shaped it, inspecting and configuring TLS | |
IPsec in Depth (ipsec) |
AH, ESP and IKE, transport and tunnel mode, the ESP packet and overhead, security associations, IKEv2 and key derivation, the anti-replay window, NAT-T, MTU, strongSwan, troubleshooting, safe settings |
The VPNs and Tunnels chapter stays in the Networking part (it compares IPsec with WireGuard and OpenVPN) and points at the IPsec chapter; Wireshark and Nmap (Projects) are the tools that show what these controls look like on the wire, and the chapters link to them.
Twenty labs sit inside the sections they teach, in src/ws-9-crypto-a.js, src/ws-9-crypto-b.js and src/ws-9-crypto-c.js (styles in src/crypto.add.css). Where a lab runs something (the cost benchmark, the ECB picture, sign and verify, and the entropy lab's random numbers) it uses your browser's real Web Crypto, so those numbers are measured, not drawn; the others compute in plain JavaScript. The last five (ws-9-crypto-c.js) are visual models whose arithmetic is checked against published values. Three older widgets in src/ws-2-crypto.js (the Cipher lab, Diffie-Hellman by hand and the TLS 1.3 handshake) sit in the same chapters and are not part of the twenty.
| Lab | Where you find it | What it shows |
|---|---|---|
| How long to try every key? | Foundations, key length | key space against guesses per second, from DES to AES-256, in units of the age of the universe |
| Entropy lab | Foundations, entropy | Shannon entropy against how a secret was generated; a weak generator predicted from three outputs, the OS generator not |
| What does it cost on your device? | Foundations, overhead | hashing, AES-GCM, PBKDF2, ECDH, ECDSA, Ed25519 and RSA-2048 timed on your machine |
| Cipher lab (Caesar tab) | Classical ciphers | crack a Caesar cipher by letter counts |
| Classical cipher workbench | Classical ciphers | solve a substitution by hand with letter counts; find a Vigenère key length with the index of coincidence; a rail fence |
| XOR lab | Classical ciphers | XOR at the bit level; two messages under one key, and the crib that reveals both |
| One AES round, byte by byte | Symmetric, AES | the 4 × 4 state through SubBytes, ShiftRows, MixColumns and AddRoundKey, for any of the ten rounds; the states are the FIPS 197 Appendix B values and round 10 ends on the published ciphertext |
| What does one changed block touch? | Symmetric, modes | ECB, CBC, CTR and GCM side by side: change a plaintext block and see which ciphertext blocks change, or damage a ciphertext block and see garbage, a flipped bit, or a refusal |
| ECB picture | Symmetric, modes | a 64 × 64 picture encrypted with real AES in ECB, CBC and CTR; the outline survives ECB |
| Cipher lab (AES-GCM tab) | Symmetric, AEAD | encrypt, flip one bit, watch decryption refuse |
| RSA lab | Asymmetric, RSA | a toy key, encryption, and the attacker factoring n with the time it would take at real sizes |
| Elliptic curves: adding points | Asymmetric, elliptic curves | the chord-and-tangent rule on the real curve, then the same curve modulo 17 with k·G hopping across the grid and a worked ECDH |
| Sign and verify | Signatures | Ed25519, ECDSA P-256 and RSA-PSS: key and signature sizes, timing, tampering, wrong key |
| Is this chain valid? | PKI, validation | eight scenarios (missing intermediate, expired, wrong name, self-signed, untrusted root, revoked, not a CA), step by step, with the curl and browser errors |
| Hash chain and proof of work | Blockchain | edit a block and watch the links break; mine to repair; difficulty against hashes |
| Merkle tree | Blockchain | edit a leaf, select one, see its inclusion proof |
| Can an attacker rewrite the last payment? | Blockchain, attacks | the probability that a minority of the hash power ever catches up, by confirmations (Nakamoto's formula, checked against the whitepaper's table) |
| Blast radius | Network Security Fundamentals, segmentation | pick a policy (flat, perimeter only, segmented, microsegmented) and a compromised host, and see which of eleven hosts it reaches, with and without lateral movement |
| Firewall rules | Network Security Fundamentals | first match wins; reorder rules; stateless against stateful |
| Decode a TLS cipher suite | TLS | key exchange, authentication, cipher, mode, hash, forward secrecy and a verdict |
| An ESP packet, to scale | IPsec | tunnel and transport mode, ciphers, padding, NAT-T and whether it fits the MTU |
| IKEv2 proposal negotiation | IPsec | which proposal is chosen, NO_PROPOSAL_CHOSEN, and weak algorithms refused |
Seven message sequences, which you step through with Next or by clicking a row, show the exchanges that are hard to hold in your head: password storage and login, Diffie-Hellman, the same exchange under a man in the middle, hybrid encryption, ACME certificate issuance, OCSP stapling and the IKEv2 exchange. Twelve diagrams in the book's text style (the data lifecycle, key sizes and entropy drawn to scale, a worked Vigenère, HMAC, a Feistel round, CBC and CTR data flow, envelope encryption, signature sizes, wallet key derivation, IDS and IPS placement, a TLS record) are checked for alignment by tools/lint_ascii.py.
The Python and JavaScript in the chapters is real and tested: a pure-Python AES-128 is checked against the FIPS 197 vectors, HKDF against RFC 5869, secp256k1 against the published coordinates of 2G, and the blockchain,
Merkle and ESP-size code against independent calculations. test/cryptoviz.py drives every lab, test/blocks.py runs every code block and exercise in a real browser, and tools/lint_ascii.py checks the diagrams.
Twelve chapters in their own Ethical Hacking part, between Security and Projects (chapters/ch_hack_*.py). Each chapter follows the same rhythm: how a protocol, tool or system is meant to work, what that design quietly trusts, how an attacker uses that trust in a small realistic scenario
with real tools against your own lab, and what the defender can see and do about it. Nearly every chapter cross-references an earlier one on purpose, because the same handful of ideas (an unauthenticated first answer, a scope checked by prefix instead of exactly, a privilege granted a little too
widely, a credential that outlives its usefulness) keep reappearing in new clothing.
| Chapter | Covers |
|---|---|
| 1. Rules, Law and Your Lab | authorisation, scope and proportion; the kill chain, MITRE ATT&CK and PTES; building an isolated lab (Docker, a hypervisor) and proving a vulnerable target is reachable only from it |
| 2. OSINT and Passive Reconnaissance | WHOIS/RDAP and ASNs, Certificate Transparency logs, search operators and internet-wide scanners, leaked secrets (patterns and entropy) and metadata in photos and documents |
| 3. DNS Through an Attacker's Eyes | what each record type gives away, zone transfers, subdomain enumeration and wildcard records, dangling records and subdomain takeover, DNS tunnelling, cache poisoning and DNSSEC, SPF/DKIM/DMARC |
| 4. Active Reconnaissance | turning a scan into a plan, banners as hypotheses, web enumeration layers (headers to rate-limited fuzzing), SMB/SNMP/SMTP/NFS/LDAP one-line questions, and a map of which door (host, network device, remote shell, or physical) leads to which later chapter |
| 5. Physical and Local Access | remote vs. physical vectors, unlocked sessions, USB mass storage and HID injection, what a firmware password and Secure Boot do and do not stop, and why only full-disk encryption protects data once someone controls the boot process |
| 6. User and Identity Security | which MFA factor resists which attack, account-recovery weaknesses measured the same way a leaked secret is, session fixation, phishing read from the inbox, and least privilege at the account level |
| 7. SSH, Attack, Pivot, Defend | host keys and trust on first use, brute force vs. password spraying read from logs, agent forwarding and SSH certificates, local/remote/dynamic port forwarding as a pivot, an sshd_config checklist |
| 8. Spoofing and Man-in-the-Middle | ARP spoofing read from a snapshot and a time series, MAC flooding and rogue DHCP, exactly what current TLS does and does not hide from an on-path attacker, UDP source-address forgery |
| 9. Web and API Attacks | SQL injection as text, not magic; a recap of XSS/CSRF from the attacker's side; IDOR/BOLA; SSRF validation and DNS rebinding; mass assignment and other API weaknesses |
| 10. Privilege Escalation | a read-only Linux enumeration checklist (sudo, SUID/SGID, capabilities, cron, PATH), GTFOBins, Windows equivalents, credential hunting and lateral movement on your own scope |
| 11. The Modern Attack Surface | cloud IAM audited like a SUID binary, container/Kubernetes misconfiguration, OAuth redirect-URI validation and consent phishing, supply-chain and CI/CD risk |
| 12. Defence and Reporting | a detection inventory mapped to ATT&CK, a severity rubric, writing a finding anyone can act on, and a capstone that runs the whole course once end to end |
docker/ethical-lab/ holds a Docker Compose lab for this course: an attacker toolbox (nmap, dig, hydra, sqlmap, tcpdump, tshark and more) and four deliberately vulnerable targets (Juice Shop, DVWA, a weak SSH server with privilege-escalation mistakes, and a lab.test DNS server that allows zone transfers) on an isolated 10.77.0.0/24 network with no route out. Web targets are published on 127.0.0.1 only. ./lab.sh up, ./lab.sh verify and ./lab.sh shell start it, prove it is isolated and open the attacker shell; see docker/ethical-lab/README.md. It is separate from the practice terminal in the page, which stays simulated and offline.
Each chapter opens with a line-art picture of its central idea (hkhero), and the processes it teaches are drawn and made playable where they are explained. Every picture takes the light and dark themes, scrolls sideways inside its frame on a phone, respects reduced motion and can be driven from the keyboard. They are models of the data the chapters give you: nothing sends a packet, forges a reply, guesses a credential or runs a query.
| Chapter | Pictures and models |
|---|---|
| 1. Rules and lab | the kill chain, ATT&CK and PTES as one clickable ladder (what the attacker does, what a defender can see, where the chain breaks); a scope list drawn over two /24 blocks with the /24-for-/26 mistake and "contains" against exact name matching; which network mode keeps a vulnerable VM isolated (the four questions of Lab 0); the whole course as a route with your own progress on each stop |
| 2. OSINT | eight public sources joined to the five kinds of fact they yield, with a defender's mirror; what a certificate writes into the public log (public, wildcard, private CA); an entropy meter with the known key formats; what one photograph gives away, and how each decimal place of GPS narrows it |
| 3. DNS | a record outliving its service in four states, from healthy to taken over to fixed; the lab's own sec/dns.txt as a scatter plot with thresholds you move to isolate the tunnel; the 32-bit lock on a DNS answer (source-port randomisation, DNSSEC, being on the path) with a time-to-forge gauge; SPF, DKIM and DMARC as three gates for four messages |
| 4. Enumeration | the identify-ask-record-decide loop filled in for six services; web enumeration from quiet to loud with the log each layer leaves; "which door is open?" as a map into the course |
| 5. Physical access | three routes to a laptop's data against firmware password, Secure Boot, full-disk encryption and an unlocked screen; the USB log as a timeline, with an alert threshold and an allow-list |
| 6. Identity | which MFA factor resists which attack (a matrix with a reason in every cell); a real-time phishing relay against a password, a code and a passkey; two doors into one account; session fixation with and without a new ID at login; an email to inspect, with a web address read from the right |
| 7. SSH | trust on first use in four situations, with known_hosts changing; brute force, spraying and stuffing as patterns against a lockout limit; the lab's own sec/auth.txt as one timeline in five phases; -L, -R, -D and -J as paths, and what AllowTcpForwarding no does to them |
| 8. Spoofing | ARP poisoning with both ARP caches changing step by step, and two defences; one packet as nested layers (what an on-path observer reads under HTTP, HTTPS, encrypted DNS, ECH and a VPN); a forged source address as an amplifier, and BCP 38 |
| 9. Web and API | a query tokenised to show where data became code (and why O'Brien breaks it); invoices and owners, and what each server check lets through; an SSRF validator against six URLs including DNS rebinding; mass assignment against a server that binds everything |
| 10. Privilege escalation | an attack-path graph for a Linux box: tick a finding as fixed and see which routes to root remain, and the smallest set of fixes that closes them all; the lab's SUID baseline diff |
| 11. Modern attack surface | the same graph for cloud IAM; one container and seven flags with a blast radius; the OAuth redirect handoff (a normal login, a prefix check, exact match, consent phishing); a build pipeline with five attack shapes and five controls |
| 12. Defence and reporting | ATT&CK tactics against the detections the course built, with a switch for whether a log stands behind each; the severity matrix with findings you can move; one finding written badly and well against the reader's four questions; the course route again, as the capstone |
hkdnslog, hkauthlog and hkbaseline read the practice terminal's own sec/dns.txt, sec/auth.txt and sec/suid*.txt from the book data, so the pictures and the files always agree. hkpath and hkiam are one engine (window.__hk.pathgraph) with two data sets. The step-through diagrams use the shared sequence widget (src/ws-9-seq.js), which gained an optional per-step state table for things like an ARP cache or known_hosts.
Every exercise is detection, validation or classification of given data (a saved log, a snapshot, a policy document, a device's settings); none sends a live attack, guesses a real credential, or gives working intrusion code. tools/add_hack_lab.py adds the course's made-up lab files under ~/lab/sec/
in the practice terminal (an SSH auth log, a DNS zone transfer, an ARP table and more, named so the older chapters' *.log globs are unaffected) and nine practice-terminal missions; test/hacklab.py checks them in a real browser.
Five chapters at the end of the Networking part (chapters/ch_wl_01_wifi.py to ch_wl_05_test.py, ids wifi, ble, lowpower, lora, wltest, sidebar section Wireless). They cover how each protocol finds and joins a network, authenticates, derives keys, protects and numbers its packets, and how to test it: Wi-Fi (WPA2, PMF, WPA3, 802.1X), Bluetooth Classic and BLE (advertising, pairing methods, LE Secure Connections, link-layer AES-CCM), Zigbee, Thread and Matter (802.15.4, MLE, PASE, attestation, CASE), LoRa and LoRaWAN (join, session keys, MIC, counters) and a testing chapter (method, hardware, link types, filters, hex and bit views, a Lua module, reporting). The course is defensive: it explains mechanisms and published weaknesses by class and gives no recipe for breaking into other people's networks.
The captures are in labs/wireless/: wifi-wpa2.pcap (13 packets, link type 127), ble-pairing.pcap (17, link type 256), zigbee-join.pcap (7, 195), thread-mle.pcap (3, 195), matter-pase.pcap (8, 1) and lorawan-join.pcap (8, 270). tools/wireless_caps.py writes them deterministically with real cryptography and printed lab keys (PBKDF2 and AES-CCM for Wi-Fi, AES-CCM for BLE, Zigbee, Thread and Matter, AES-CMAC and AES for LoRaWAN), so every MIC verifies and a tool that knows the key can decrypt. The page's capture workbench draws each packet from manifest.json: a layer and field tree, hex and bit views (with the Wireshark field name for each field), and questions about the capture. The same file downloads as a classic .pcap for Wireshark and any hex viewer.
Checks (python3 test/wireless.py, needs tshark and cryptography): the generator reproduces the committed files; every mapped field (746) is found by tshark -T pdml at the same offset and length; Wi-Fi, Zigbee, Thread and LoRaWAN decrypt in tshark with the lab keys, and no packet is malformed; the crypto reproduces published samples (the Bluetooth c1 and session-key samples, the RFC 4493 AES-CMAC vectors, scapy's BLE CRC when it is installed); every display filter the testing chapter lists matches the packets it names; the Lua module flags exactly the replayed packets; every Python exercise's solution passes its check; and every $ command transcript in the five chapters is re-run against the real files and compared. test/blocks.py wifi ble lowpower lora wltest runs the exercises in the page.
What the captures are not. They are made up for teaching. Known limits, also stated in the chapters: the Matter PASE values (messages 3 to 5) are random placeholders, not a SPAKE2+ exchange, and its two session keys are made up (Wireshark 4.2 reads the Matter headers but cannot decrypt); the Matter TLV bodies are plausible, written by hand and not checked against a real device; Wireshark 4.2 does not decrypt BLE link-layer packets, so the BLE chapter decrypts with a script (the nonce and header mask follow the specification and the published session-key sample, and are checked by that script only); Thread's MAC-layer security is left off so the MLE layer stands alone; there is no WPA3 (SAE) or 802.1X capture, and those sections are explanation only; the LoRaWAN session-key derivation follows the 1.0.x specification as the generator and checker both implement it and tshark verifies the MICs and decryption with the session keys, but tshark was not used to derive them from the AppKey.
Diagrams drawn on the same monospace grid, each placed in the section it illustrates (tools/add_figures.py; the APIs one is in
chapters/ch_2_apis.py):
| Figure | Where you find it |
|---|---|
| What runs on what: application protocols over TLS, QUIC, TCP, UDP and IP | How Networks Work, layers |
| One Ethernet frame on the wire, field by field, with the MTU marked | How Networks Work, encapsulation |
| Wi-Fi bands: 2.4 GHz channel overlap to scale; 5 and 6 GHz U-NII blocks | How Networks Work, Wi-Fi |
| A global IPv6 address split 48/16/64, and the IPv6 address family tree | Addressing, IPv6 |
Reading ls -l, rwx to octal, and where setuid, setgid and sticky show |
Files, permissions |
| The BPF capture-filter language on one screen | Packet Capture, BPF |
| The troubleshooting loop: gather, choose a layer, isolate, fix and verify, write down | Troubleshooting, method |
| Which observability tool sees which part of the machine (macOS, with Linux names) | System, looking at processes |
| The most used commands as a map | Cheat Sheets |
| REST, GraphQL, gRPC, WebSocket, SSE and webhooks as message sequences | APIs, kinds of web API |
![]() |
![]() |
apple/ holds a native SwiftUI app with the same book. It has a native sidebar with progress per chapter,
native search over chapters, sections and all command cards, back/forward, a section menu, an appearance
setting and text size (⌘+ / ⌘− / ⌘0 on the Mac, or the Appearance menu in the toolbar). The pages show in a web view, so in-page Python, JavaScript playgrounds, labs and the practice terminal
all work offline. Progress is saved by the app (Application Support), not by the browser.
Ready-built Mac app: every CI run uploads CODEX_LMS-mac (a zip with a universal CODEX_LMS.app). Open the
run under the repository's Actions tab, download it from Artifacts, unzip, and move the app to Applications. It is
not notarized, so the first time you open it macOS blocks it: open System Settings → Privacy & Security and click
Open Anyway (or run xattr -dr com.apple.quarantine /Applications/CODEX_LMS.app).
Build it yourself (also the way to run it on an iPhone or iPad). Needs Xcode 16 or later and XcodeGen:
python3 tools/chapters.py && python3 tools/build.py # the app bundles dist/
brew install xcodegen
cd apple && xcodegen && open CODEX_LMS.xcodeproj
Pick the CODEX_LMS scheme and run on My Mac, an iPad or an iPhone. swift test --package-path apple runs the
tests for CodexCore (table of contents, saved progress, search) on macOS or Linux.
| Path | What it is |
|---|---|
data/book.json |
chapters 00-37, 44-46, 90 and 91 (Welcome to Node.js, the two capstones, Where to Go From Here, the Cheat Sheets and Fixes) as parsed JSON, plus the practice terminal's lab files and missions |
chapters/ch_*.py |
the 49 chapters that are not in data/book.json, written with the helpers in chapters/lib.py: Web APIs, Server Basics, Cloud, Wireshark, Defending and the Cisco IOS sheet (ch_2_apis.py, ch_1_servers.py, ch_4_cloud.py, ch_5_wireshark.py, ch_6_defend.py, ch_7_cisco.py), plus the families named in the rows below (ch_code_*, ch_sec_*, ch_hack_*, ch_wl_*, VPN, Nmap, cookies, HTTP client, the Wireshark Cheat Sheet) |
chapters/ch_code_*.py, chapters/codetrace.py |
the ten Learn to Code chapters (11.01-code-hello.gm to 11.10-code-capstone.gm) and the recorder that traces their Python at build time |
src/ws-code-a-core.js, ws-code-b-step.js, ws-code-c-try.js, ws-code-d-grid.js, src/code.add.css |
the Learn to Code widgets (shared language switch and value drawing, codestep, codetry, bitgrid) and their styles |
test/code_pairs.py, test/codeviz.py |
every JavaScript example against its Python twin under node, and every Bit mission, stepper and editor in a real browser |
chapters/ch_sec_01..11_*.py |
the eleven Security chapters (41.01-foundations.gm to 42.03-ipsec.gm, in the groups Cryptography, Encryption, Trust and PKI, Blockchain and Network Security) |
src/ws-9-crypto-a.js, src/ws-9-crypto-b.js, src/ws-9-crypto-c.js, src/crypto.add.css |
the Security labs, visual models and message sequences, and their styles |
test/cryptoviz.py |
every Security lab driven by clicks, in both themes and at phone width |
data/outcache.json |
real outputs of the runnable blocks in chapters/*.py (test/blocks.py --update refreshes them) |
src/engine.js |
page engine: rendering, navigation, search, progress, runners, earlier widgets |
src/ws-1..4-*.js, src/srv.add.css |
the first widget set: ws-1-api.js (Web APIs), ws-2-crypto.js (Cipher lab, Diffie-Hellman, TLS 1.3 handshake, used in the Security part), ws-3-server.js and ws-4-cloud.js (Servers & Cloud) |
src/ws-5-pcap.js, ws-6-pcapcols.js, ws-7-pktlab.js, ws-8-triage.js, src/sec.add.css |
the Wireshark packet lab and the log-triage drill for the Wireshark and Defending chapters; ws-5-pcap.js is the packet engine (encoder, dissector, display-filter engine) |
src/ws-labs.js, src/labs.add.css |
the 19 newer labs (generated from packages/labs) and their styles |
chapters/ch_8_vpn.py, chapters/ch_8_nmap.py |
the VPNs and Tunnels chapter (18a-vpn.gm, Networking) and the Nmap chapter (43p-2-nmap.gm, Projects) |
src/ws-9-vpn.js, src/ws-9-nmap.js, src/ws-9-seq.js, src/vpn.add.css, src/nmap.add.css, src/seq.add.css |
their diagrams and labs; ws-9-seq.js is the shared step-through sequence diagram |
chapters/ch_9_cookies.py |
the Cookies, Tracking and Privacy chapter (35a-cookies.gm, Web development) |
chapters/ch_http_client.py |
the HTTP Client Workbench chapter (43p-2a-httpclient.gm, Projects) |
src/ws-9-httpclient-engine.js, src/ws-9-httpclient.js, src/httpclient.add.css |
its rules (address kinds, .http variables, security-header notes, robots.txt, the site explorer), the five labs, and their styles |
test/httpclientviz.py |
the rules against independent calculations, and every lab driven by clicks, in both themes and at phone width |
src/ws-9-cookies-engine.js, src/ws-9-cookies.js, src/ws-9-cookies-track.js, src/cookies.add.css |
its rules engine (cookie parsing, which requests carry a cookie) and the nine labs |
chapters/ch_wl_01..05_*.py, chapters/wl.py |
the five Wireless chapters (19a-wifi.gm to 19e-wltest.gm, part net, section Wireless) and the helpers that quote exact bytes from a capture, so the text cannot drift from the file |
tools/wireless_caps.py, labs/wireless/ |
the generator for the six lab captures (deterministic, real cryptography with lab keys) and its output: the .pcap files, manifest.json (the field map the page draws) and the scripts and Lua module the chapters print (ble_check.py, mesh_check.py, lora_check.py, replay_lab.lua) |
src/ws-9-wcap.js, src/wireless.add.css |
the capture workbench widget: packet list, layer and field tree, hex and bit views, a Download .pcap button and questions about the capture |
test/wireless.py |
the lab captures against a real tshark (see below) |
chapters/ch_hack_*.py |
the twelve-chapter Ethical Hacking course (43h-01..12-*.gm, part hack) |
tools/add_hack_lab.py |
adds the course's made-up lab files under ~/lab/sec/ and its practice-terminal missions to data/book.json (idempotent; also removes anything an earlier version wrote that the course no longer carries) |
test/hacklab.py |
runs every Ethical Hacking mission in the real page's simulated shell, and checks the lab did not disturb the older chapters' *.log globs |
src/ws-9-hack-a-core.js, src/ws-9-hack-b-hero.js |
the shared kit for the course's pictures (window.__hk: frame, chips, an SVG node/link/icon set, entropy and CIDR maths) and the twelve chapter pictures |
src/ws-9-hack-c-*.js to src/ws-9-hack-h-*.js, src/hack.add.css |
the 42 interactive models, two chapters' worth per file, and their styles |
test/hackviz.py |
drives every Ethical Hacking picture and model in its own chapter and checks its answers against independent maths, both themes, a phone-width overflow check and the console |
chapters/ch_7_wsref.py, src/ws-9-wsref.js, src/wsref.add.css |
the Wireshark Cheat Sheet in the Reference part and its pictures (window, filter pipeline, layers, TCP conversation, flags byte), drawn as theme-aware SVG |
chapters/ch_7_cisco.py, src/ws-9-cisco.js, src/cisco.add.css |
the Cisco IOS Cheat Sheet in the Reference part (90-cisco.gm): 69 IOS command cards, the CLI mode ladder and the DHCP & DNS lab infographic |
tools/pcapgen.js, tools/pcapcols.py |
write the lab captures as real .pcap files, and bake Wireshark's own column text into src/ws-6-pcapcols.js |
src/sim.js, src/sbsrc.js |
simulated zsh, and the sandbox injected into every JavaScript playground |
src/style.css, src/head.html |
design tokens, layout and page head |
src/fonts/ |
Inter and JetBrains Mono (variable, Latin subset), inlined into the stylesheet by tools/build.py; SIL OFL 1.1 licences alongside |
packages/widgets/ |
the logic behind the newer labs, as pure TypeScript with unit tests |
packages/labs/ |
the DOM views for those labs; npm run labs bundles them into src/ws-labs.js |
tools/chapters.py, tools/build.py |
build chapter JSON, then assemble the single-file page |
tools/add_labs.py |
places each lab block inside its chapter in data/book.json (idempotent) |
tools/add_xrefs.py |
places the short "see also" callouts in the older chapters of data/book.json that lead to newer ones: cookies, TLS, SSH keys, the HTTP Client Workbench and names and addresses (HTTP, DNS, DevTools and SSH), and the Learn to Code pointers (Welcome, Scripting, Python, JavaScript); idempotent. Chapters written in chapters/*.py carry their pointers in the source |
tools/add_figures.py |
places the reference figures (ASCII diagrams with a lead-in) inside their chapters, the same way |
tools/lint_ascii.py, tools/fix_ascii.py |
find, and safely re-align, drifting box diagrams |
test/blocks.py, test/labs.py, test/ascii.py, test/theme.py, test/offline.py, test/bundle.py |
browser tests: runnable blocks and exercises, every lab, diagram rendering, theme switch, no request leaves the page, the single file as a page and under node |
test/netviz.py, test/netfilters.py |
the VPN and nmap diagrams (clicks, arithmetic, themes, phone width), and every filter and NSE script the two chapters name checked against real tshark, libpcap and nmap |
test/cookie_rules.py, test/cookieviz.py |
the cookie rules engine against a real Chromium (what is stored, what is sent, what scripts can read), and every cookie lab driven by clicks, in both themes and at phone width |
test/pcapfilters.py |
checks the Wireshark lab's display-filter engine against real tshark on the same captures |
test/wsref_filters.py |
compiles every filter on the Wireshark cheat sheet with real tshark and libpcap, and checks that the filters it calls wrong are really rejected |
test/luadissector.py |
takes the Lua dissector section of the Wireshark chapter apart: writes its files, replays every tshark transcript in it against a real tshark (as a normal user, since Wireshark does not run Lua as root) and checks the exercise solution |
dist/ |
the built site: index.html, toc.json (contents for the Apple app) and the Python runtime in py/ |
src/app.add.css |
hides the page's own sidebar and toolbar when it runs inside the Apple app |
apple/project.yml |
XcodeGen spec for the multiplatform app |
apple/Sources/CodexCore/ |
Swift models for toc.json and saved progress, and search; tests in apple/Tests/ |
apple/App/ |
SwiftUI app: sidebar, search, web view, codex:// scheme handler and the page bridge |
apps/tui/ |
the terminal app (TypeScript: src/ is the program, test/ has the unit, headless and pseudo-terminal tests); npm run tui:build bundles it into apps/tui/dist/codex-tui.mjs |
tools/bundle.py, tools/bundle/, tools/package/ |
the single file CODEX_LMS.html (page, terminal app, Mac app and Python runtime in one) with its Node launcher, and the files for the all-in-one download |
.github/workflows/ci.yml, release-mac.yml |
CI runs every check under Build and test, the terminal app, the Apple app and the single file; the release workflow attaches the downloads to a GitHub Release |
A release carries CODEX_LMS-all.zip: unzip it and double-click Start CODEX_LMS.command, which asks whether to open the Mac app, the web browser or the terminal version. The same release has the pieces on their own: CODEX_LMS.html (browser or node CODEX_LMS.html), CODEX_LMS-mac.zip, codex-tui.mjs, and SHA256SUMS.txt. The first launch of anything downloaded needs right-click > Open (it is not notarized).
node apps/tui/dist/codex-tui.mjs (after npm run tui:build) or npm run tui. It reads the book from dist/index.html, shares your progress with the Mac app, supports mouse and keyboard, and has terminal versions of nineteen labs inside the sections that teach them (bit switches, logic gates, bit mask, text to bytes, cron, latency ladder, subnet, PATH lookup, semver, password cracking, avalanche, TTL trace, request waterfall, signals, JS coercion quiz, algorithm racer, ssh config, JWT, packet dissector). The remaining interactive widgets (the simulated practice terminal, playgrounds, diagram widgets) show a card pointing to the page or the Mac app. ? shows the keys.
It adapts to the window: from 100 columns the contents list docks beside the page and grows with the window; narrower than that it is a drawer (b) over a dimmed page that takes the keyboard until you choose something or press esc. Dialogs (search, help, prompts) sit on the same dimmed layer, so nothing behind them can be clicked or scrolled by accident, and help scrolls when the window is short. Prose lines stop at 80 columns however wide the window is (code, tables and diagrams keep the full width), the footer drops its least important hints first and always keeps ? help and q quit, and below 30×10 the app asks for a bigger window instead of drawing a broken page. With NO_COLOR the cursor, the dimmed layer and the selection still show, through attributes. The window title is restored on exit.
python3 tools/bundle.py --app CODEX_LMS-mac.zip (CI does this and uploads CODEX_LMS-single-file) writes CODEX_LMS.html, one file for whichever device you have:
| Where | How | What you get |
|---|---|---|
| Any browser | open the file | the book, offline, with Python exercises working even from file:// |
| Terminal with Node 18+ | node CODEX_LMS.html |
the terminal app (--theme, --no-mouse, --list, ...) |
| Mac | node CODEX_LMS.html --app, or "Other ways to open this" in the page |
installs and opens the Mac app |
Also --html (serve the page and open a browser), --extract DIR and --help. The file is an HTML comment that is also a JavaScript comment (the Node launcher), so a browser ignores it and Node ignores the page. If Node reports ERR_UNKNOWN_FILE_EXTENSION (the folder's package.json says "type": "module"), run node -e "require('./CODEX_LMS.html')" -- --tui. About 10 MB without the Mac app; --no-python makes it smaller.
Needs Python 3 and Playwright, pinned to the version CI uses (python3 -m pip install playwright==1.63.0 && python3 -m playwright install chromium),
and Node 20.19+ for the labs.
python3 tools/add_labs.py --check # the four placement scripts: "nothing to do" means data/book.json is current
python3 tools/add_figures.py --check
python3 tools/add_xrefs.py --check
python3 tools/add_hack_lab.py --check
python3 tools/chapters.py # chapters/*.py -> data/new/*.json
python3 tools/build.py # -> dist/index.html, dist/toc.json (and pub.html for the Claude artifact host)
git diff --exit-code -- dist/index.html dist/toc.json # dist/ is committed: rebuild it with every change to a chapter or the engine
python3 test/code_pairs.py # every JavaScript example prints what its Python twin printed (needs node)
python3 tools/lint_ascii.py --quiet # box borders that do not line up
(cd dist && python3 -m http.server 8765 &)
python3 test/blocks.py servers apis crypto crypto-classical crypto-hashing crypto-symmetric crypto-asymmetric crypto-signatures crypto-pki blockchain \
netsec tls ipsec cloud wireshark defend wireshark-ref vpn nmap cookies httpclient \
code-hello code-vars code-decide code-loops code-funcs code-lists code-dicts code-debug code-objects code-capstone \
hack-rules hack-osint hack-dns hack-enum hack-physical hack-identity hack-ssh hack-spoof hack-web hack-priv hack-modern hack-blue
python3 test/labs.py # every lab: placement, interaction, no console errors
python3 test/hacklab.py # the Ethical Hacking course's lab files and practice-terminal missions
python3 test/netviz.py # the VPN and nmap diagrams
python3 test/hackviz.py # the Ethical Hacking course's pictures and models
python3 test/cookieviz.py # the cookie labs
python3 test/httpclientviz.py # the HTTP Client Workbench labs, and the rules behind them
python3 test/cryptoviz.py # the Security part's cryptography, PKI, blockchain and network-security labs
python3 test/codeviz.py # Learn to Code: every Bit mission in both languages, the steppers and editors, phone width
python3 test/ascii.py # diagrams and command output on a monospace grid (--hinting mimics a Linux CI renderer)
python3 test/theme.py # System / Light / Dark button, persistence, live OS changes
python3 test/offline.py # the page makes no request outside itself; the bundled fonts load
python3 test/bundle.py FILE # the single file: as a page, with Python, and under node (CI runs it on the assembled CODEX_LMS.html)
python3 test/pcapfilters.py # needs node and tshark (apt install tshark, or brew install wireshark)
python3 test/wsref_filters.py # needs tshark; every filter on the Wireshark Cheat Sheet compiles, and the wrong ones are rejected
python3 test/netfilters.py # needs tshark and nmap (apt install tshark nmap)
python3 test/cookie_rules.py # needs openssl and a Chromium; compares the cookie rules engine with the real browser
python3 test/wireless.py # needs tshark and `pip install cryptography`; the six lab captures, the chapters' transcripts, filters, exercises and the Lua module
python3 test/luadissector.py # needs tshark with Lua; the Wireshark chapter's dissector code and transcripts (not run by CI)
npm install
npm test # unit tests: the lab logic (packages/widgets) and the terminal app (apps/tui)
npx tsc --noEmit -p packages/labs # type-check the lab views
npm run labs # rebuild src/ws-labs.js after editing packages/labs or packages/widgets
npx tsc --noEmit -p apps/tui # type-check the terminal app
npm run tui:build # apps/tui/dist/codex-tui.mjs
python3 -m pip install pyte && python3 apps/tui/test/e2e_pty.py # the terminal app in a pseudo-terminal; add apps/tui/dist/codex-tui.mjs to test the bundle
swift test --package-path apple # macOS or Linux: the CodexCore tests of the Apple app
Add --update to test/blocks.py after changing code in a chapter to record its new real output. After changing a
capture scenario in src/ws-5-pcap.js, run python3 tools/pcapcols.py (needs tshark) to refresh the column text,
then test/pcapfilters.py.
test/blocks.py on the full book reports 21 known mismatches in blocks that deliberately raise errors; they are identical on
the version before the redesign and are not part of the CI set.
- Put the logic in
packages/widgets/src/<name>.tswith tests inpackages/widgets/test/. - Write the view in
packages/labs/src/<name>.ts(register("name", ...)) and import it frompackages/labs/src/index.ts. - Add an entry to
LABSintools/add_labs.pynaming the chapter and the text it should follow, then run it. npm run labs,python3 tools/build.py, and add a case totest/labs.py.
An earlier round built a React + Tauri desktop app and an Ink terminal app on the same widget logic. They were removed from the
tree when the focus moved to the classic site and remain in the repository history (commit bf04bb1). packages/widgets is kept,
including the terminal-only renderers (ascii.ts, subnet.ts), so a terminal or desktop version can reuse the same logic.
MIT, see LICENSE. The bundled Pyodide runtime in dist/py/ keeps its own license (MPL-2.0), and the bundled fonts in
src/fonts/ keep theirs (SIL Open Font License 1.1, copies next to the files).



