Courses3 levels
Level 1 · Foundations11 courses
Level 2 · Core5 courses
Level 3 · Advanced5 courses
Labs8 topics
Library Practice exams AI Range Pricing Start free

Practice library / Penetration testing, first steps

Workbook · Easy · 3 hours

Pre-Engagement & Setting Up

Scope documents, rules of engagement, and lab environment configuration.

  • scoping
  • rules-of-engagement
  • engagement-setup
  • lab-environment
On this page 4 sections
  1. ·About This Workbook
  2. ·Chapter 1 — Your Testing Platform
  3. ·Chapter 2 — Supporting Infrastructure
  4. ·Chapter 3 — Planning & Checklists

Before you start

Most of what decides whether a penetration test succeeds happens before the first scan. A reliable testing machine, a clean set of support servers to catch callbacks, a note system that keeps evidence safe, and a signed scope that says exactly what the tester may do: these are the ground on which every later finding stands. This workbook covers that groundwork. It walks through building and freezing a Kali platform, standing up the C2 and file-hosting infrastructure that an engagement needs, and writing the scope and rules-of-engagement documents that make the work lawful. The habit here is boring on purpose. A tester who prepares well spends the engagement on analysis, not on fixing their own setup.

What You'll Learn

  • Prepare a reliable, up-to-date testing platform
  • Stand up the supporting infrastructure an engagement needs
  • Scope an engagement and agree rules of engagement before touching a target
  • Organise notes and evidence from day one, and work to a checklist

About This Workbook

Good preparation saves engagements. The work that decides whether a test goes smoothly happens before you run a single scan: a clean and current testing machine, the servers and services that catch your shells and host your files, a note-taking system you trust, and a written agreement that says exactly what you may and may not do. This workbook covers that groundwork.

Authorisation is not optional. Everything here is for testing systems you have explicit, written permission to test. Accessing or attacking a system without authorisation is a criminal offence under laws such as the US Computer Fraud and Abuse Act and the UK Computer Misuse Act. The signed scope and rules of engagement in Chapter 3 are what make the rest of this work lawful.

Chapter 1 — Your Testing Platform

A clean, capable base to work from. The testing machine should boot the same way every time, carry the required tools, and reset to a known-good state in seconds when something goes wrong.

Distro and tooling

The standard choice is Kali Linux, a Debian-based distribution that ships the common offensive tools pre-packaged. Parrot Security OS is a comparable alternative on the same Debian lineage. Either is fine. The point is a purpose-built base, not a daily-use laptop, so that testing tools and traffic stay isolated from personal activity.

Run it in a virtual machine rather than on bare metal. A VM provides snapshots (below), throwaway networking, and the ability to keep a separate clean image per client so evidence and credentials do not mix between engagements. VirtualBox and VMware Workstation/Fusion are the usual hypervisors.

Kali ships metapackages so you install groups of tools rather than hunting them one by one. kali-linux-default is the standard set; kali-linux-large is a broader collection. Most engagements do not need every tool.

# See what a metapackage would pull in before committing to the disk space
apt show kali-linux-large

# Install a toolset group
sudo apt update
sudo apt install -y kali-linux-default

Keeping tools current

Kali is a rolling release: there are no numbered versions to upgrade between, just a continuous stream of package updates. Refresh the package index and upgrade with full-upgrade, which, unlike a plain upgrade, can remove obsolete packages when a dependency changes. Rolling distributions need this.

# The one command to keep Kali current
sudo apt update && sudo apt full-upgrade -y

# See only what is pending, without changing anything
apt list --upgradable

Not every tool comes from apt. Python-based tools are cleanest installed with pipx, which puts each in its own isolated environment so their dependencies never conflict with each other or with the system Python. Update tools cloned from Git by pulling.

# Python tools, isolated per-tool, upgraded in one shot
pipx install <tool>
pipx upgrade-all

