Leanpub Header

Skip to main content

Adversarial Offensive Programming for Red Teams FULL

Nine languages. Nine engagements. Nine fictional companies to compromise.

You won’t read about penetration testing — you’ll do it. Each book in the Adversarial series drops you into a scoped engagement with rules of engagement, a target network, and one programming language. You’ll write every exploit by hand, build a custom toolkit from zero, capture CTF flags hidden across the infrastructure, and deliver a professional report when it’s over. Python to Assembly. Web apps to bare metal. Script kiddie to tool author.

This is the red team curriculum that courses don’t teach — 117 chapters of building, breaking, and reporting, with nothing abstracted away.

Bought separately

$134.91

Minimum price

$32.99

$49.99

You pay

Author earns

$

Also available for 2 book credits with a Reader Membership

These books have a total suggested price of $134.91. Get them now for only $32.99!
About

About

About the Bundle

Adversarial Offensive Programming for Red Teams is the complete nine-book collection for penetration testers, red teamers, and CTF competitors who want to build real offensive tooling from scratch — not just run someone else’s scripts. Each book drops you into a fresh engagement against a fictional company, hands you a language, and walks you through the entire kill chain: reconnaissance, exploitation, post-exploitation, lateral movement, persistence, and a professional deliverable report at the end. Every chapter produces working code, captures CTF flags, and logs formal findings with CVSS scores. By the time you finish the series, you’ll have built 90+ custom tools across 9 languages, captured 200+ flags, documented 400+ vulnerabilities, and written 9 complete pentest reports — a portfolio that proves you can do the work, not just talk about it.

Book I — Adversarial Python · Build scanners, exploit frameworks, and C2 infrastructure in Python against Nexus Defense Systems. Book II — Adversarial Rust · Write memory-safe implants, cryptographic tools, and evasion frameworks in Rust against Blackthorn Industries. Book III — Adversarial Bash · Chain shell primitives into recon pipelines, exploit scripts, and persistence mechanisms against Ridgepoint Research. Book IV — Adversarial PowerShell · Own an Active Directory enterprise end to end — Kerberoasting, lateral movement, and AMSI bypass against Stratton Systems. Book V — Adversarial JavaScript · Attack full-stack Node.js applications — XSS, SSRF, prototype pollution, and container escapes against Pinnacle Retail. Book VI — Adversarial Go · Exploit microservices, IoT/OT protocols, and cloud-native infrastructure in Go against Meridian Controls. Book VII — Adversarial SQL · Chain SQL injection across PostgreSQL, MSSQL, and MySQL into OS shells, lateral pivots, and DNS exfiltration against Lumen Dataworks. Book VIII — Adversarial Nim · Craft stealthy loaders, shellcode runners, and EDR-evading implants in Nim against Sentinel Dynamics. Book IX — Adversarial Assembly · Write shellcode by hand, smash stacks, build ROP chains, exploit the heap, escalate to Ring 0, and plant bootkits in x86-64 NASM against Vectron Systems.

Books

About the Books

Adversarial Python

Adversarial Python

An advanced, hands-on pentest you run against your own lab — in Python.

## About This Book

Every chapter of this book advances a single, continuous engagement against one fictional target that lives entirely in your homelab: **Helix Dynamics**, a small AI-native fintech. One target carries every phase of the pentest — external edge, a web app and JSON API, a Postgres backend, an Active Directory estate, and an internal LLM assistant that eventually becomes a target in its own right.

You don't just run tools against Helix. You **build** the tools, in Python, one phase at a time: your own range orchestrator, your own scanner, your own crawler, your own exploits, your own post-exploitation tasking, and finally your own report generator. Each phase ends with a captured flag — `HELIX{...}` — and those flags become the evidence trail for the deliverable you assemble in the final chapter.

Nothing in this book touches a system you do not own. The entire range is yours: stood up locally with one command, attacked, and torn down when you are done.

## Who This Book Is For

You already write Python and you have seen a pentest before. This book pushes past tutorial territory into the idioms that make offensive tooling fast and maintainable: `asyncio` for concurrency, `dataclasses` and type hints for structured results, `httpx`, `impacket`, subprocess orchestration, and clean packaging. If you have never written Python, start elsewhere and come back. If you want to understand what your tools actually do — and build better ones — you are in the right place.

## Conventions

