Leanpub Header

Skip to main content

Adversarial PowerShell

Offensive Security Tools from Scratch in PowerShell

Adversarial PowerShell
This book is 100% completeLast updated on 2026-11-17

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.

Minimum price

$10.99

$14.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
About

About

About the Book

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 |

Author

About the Author

Andrew Ingram

Andrew Ingram is an IT and cybersecurity professional specializing in threat analysis, security operations, and security awareness. With extensive experience in financial-sector security — including email security, BEC threat analysis, phishing simulation, and compliance-oriented communications — he brings a practitioner's perspective to offensive security education. Andrew is the author of the *Adversarial Series*, which teaches penetration testing through hands-on tool building in multiple languages.

Contents

Table of Contents

Adversarial PowerShell

  1. Offensive Security Tools from Scratch in PowerShell
  2. About This Book
  3. Roadmap
  4. About the Author

Chapter 0 — Preflight: PowerShell Arsenal Setup

  1. Briefing
  2. Objective
  3. Concepts
  4. Build — The Preflight Validation Script
  5. Concepts Deep Dive
  6. Capture the Flag
  7. Debrief

Chapter 1 — Range Builder: Deploying Meridian Financial

  1. Briefing
  2. Objective
  3. Concepts
  4. Build — The Range
  5. Capture the Flag
  6. Debrief

Chapter 2 — Passive Recon: Profiling Meridian Financial

  1. Briefing
  2. Objective
  3. Concepts
  4. Build
  5. Capture the Flag
  6. Debrief

Chapter 3 — Active Recon: Mapping the Network

  1. Briefing
  2. Objective
  3. Concepts
  4. Build — Invoke-PortScan
  5. Build — Invoke-SMBEnum
  6. Capture the Flag
  7. Debrief

Chapter 4: AD Enumeration

  1. Briefing
  2. Objective
  3. Concepts
  4. Build
  5. Capture the Flag
  6. Debrief

Chapter 5: Credential Attacks

  1. Briefing
  2. Objective
  3. Concepts
  4. Build
  5. Capture the Flag
  6. Debrief

Chapter 6: Exploitation

  1. Briefing
  2. Objective
  3. Concepts
  4. Build
  5. Capture the Flag
  6. Debrief

Chapter 7: Defense Evasion

  1. Briefing
  2. Objective
  3. Concepts
  4. Build
  5. Capture the Flag
  6. Debrief

Chapter 8: Post-Exploitation — Command and Control

  1. Briefing
  2. Objective
  3. Concepts
  4. Build
  5. Capture the Flag
  6. Debrief

Chapter 9: Privilege Escalation — Service Abuse and UAC Bypass

  1. Briefing
  2. Objective
  3. Concepts
  4. Build
  5. Capture the Flag
  6. Debrief

Chapter 10 — Lateral Movement: Spreading Through Meridian

  1. Briefing
  2. Objective
  3. Concepts
  4. Build
  5. Capture the Flag
  6. Debrief

Chapter 11 — Crown Jewels: Proving Business Impact

  1. Briefing
  2. Concepts
  3. Build
  4. Capture
  5. Debrief

Chapter 12 — The Report: Documenting the Engagement

  1. Briefing
  2. Objective
  3. Concepts
  4. Build
  5. Capture the Flag
  6. Debrief

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