# Update everything you keep as a git checkout under /opt
for d in /opt/*/; do
  [ -d "${d}.git" ] && echo "== $d ==" && git -C "$d" pull --ff-only
done

Follow one rule: do not run a large upgrade in the middle of an engagement. An update on a rolling distribution can change a tool's behaviour or break it entirely. Update between jobs, verify that key tools still run, and only then take a snapshot. During an engagement, stability matters more than the newest build.

Backups and snapshots

A snapshot is a saved state of the whole VM — disk and, optionally, memory — that can be rolled back instantly. Take one snapshot of the freshly updated, freshly configured machine and call it the clean base. Take another before anything risky. When a tool breaks networking or an install fails, restore the snapshot instead of rebuilding.

With VirtualBox this is driven from the VBoxManage command line as well as the GUI:

# Take a snapshot of a powered-on or powered-off VM
VBoxManage snapshot "Kali" take "clean-base" --description "Updated + configured, pre-engagement"

# List the snapshots you have
VBoxManage snapshot "Kali" list

# Restoring requires the VM to be powered off first
VBoxManage controlvm "Kali" poweroff
VBoxManage snapshot "Kali" restore "clean-base"

Snapshots protect the machine. They do not protect the work. Notes, loot and evidence must live somewhere that survives a rollback, which is why the next chapter covers note infrastructure. Treat a snapshot as a reset button for the platform, and keep the engagement data outside it.

Chapter 2 — Supporting Infrastructure

The servers and services that support an engagement. After a foothold is gained, a listener must catch the connection back. When a target needs to pull a file, a server must provide it. Every command also needs to be recorded somewhere it can be read back later.

Listeners and redirectors

A listener waits for an inbound connection, most often a reverse shell calling home. The simplest option is Netcat. Netcat ships in several variants (the traditional build, the OpenBSD build, and Nmap's ncat); the flags below work on the traditional and ncat builds. If your build rejects one, check nc -h.

# Bare listener: -l listen, -v verbose, -n no DNS, -p port
nc -lvnp 4444

# Wrap it in rlwrap so the caught shell gets history and arrow keys
rlwrap nc -lvnp 4444

Netcat shells are fragile: they have no job control, no tab completion, and Ctrl-C kills the whole session. socat provides a fully interactive listener by allocating a proper terminal on the tester's side:

# Fully interactive listener (pair with a matching socat payload on the target)
socat file:$(tty),raw,echo=0 tcp-listen:4444

A redirector sits between the tester and the target and forwards traffic, so the target only sees the redirector's address, not the tester's real machine. socat does this in one line: listen on a port, fork a child per connection, and relay to the real destination.

# Forward local :8080 to a backend, one child process per connection
socat TCP-LISTEN:8080,fork,reuseaddr TCP:192.168.1.10:80

SSH provides the same function through an encrypted tunnel, which can route a listener through a VPS that the tester controls:

# Local forward: reach a target-side service via a jump host
ssh -L 8080:127.0.0.1:80 user@jumphost

# Remote forward: expose your local listener on the VPS's port 4444
ssh -R 4444:127.0.0.1:4444 user@vps

For anything beyond a single shell, Metasploit's multi/handler manages listeners and is more resilient to dropped sessions than raw Netcat. The primitives above remain the first choice for simple cases, and the fallback when nothing else is available.

File hosting

Engagements regularly require moving a file to a target (an enumeration script, a compiled exploit) or pulling one back. Python includes a built-in HTTP server that serves the current directory:

# Serve the working directory over HTTP on :8000
python3 -m http.server 8000

# Serve a specific directory without cd-ing into it
python3 -m http.server 8000 --directory /srv/payloads

On the target you then fetch with curl or wget. When HTTP is inconvenient, for example on a Windows target with no easy downloader, an SMB share is often simpler. Impacket ships a standalone SMB server for exactly this:

# Share the current directory over SMB; -smb2support is needed by modern clients
impacket-smbserver share "$(pwd)" -smb2support

Keep hosted files in a directory that is not the notes directory, and clear it between engagements. A payload left in a served folder can end up on the wrong client's machine.

Note infrastructure

Record every action as it happens, because details are hard to recall at report-writing time. Two habits support this: a structured note store, and a transcript of every terminal.

For notes, a tool such as Obsidian, CherryTree, or plain Markdown files in a Git repository all work. Notes must live outside the VM snapshot — a synced folder, a Git remote, or a mounted host directory — so a rollback never eats them.

For terminals, script records everything printed to the terminal into a file until exit is typed. Start it as soon as work begins:

# Timestamped transcript of this whole session
script -a "engagement-$(date +%F).log"

# When you are done
exit

In tmux, pipe-pane does the same for a single pane on demand:

# Append everything in the current pane to a log file
tmux pipe-pane -o 'cat >> ~/engagement/tmux-pane.log'

Together, the transcript and the notes should allow the tester to reconstruct what was run, when, and what came back. This is the raw material for the report and, if needed, for showing that testing stayed inside scope.

Chapter 3 — Planning & Checklists

Structure keeps the work methodical. This chapter separates a professional engagement from ad hoc probing. Before the first packet leaves the tester's machine, the parties agree what is tested (scope), how it may be tested (rules of engagement), and how the work will be proved (evidence). The mature frameworks are worth reading directly: the Penetration Testing Execution Standard (PTES) devotes its first phase to pre-engagement, and the OSSTMM covers scoping rigorously.

Engagement checklist

Scope is the boundary. Before anything else, write an unambiguous statement of what is in scope and what is explicitly out. A single stray host can turn an authorised test into a crime. Record the scope as data, not prose:

textscope.txt — the authorised boundary, agreed in writing
IN SCOPE
  10.10.20.0/24            # corporate LAN, lab segment
  app.example.com          # staging web app only
  203.0.113.10             # single external host

OUT OF SCOPE
  10.10.20.1               # core router — do not touch
  *.prod.example.com       # production, under no circumstances
  Any host not listed above

WINDOW
  2026-08-17 to 2026-08-21, 09:00–17:00 local, weekdays only

The rules of engagement (RoE) then say what the tester may do to the in-scope targets. This is where the parties agree which techniques are allowed, who to call when something breaks, and how far the tester may go after gaining access. A minimal template:

markdownrules-of-engagement.md — agreed and signed before testing
# Rules of Engagement

## Authorisation
- Signed by: <client authorising officer, title, date>
- Tester(s): <names>
- Authorisation reference / "get out of jail" letter: <ID>

## Permitted
- Network scanning, service enumeration, vulnerability identification
- Manual exploitation of confirmed vulnerabilities on in-scope hosts
- Privilege escalation and lateral movement within the scoped segment

## Prohibited
- Denial-of-service or any deliberate degradation of availability
- Social engineering / phishing (unless separately scoped and signed)
- Modifying or deleting client data; exfiltrating real personal data
- Testing outside the scope.txt boundary or the agreed window

## On sensitive access
- Proof-of-access only: screenshot + hostname, do not read live data
- Stop and notify immediately on evidence of a prior compromise

## Contacts (24/7)
- Client emergency contact: <name, phone>
- Tester lead: <name, phone>

Two clauses matter more than the rest. First, the emergency contact and stop conditions: agree in advance what to do if a service crashes or if there are signs that someone else has already broken in. This is not a decision to make at 2 a.m. under pressure. Second, the written authorisation itself, sometimes called a "get out of jail free" letter: a signed document naming the tester, the scope, and the dates, which the tester can produce if anyone challenges the activity. No signature, no test.

Evidence workflow

Organise evidence from the first command instead of reconstructing it at the end. Create a predictable directory tree per target so every file has a known location:

# One tree per target, with a slot for every kind of artefact
mkdir -p engagement/targets/10.10.20.15/{nmap,web,creds,loot,notes,screens}

Then configure the tools to write into it. Nmap's -oA writes all three output formats (normal, greppable, XML) from one flag. Other tools take an output flag, or their output can be piped through tee so it reaches both the screen and a file:

# -oA <basename> writes .nmap, .gnmap and .xml at once
nmap -sC -sV -oA engagement/targets/10.10.20.15/nmap/initial 10.10.20.15

# For tools without an output flag, split the stream to a file
nikto -h http://10.10.20.15 | tee engagement/targets/10.10.20.15/web/nikto.txt

Finally, make the evidence tamper-evident by hashing it. A directory of hashes recorded at collection time lets you prove later that nothing changed:

# Record hashes at collection time
cd engagement/targets/10.10.20.15
find . -type f ! -name SHA256SUMS -exec sha256sum {} + > SHA256SUMS

# Verify nothing has changed since
sha256sum -c SHA256SUMS

Screenshots need separate attention. Every high-impact finding needs a screenshot that shows the what and the where together (the exploited condition plus the hostname or IP in the same frame), so the report reader can see that the finding was real and which host it affected.

Time management

An engagement is timeboxed, and the window in your scope is a hard limit, not a suggestion. Two practices keep the work inside it. First, enumerate broadly before going deep on any one target: a deep dive on one host can consume time owed to the other targets. Second, keep a running log of where the time goes. The transcript from Chapter 2 doubles as a time record, so a promising lead that has quietly cost hours becomes visible.

1

Confirm the paperwork before you start

Signed scope, signed RoE, authorisation letter in hand, and the emergency contacts saved on your phone. If any of these is missing, you do not have an engagement yet.

2

Snapshot the clean platform

Updated between jobs, key tools verified, then a clean-base snapshot so you can always get back to a known-good machine.

3

Stand up your infrastructure

Listener ready, file host pointed at a clean payload directory, notes syncing outside the VM, and script recording the session.

4

Work the scope, top to bottom

Enumerate everything in scope before deep-diving anything. Capture output into the per-target tree as you go, and hash it.

5

Stay inside the boundary

Every target you touch is in scope.txt. Every action is permitted by the RoE. When in doubt, stop and check. The boundary defines the job.

Keep going. With the platform built, the infrastructure standing and the paperwork signed, you are ready to test. Work through the matching labs to put each piece into practice, then move on to the reconnaissance and enumeration workbooks.

Sign in to track progress and send feedback.

Related