**Flags.** Each chapter plants at least one flag in the range, in the format `HELIX{...}`. You capture it by running the tool you just built, not by reading it out of a config file. Flags are cumulative; keep them.

**The chapter rhythm.** Every chapter follows the same beat:

| Beat | What it is |

| --- | --- |

| Briefing | The story moves one step forward in the engagement |

| Objective | The concrete goal and the flag to capture |

| Concepts | The Python ideas the chapter introduces |

| Build | Complete, working tooling you type and run |

| Capture | Running your tool against the range to take the flag |

| Debrief | The blue-team view: what this looks like to a defender |

Some chapters add an **AI Corner** — an optional sidebar that uses or attacks an LLM. It is never required to finish a chapter.

**Lab safety.** The range is self-contained and offline-capable. Treat every technique here as lab-only. The same code pointed at infrastructure you are not authorized to test is a crime; authorization is the only thing separating this book from one.

## Roadmap

| Ch | Phase | What you build in Python |

| --- | --- | --- |

| 0 | Rules of engagement | Workstation preflight check |

| 1 | Range build & inventory | `range_control.py` — orchestrator + asset inventory |

| 2 | Passive recon / OSINT | Async DNS, cert-transparency, and a dossier builder |

| 3 | Active recon & scanning | Your own async port scanner + service fingerprinter |

| 4 | Web attack surface | Crawler, content discovery, and parameter miner |

| 5 | Vulnerability discovery | A focused scanner (SQLi / SSRF / IDOR) with triage |

| 6 | Exploitation — the web foothold | Working PoCs; your first shell on Helix |

| 7 | Exploiting the AI layer | Prompt-injection fuzzer; RAG and agent abuse |

| 8 | Post-exploitation | Python reverse shells, tasking, living-off-the-land |

| 9 | Privilege escalation | Linux privesc enumeration, SUID abuse, Docker escape |

| 10 | Active Directory & lateral movement | `impacket`: Kerberoasting, AS-REP, pass-the-hash |

| 11 | Actions on objectives | Data hunting and a covert exfil channel |

| 12 | Reporting | Parse every flag + finding into a scored deliverable |

Adversarial Rust

Adversarial Rust

Build Your Own Pentest Arsenal — In Rust

Most offensive-security books hand you a framework and a flag. This one hands you `cargo new` and a target.

**Apex Foundry** is a precision-manufacturing company that builds industrial control interfaces, runs a customer-facing web application backed by Postgres, operates an Active Directory domain for its corporate workforce, and recently bolted an AI assistant onto its support portal. It also happens to be running entirely inside your homelab — Docker containers, a virtual AD forest, and a vulnerable web stack you control end to end.

Your job is to break it. Your constraint is that every tool you use must be one you wrote yourself, in Rust.

Over thirteen chapters you will work through a single, continuous penetration test — from passive reconnaissance through data exfiltration and final reporting. Each chapter adds a link to the attack chain: you will build async port scanners, web crawlers, exploit frameworks, a prompt-injection fuzzer, an encrypted implant, Kerberoasting tooling, a covert DNS exfiltration channel, and a report generator that pulls every finding into a finished deliverable. Every tool compiles to a single, dependency-free binary you can drop on a target without a runtime.

Along the way you will capture **twenty flags** (format: `APEX{...}`) and document **twenty-two findings**, building a portfolio that doubles as a real-world pentest report.

### Why Rust?

Python dominates offensive tooling for good reason — it is fast to write, easy to read, and ubiquitous on target machines. But Rust offers something Python cannot:

- **No runtime dependency.** A Rust binary is a single static executable. No interpreter to install, no virtualenv to configure, no `pip install` on a compromised host.

- **Memory safety without garbage collection.** Implants that manage their own memory without a GC pause are harder to fingerprint and more reliable under constrained resources.

- **Performance.** An async port scanner built on Tokio saturates a gigabit link. A fuzzer built on Rust's zero-cost abstractions runs at native speed.

- **Cross-compilation.** `cargo build --target x86_64-unknown-linux-musl` produces a fully static Linux binary from macOS or Windows. `cargo build --target x86_64-pc-windows-gnu` produces a Windows `.exe` from Linux.

- **Growing real-world adoption.** Red teams and malware authors alike are moving to Rust. Understanding Rust-based tooling is no longer optional for defenders — and building it is the fastest way to understand it.

This book does not replace your Python toolkit. It extends it with a language that excels where Python struggles: on-target execution, raw performance, and operational security.

## Who This Book Is For

You should be comfortable with:

- **Rust fundamentals.** You know `struct`, `enum`, `impl`, `trait`, ownership, borrowing, and lifetimes. You have written at least a few programs with `cargo`. This book will not teach the language — it will teach you what to build with it.

- **Networking basics.** TCP/IP, DNS, HTTP, and TLS at a conceptual level. You know what a SYN packet is and what a `301` means.

- **Linux command-line work.** Shell navigation, process management, file permissions. You will live in a terminal.

- **Docker.** You can pull images, run containers, and read a `docker-compose.yml`. The entire lab runs in containers.

Prior penetration-testing experience helps but is not required. Each chapter explains the *why* before the *how*.

## Conventions Used in This Book

Each chapter follows a consistent structure:

| Section | Purpose |

| --- | --- |

| **Briefing** | Sets the operational context — where you are in the engagement and what intelligence you have so far. |

| **Objective** | States the chapter's concrete goal: what you will build and what flag(s) you will capture. |

| **Concepts** | Explains the underlying vulnerability class, protocol, or technique before you write a line of code. |

| **Build** | Walks through the tool's design and implementation in Rust, crate by crate, function by function. |

| **Capture** | Runs the finished tool against the lab range and captures one or more flags. |

| **Debrief** | Reviews what the tool revealed, documents findings, and previews the next chapter's attack vector. |

Code blocks use Markua's language-annotated fences:

{lang="rust"}

```

fn main() {

println!("You are reading a Rust code block.");

}

```

Shell commands appear as:

{lang="bash"}

```

cargo build --release --target x86_64-unknown-linux-musl

```

Flags appear inline when captured and follow the format `APEX{lower_case_l33t}`.

## Engagement Roadmap

| Ch. | Title | Tool Built | Flags |

| --- | --- | --- | --- |

| 0 | Rules of Engagement | Workstation preflight checker | 1 |

| 1 | Building the Range | Range orchestrator (`apex-range`) | 1 |

| 2 | Passive Reconnaissance | DNS enumerator and OSINT dossier builder | 1 |

| 3 | Active Reconnaissance & Scanning | Async TCP scanner and service fingerprinter | 1 |

| 4 | Mapping the Web Attack Surface | Web crawler, content discovery, parameter miner | 3 |

| 5 | Vulnerability Discovery | IDOR/SSRF scanner with triage engine | 2 |

| 6 | Exploitation: The Web Foothold | SQL-injection extractor and foothold shell | 2 |

| 7 | Exploiting the AI Layer | Prompt-injection fuzzer and agent-abuse toolkit | 3 |

| 8 | Post-Exploitation | Encrypted reverse-shell implant and async tasker | 1 |

| 9 | Privilege Escalation | Linux enumerator, SUID exploit, container escape | 2 |

| 10 | Active Directory & Lateral Movement | Kerberoasting client, SMB lateral-movement tool | 2 |

| 11 | Actions on Objectives | Data hunter and DNS exfiltration channel | 1 |

| 12 | Reporting | Findings database, CVSS scorer, report generator | — |

| | | **Total** | **20** |

Adversarial Bash

Adversarial Bash

Build Your Own Pentest Arsenal — In Bash

Most offensive-security books hand you a framework and a flag. This one hands you a terminal prompt and a target.

Apex Foundry is a precision-manufacturing company that builds industrial control interfaces, runs a customer-facing web application backed by Postgres, operates an Active Directory domain for its corporate workforce, and recently bolted an AI assistant onto its support portal. It also happens to be running entirely inside your homelab — Docker containers, a virtual AD forest, and a vulnerable web stack you control end to end.

Your job is to break it. Your constraint is that every tool you use must be one you wrote yourself, in Bash.

Over thirteen chapters you will work through a single, continuous penetration test — from passive reconnaissance through data exfiltration and final reporting. Each chapter adds a link to the attack chain: you will build port scanners with `/dev/tcp`, web crawlers with `curl`, SQL-injection extractors with pipes and string manipulation, a prompt-injection fuzzer with `jq`, a cron-persisted reverse-shell implant, Kerberoasting wrappers, a covert DNS exfiltration channel with `dig`, and a report generator that pulls every finding into a finished deliverable. Every tool is a script you can paste into any Linux terminal with zero dependencies beyond a standard installation.

Along the way you will capture twenty flags (format: `APEX{...}`) and document twenty-two findings, building a portfolio that doubles as a real-world pentest report.

Why Bash?

Python dominates offensive tooling for good reason — it is powerful, readable, and everywhere. Rust compiles to fast, dependency-free binaries. But Bash offers something neither can:

- It is already on the target. Every Linux host, every container, every cloud instance ships with a POSIX shell. There is nothing to install, nothing to upload, nothing to compile. Your tool *is* the terminal.

- No forensic footprint. A Bash script leaves no binary on disk, no interpreter to flag, no package manager log. When you pipe commands through a reverse shell, the tool exists only in memory and in process lists.

- Living off the land. `curl`, `dig`, `awk`, `grep`, `find`, `openssl`, `base64`, `xxd`, `sqlite3` — standard utilities that defenders expect to see in log files. Using them for offense is indistinguishable from normal administration.

- Instant iteration. No compile step, no dependency resolution, no virtual environment. Edit, run, observe. The feedback loop is measured in keystrokes.

- Universal skill transfer. Every sysadmin writes Bash. Learning to weaponize it teaches you to defend against the same techniques — because the attacker at the keyboard looks exactly like the admin.

This book does not replace your Python toolkit or your compiled Rust binaries. It extends your capabilities into the space where those tools cannot go — the compromised host where you have a shell and nothing else.

Who This Book Is For

You should be comfortable with:

- Bash fundamentals. You know variables, loops, conditionals, functions, pipes, and redirection. You have written at least a few scripts that automate real tasks. This book will not teach the shell — it will teach you what to build with it.

- Networking basics. TCP/IP, DNS, HTTP, and TLS at a conceptual level. You know what a SYN packet is and what a `301` means.

- Linux command-line work. Shell navigation, process management, file permissions, `cron`. You will live in a terminal.

- Docker. You can pull images, run containers, and read a `docker-compose.yml`. The entire lab runs in containers.

Prior penetration-testing experience helps but is not required. Each chapter explains the *why* before the how.

Conventions Used in This Book

Each chapter follows a consistent structure:

| Section | Purpose |

| --- | --- |

| Briefing | Sets the operational context — where you are in the engagement and what intelligence you have so far. |

| Objective | States the chapter's concrete goal: what you will build and what flag(s) you will capture. |

| Concepts | Explains the underlying vulnerability class, protocol, or technique before you write a line of code. |

| Build | Walks through the tool's design and implementation in Bash, utility by utility, function by function. |

| Capture | Runs the finished tool against the lab range and captures one or more flags. |

| Debrief | Reviews what the tool revealed, documents findings, and previews the next chapter's attack vector. |

Code blocks use Markua's language-annotated fences:

{lang="bash"}

```

#!/usr/bin/env bash

echo "You are reading a Bash code block."

```

Shell output appears as:

{lang="text"}

```

[+] Target: apex-web.foundry.local

[+] Open ports: 22, 80, 443, 5432

```

Flags appear inline when captured and follow the format `APEX{lower_case_l33t}`.

Engagement Roadmap

| Ch. | Title | Tool Built | Flags |

| --- | --- | --- | --- |

| 0 | Rules of Engagement | Workstation preflight checker | 1 |

| 1 | Building the Range | Range orchestrator (`apex-range.sh`) | 1 |

| 2 | Passive Reconnaissance | DNS enumerator and OSINT dossier builder | 1 |

| 3 | Active Reconnaissance & Scanning | Bash TCP scanner and service fingerprinter | 1 |

| 4 | Mapping the Web Attack Surface | Web crawler, content discovery, parameter miner | 3 |

| 5 | Vulnerability Discovery | IDOR/SSRF scanner with triage engine | 2 |

| 6 | Exploitation: The Web Foothold | SQL-injection extractor and foothold shell | 2 |

| 7 | Exploiting the AI Layer | Prompt-injection fuzzer and agent-abuse toolkit | 3 |

| 8 | Post-Exploitation | Cron-persisted reverse-shell implant and task runner | 1 |

| 9 | Privilege Escalation | Linux enumerator, SUID exploit, container escape | 2 |

| 10 | Active Directory & Lateral Movement | Kerberoasting wrapper, SSH lateral-movement tool | 2 |

| 11 | Actions on Objectives | Data hunter and DNS exfiltration channel | 1 |

| 12 | Reporting | Findings database, CVSS scorer, report generator | — |

| | | Total | 20 |

Adversarial PowerShell

Adversarial PowerShell

Offensive Security Tools from Scratch in PowerShell

Welcome to Adversarial PowerShell, the fourth entry in the Adversarial Series. While Adversarial Bash showed you how to weaponize the Linux shell, this book takes you deep into the Windows attack surface — the environment where most enterprise penetration tests live and die.

PowerShell is not just a scripting language. It is a direct interface to the Windows operating system, the .NET framework, COM objects, WMI, Active Directory, the registry, and the Win32 API. Every modern Windows host ships with it. Every domain controller speaks its language. Every EDR vendor fears what it can do.

Across thirteen chapters, you will conduct a single, continuous penetration test against Meridian Financial Group — a fictional mid-market financial services firm with a realistic Windows enterprise environment: Active Directory forests, IIS web applications, SQL Server databases, file shares, Exchange-style mail, and endpoint detection. You start with nothing but a PowerShell prompt and finish with domain admin, crown jewels exfiltrated, and a professional pentest report.

Along the way you will capture twenty flags (format: `MERIDIAN{...}`) and document twenty-two findings, building a portfolio that doubles as a real-world pentest report.

Every tool in this book is built from scratch in PowerShell — no Metasploit, no Cobalt Strike, no imported exploit frameworks. You will understand every line because you wrote it.

What You Will Build

- A multi-threaded TCP/UDP port scanner with service fingerprinting

- An LDAP enumeration engine rivaling PowerView

- A Kerberoasting and AS-REP roasting toolkit

- A password spraying framework with lockout awareness

- A SQL injection exploitation module

- An AMSI bypass and ETW patching framework

- A PowerShell obfuscation engine

- A full HTTP-based C2 implant with tasking

- Token manipulation and UAC bypass tools

- Lateral movement modules (WMI, WinRM, DCOM, named pipes)

- DNS and HTTPS exfiltration channels

- A complete pentest findings report generator

Prerequisites

- Intermediate PowerShell fluency (scripting, functions, modules)

- Familiarity with Windows administration (AD, GPO, services)

- Basic networking knowledge (TCP/IP, DNS, HTTP)

- A lab environment capable of running Windows VMs or Docker containers

The Adversarial Series

| # | Title | Language | Focus |

|---|-------|----------|-------|

| 1 | Adversarial Python | Python | Advanced exploitation and tool development |

| 2 | Adversarial Rust | Rust | Systems-level offensive tooling |

| 3 | Adversarial Bash | Bash | Linux/Unix shell-based penetration testing |

| 4 | Adversarial PowerShell | PowerShell | Windows enterprise penetration testing |

Adversarial JavaScript

Adversarial JavaScript

A full-stack penetration test built entirely in JavaScript — from first packet to final report.

Every chapter of this book advances a single, continuous engagement against one fictional target that lives entirely in your homelab: Vectrix Labs, a cloud-native SaaS company that sells a threat-intelligence platform to enterprise security teams. Vectrix runs the modern JavaScript stack end to end — a React front end, a Node.js/Express API layer, a GraphQL gateway, MongoDB for persistence, Redis for sessions, and a Kubernetes cluster that ties it all together. One target carries every phase of the pentest: the external edge, a web application thick with client-side logic, a real-time WebSocket feed, an AI-powered analyst chatbot, and the cloud infrastructure underneath.

You don't just run tools against Vectrix. You build the tools, in JavaScript, one phase at a time: your own recon harness, your own scanner, your own crawler, your own exploits, your own post-exploitation agents, and finally your own report generator. Each phase ends with a captured flag — `VECTRIX{...}` — and those flags become the evidence trail for the deliverable you assemble in the final chapter.

Nothing in this book touches a system you do not own. The entire range is yours: stood up locally with one command, attacked, and torn down when you are done.

Who This Book Is For

You already write JavaScript and you have seen a pentest before. This book pushes past tutorial territory into the patterns that make offensive tooling fast and reliable: `fetch` and `undici` for HTTP, `async/await` for concurrency, Node.js streams and `child_process` for system interaction, `ws` for WebSocket manipulation, `puppeteer` for browser automation, and `crypto` for the primitives that show up everywhere in modern auth. If you have never written JavaScript beyond a "Hello World," start elsewhere and come back. If you want to understand what your tools actually do — and build better ones — you are in the right place.

Conventions

Flags. Each chapter plants at least one flag in the range, in the format `VECTRIX{...}`. You capture it by running the tool you just built, not by reading it out of a config file. Flags are cumulative; keep them.

The chapter rhythm. Every chapter follows the same beat:

| Beat | What it is |

| --- | --- |

| Briefing | The story moves one step forward in the engagement |

| Objective | The concrete goal and the flag to capture |

| Concepts | The JavaScript ideas the chapter introduces |

| Build | Complete, working tooling you type and run |

| Capture | Running your tool against the range to take the flag |

| Debrief | The blue-team view: what this looks like to a defender |

Some chapters add an **AI Corner** — an optional sidebar that uses or attacks an LLM. It is never required to finish a chapter.

Lab safety. The range is self-contained and offline-capable. Treat every technique here as lab-only. The same code pointed at infrastructure you are not authorized to test is a crime; authorization is the only thing separating this book from one.

## Roadmap

| Ch | Phase | What you build in JavaScript |

| --- | --- | --- |

| 0 | Rules of engagement | Workstation preflight check |

| 1 | Range build & inventory | `range_control.mjs` — Docker orchestrator + asset inventory |

| 2 | Passive recon / OSINT | Async DNS, certificate transparency, dossier builder |

| 3 | Active recon & scanning | Your own async port scanner + service fingerprinter |

| 4 | Web attack surface | Headless crawler, content discovery, parameter miner |

| 5 | Vulnerability discovery | A focused scanner (XSS / prototype pollution / SSRF) |

| 6 | Exploitation — the web foothold | NoSQL injection + JWT forgery; your first shell |

| 7 | Exploiting the AI layer | Prompt-injection fuzzer; RAG poisoning; tool-call abuse |

| 8 | Post-exploitation | Reverse shells, WebSocket C2, living-off-the-land |

| 9 | Privilege escalation | Container escape, service-account abuse, secrets in env |

| 10 | Cloud & lateral movement | Kubernetes pivoting, service-mesh abuse, SSRF to metadata |

| 11 | Actions on objectives | Data exfiltration over DNS and WebSocket covert channels |

| 12 | Reporting | Parse every flag + finding into a scored deliverable |

Adversarial Go

Adversarial Go

A compiled penetration test built entirely in Go — from first packet to final report

Every chapter of this book advances a single, continuous engagement against one fictional target that lives entirely in your homelab: **Obsidian Grid**, a critical-infrastructure monitoring company that sells a SCADA/ICS visibility platform to energy utilities, water treatment facilities, and manufacturing plants. Obsidian runs Go end to end — a fleet of Go microservices connected by gRPC and Protocol Buffers, a PostgreSQL database for asset inventory, an etcd cluster for configuration, a NATS messaging bus for real-time telemetry, an MQTT broker that talks to field sensors, Prometheus for metrics, and a custom TLS PKI that issues certificates to every component. One target carries every phase of the pentest: the external web dashboard, an API gateway, an operational-technology bridge, an AI-powered anomaly-detection engine, and the infrastructure underneath.

You don't just run tools against Obsidian Grid. You **build** the tools, in Go, one phase at a time: your own recon harness, your own scanner, your own exploits, your own implants, and finally your own report generator. Every tool compiles to a single static binary that you can cross-compile for any OS and drop on any target without dependencies. Each phase ends with a captured flag — `OBSIDIAN{...}` — and those flags become the evidence trail for the deliverable you assemble in the final chapter.

Nothing in this book touches a system you do not own. The entire range is yours: stood up locally with one command, attacked, and torn down when you are done.

## Who This Book Is For

You already write Go and you have seen a pentest before. This book pushes past tutorial territory into the patterns that make offensive tooling fast and reliable: goroutines and channels for concurrent scanning, `net` and `net/http` for raw socket work and HTTP manipulation, `crypto/tls` and `crypto/x509` for certificate abuse, `os/exec` and `syscall` for post-exploitation, `google.golang.org/grpc` for attacking gRPC services, and `encoding/binary` for protocol parsing. If you have never written Go beyond a "Hello World," start elsewhere and come back. If you want to understand what your tools actually do — and build better ones that compile to a single, dependency-free binary — you are in the right place.

## Conventions

**Flags.** Each chapter plants at least one flag in the range, in the format `OBSIDIAN{...}`. You capture it by running the tool you just built, not by reading it out of a config file. Flags are cumulative; keep them.

**The chapter rhythm.** Every chapter follows the same beat:

| Beat | What it is |

| --- | --- |

| Briefing | The story moves one step forward in the engagement |

| Objective | The concrete goal and the flag to capture |

| Concepts | The Go ideas the chapter introduces |

| Build | Complete, working tooling you type and run |

| Capture | Running your tool against the range to take the flag |

| Debrief | The blue-team view: what this looks like to a defender |

Some chapters add an **AI Corner** — an optional sidebar that uses or attacks an LLM. It is never required to finish a chapter.

**Lab safety.** The range is self-contained and offline-capable. Treat every technique here as lab-only. The same code pointed at infrastructure you are not authorized to test is a crime; authorization is the only thing separating this book from one.

## Roadmap

| Ch | Phase | What you build in Go |

| --- | --- | --- |

| 0 | Rules of engagement | Workstation preflight check |

| 1 | Range build & inventory | `range_control.go` — Docker orchestrator + asset inventory |

| 2 | Passive recon / OSINT | Concurrent DNS resolver, certificate transparency, dossier builder |

| 3 | Active recon & scanning | SYN scanner with goroutine pool + service fingerprinter |

| 4 | Web attack surface | Concurrent directory bruter, API fuzzer, gRPC reflection enumerator |

| 5 | Vulnerability discovery | SSTI / command injection / gRPC auth-bypass scanner |

| 6 | Exploitation — the foothold | Deserialization + command injection chain; your first shell |

| 7 | Exploiting the AI layer | Prompt-injection fuzzer; model poisoning; tool-call hijack |

| 8 | Post-exploitation | Static-binary implant, encrypted C2, credential harvesting |

| 9 | Privilege escalation | Container escape, etcd secret extraction, PKI certificate abuse |

| 10 | Cloud & lateral movement | gRPC service hopping, NATS message interception, MQTT pivot |

| 11 | Actions on objectives | Data exfiltration over DNS and covert gRPC channels |

| 12 | Reporting | Parse every flag + finding into a scored deliverable |

Adversarial SQL

Adversarial SQL

A Penetration Tester's Guide to Database Exploitation

SQL is not just a query language. In the hands of a penetration tester, it is a weapon that can read files, execute operating system commands, pivot between servers, and exfiltrate entire databases through covert channels. Every enterprise runs on SQL databases, and nearly every web application speaks to one. When the application doesn't properly separate user input from SQL logic, the attacker controls the database — and often the host underneath it.

This book teaches database exploitation through one continuous engagement against **Lumen Dataworks**, a fictional financial data aggregation platform. You will deploy a realistic multi-database lab — PostgreSQL, Microsoft SQL Server, and MySQL behind vulnerable web applications — and systematically compromise it from SQL injection discovery through lateral movement, persistence, and exfiltration. Every tool you build works. Every payload you craft is real. Every technique maps to a finding you will document in a professional penetration test report.

This book assumes you are comfortable with basic SQL syntax (SELECT, INSERT, UPDATE, DELETE, JOIN) and have a working knowledge of web application testing. You do not need to be a DBA — the book teaches the internals that matter for exploitation as you encounter them.

## The Engagement

**Client:** Lumen Dataworks

**Type:** Web Application Penetration Test — Database Focus

**Scope:** All database-backed web applications and exposed database services within the Lumen Dataworks lab environment

**Methodology:** Reconnaissance → Injection Discovery → Exploitation → Post-Exploitation → Lateral Movement → Persistence → Exfiltration → Reporting

## Conventions

Code blocks with `{lang="sql"}` contain SQL payloads — the core adversarial craft. Code blocks with `{lang="python"}` contain Python orchestration scripts that deliver those payloads. Code blocks with `{lang="bash"}` contain shell commands.

Flags follow the format `LUMEN{...}` and prove each objective was completed. Collect them all.

## Disclaimer

The techniques in this book are for authorized penetration testing and educational purposes only. Deploy the included lab environment and practice there. Never test against systems without explicit written authorization.

Adversarial Nim

Adversarial Nim

Custom Offensive Tooling for the Modern Red Team

Nim compiles to C. That single fact changes everything for a red teamer. While defenders build detection signatures for Python scripts, PowerShell commands, and .NET assemblies, a Nim binary lands on disk looking like any other native executable — small, fast, and unfamiliar to most EDR heuristics. The language gives you Python-like syntax with C-level performance, direct Windows API access without P/Invoke wrappers, cross-compilation from Linux to Windows with one flag, and compile-time metaprogramming that can encrypt strings, encode payloads, and generate polymorphic code before the binary is even built.

This book teaches offensive tool development through one continuous red team engagement against Nexus Foundry, a fictional defense-adjacent advanced materials research firm. You will build a complete custom toolkit from scratch — reconnaissance utilities, shellcode loaders, process injectors, a C2 implant, defense evasion modules, privilege escalation exploits, lateral movement tools, and covert exfiltration channels. Every tool compiles. Every technique is demonstrated against a realistic lab environment with Active Directory, Windows Defender, Sysmon, and network monitoring. Every finding maps to a professional red team report.

This book assumes you are comfortable with at least one programming language and have a working understanding of Windows internals (processes, threads, memory, the PE format). You do not need prior Nim experience — the book teaches offensive Nim from the ground up.

The Engagement

Client: Nexus Foundry

Type: Red Team Assessment — Full Adversary Simulation

Scope: All Windows and Linux systems within the Nexus Foundry corporate network, including Active Directory, workstations, file servers, and development infrastructure

Methodology: Reconnaissance → Initial Access → Execution → Persistence → Privilege Escalation → Defense Evasion → Lateral Movement → Exfiltration → Reporting

Conventions

Code blocks with `{lang="nim"}` contain Nim source — the core offensive craft. Code blocks with `{lang="bash"}` contain shell commands for compilation, deployment, and lab management. Code blocks with `{lang="python"}` contain supporting Python scripts. Code blocks with `{lang="text"}` contain tool output and log excerpts.

Flags follow the format `NEXUS{...}` and prove each objective was completed. Collect them all.

Disclaimer

The techniques in this book are for authorized red team engagements and educational purposes only. Deploy the included lab environment and practice there. Never test against systems without explicit written authorization. Building offensive tools carries responsibility — use them ethically.

Adversarial Assembly

Adversarial Assembly

Bare-Metal Exploitation from Shellcode to Bootkit

This book teaches x86-64 assembly language through the lens of offensive security. You will write shellcode by hand, exploit stack and heap vulnerabilities, build ROP chains that defeat modern mitigations, craft position-independent implants that resolve APIs at runtime, evade analysis environments, exploit kernel drivers, analyze firmware boot processes, and instrument binaries with inline hooks — all at the lowest level of abstraction the processor offers.

Every technique is demonstrated against Vectron Systems, a fictional defense-adjacent embedded systems firm, in one continuous authorized engagement. The lab runs on commodity hardware. The targets are vulnerable by design. The twenty CTF flags hidden across the engagement confirm you executed each phase correctly.

Assembly is not a convenience language. You will work harder for every capability than you would in Python or Nim. What you gain is total control — over every register, every byte on the stack, every instruction the processor decodes. When higher-level tools fail, when EDR hooks every API, when DEP and ASLR conspire against your payload — assembly is what remains.

Conventions

Code blocks are labelled by syntax:

- `{lang="asm"}` — NASM x86-64 assembly (Intel syntax)

- `{lang="python"}` — Python 3 helper scripts and exploit code

- `{lang="c"}` — Vulnerable target programs and kernel modules

- `{lang="bash"}` — Shell commands and build recipes

Findings follow the format `F01`, `F02`, etc., with CVSS 3.1 base scores.

CTF flags use the format `VECTRON{...}` and appear at key milestones.

Registers are written in lowercase (`rax`, `rsp`, `rdi`) following NASM convention.

Addresses and byte sequences are in hexadecimal (`0x41414141`, `\x31\xc0`).

Disclaimer

All techniques in this book are demonstrated within an isolated lab environment against intentionally vulnerable targets. The fictional engagement with Vectron Systems operates under explicit rules of engagement. These techniques are presented for authorized penetration testing, red team operations, and CTF competitions. Unauthorized use against systems you do not own or have explicit written permission to test is illegal and unethical.

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub