Ethical Hacking & Penetration Testing: Introduction and Scope
A penetration test is a paid, planned attempt to break into a client's systems so that the client learns where it is weak before somebody hostile finds out. The technical part (finding hosts, identifying software, recognising a known weakness) is the part everyone pictures. It is also the smaller part. Most of a professional engagement is planning, judgement and writing: agreeing what may be touched, deciding which of two hundred scanner findings matter, proving a weakness without causing damage, and explaining it so that an executive funds the fix and an engineer can make it. This course teaches the whole engagement, in the order a tester lives it.
Before anything else: authorization and scope
This is the most offensive course of the track. Every technique in it is a crime when it is aimed at a system you are not allowed to test, in almost every country, whatever your intentions and even if nothing breaks. The rule has no exceptions:
Only test systems you own, or that you have written permission to test from someone entitled to give it, and only within the agreed scope, dates and techniques.
Read these lessons of Security Foundations before going further. This course builds on them and does not repeat them:
- Authorization, Scope and Rules of Engagement: the three documents (authorization, scope, rules of engagement), who can sign, and a scope checker.
- US Law: the CFAA, UK and EU Law and Vietnamese Law: what "unauthorised access" means where you live and where the target is.
- Responsible Disclosure, Bug Bounties and security.txt: what to do with a weakness you find outside an engagement.
Practise on your own isolated lab with deliberately vulnerable machines, following the lab safety rules.
How this course stays on the right side of the line
The track's safety line is binding for every lesson here, and this course applies it strictly:
- Methodology, reasoning and reporting are the substance. Each attack technique appears as a mechanism, followed by how it is detected and how it is fixed. No lesson ends at the attack.
- Runnable parts are harmless by construction. Python models run in your browser on data the example creates. Tool sessions (Nmap, dig, OpenSSL, curl) run in a sandbox container with no network, against services the session itself starts on
127.0.0.1. - Everything else is a labelled lab transcript against the lab network
10.10.0.0/24and names underlab.test, with the scope stated. No real organisation is ever a target. - No exploit code for real CVEs, no payload generation, no evasion. Exploitation is taught as a concept (what it proves, what it risks, how it is detected) and privilege escalation as misconfigurations found by a read-only audit, each with its fix.
The map
The course follows the ten-step methodology of a professional test. Each step has its own section.
| Section | What you learn |
|---|---|
| Getting started | what a penetration test is, and how it differs from a vulnerability scan, a red-team exercise, a bug bounty and an audit |
| Planning | the methodology and the standards (PTES, OWASP WSTG, NIST SP 800-115, OSSTMM), written authorization and contracts, a full rules-of-engagement template, scope as data, test windows, stop conditions and data handling |
| Reconnaissance | passive and active recon, OSINT and its ethical limits, DNS on a lab zone, certificate transparency, technology identification, an attack-surface model |
| Scanning and enumeration | scans that don't break things, service and version detection on loopback, HTTP, SSH, SMB and LDAP enumeration, turning scan output into a test plan |
| Vulnerability assessment | CVE, CWE, CPE, a CVSS v3.1 calculator, CVSS v4.0 macrovectors, EPSS, CISA KEV, scanner triage, safe validation, prioritisation |
| Exploitation concepts | what exploitation proves and risks, Metasploit's architecture, shells and processes, privilege boundaries, Linux and Windows escalation classes as misconfigurations, lateral movement |
| Post-exploitation | what stays out of scope, impact assessment, evidence without harm, cleanup |
| Reporting | the report structure with a full template, the executive summary, findings with evidence for the right audience, remediation and the retest |
| Practice | exercises and a complete mock engagement against a described lab network |
How examples run here
```python runruns in your browser (Python 3.13 in WebAssembly) on data the example defines: scope checks, CVSS scores, triage, report generation.```bash runblocks are recorded sandbox sessions produced by real runs of Nmap, dig, OpenSSL and curl in a container with no network and no root. Each session starts its own services on127.0.0.1, uses them and stops them.```consoleblocks are lab transcripts: what a tool printed in an authorised lab on10.10.0.0/24. They are labelled, they state the scope, and they are not run.
The habit this course wants you to build first is that no command reaches a target before the target is checked against the scope. Here it is as a small shell function in your sandbox. The scope file contains one address, the sandbox's own loopback, which is the only thing a session may ever scan:
printf '127.0.0.1/32\n' > scope.txt
in_scope() {
python3 - "$1" <<'PY'
import ipaddress, sys
ip = ipaddress.ip_address(sys.argv[1])
nets = [ipaddress.ip_network(l.strip()) for l in open("scope.txt") if l.strip()]
sys.exit(0 if any(ip in n for n in nets) else 1)
PY
}
guarded_scan() {
if in_scope "$1"; then
echo "$(date -u +%F) $1 in scope, scanning" >> activity.log
nmap -sT -p 8000,8001 "$1" | grep -E '^[0-9]+/tcp'
else
echo "REFUSED $1: not in scope.txt" | tee -a activity.log
fi
}
python3 -m http.server 8000 --bind 127.0.0.1 >http.log 2>&1 &
for i in $(seq 50); do curl -s -o /dev/null http://127.0.0.1:8000/ && break; sleep 0.1; done
guarded_scan 127.0.0.1
guarded_scan 10.10.0.5
guarded_scan 192.0.2.10
kill %1
echo "activity log lines: $(wc -l < activity.log)"8000/tcp open http-alt
8001/tcp closed vcom-tunnel
REFUSED 10.10.0.5: not in scope.txt
REFUSED 192.0.2.10: not in scope.txt
activity log lines: 3
The scan of 127.0.0.1 runs; the lab address and the documentation address are refused before Nmap starts, and every decision lands in activity.log. Real engagements use the same two ideas at a larger scale: a target list derived from the signed scope (never typed by hand), and an activity log that records source, target, time and technique for every action. The scope lesson builds the checker properly.
What you should know first
Web Application Security is the web half of testing; its testing methodology, writing findings and OWASP Top 10 2025 lessons are used here, not repeated. Network Security is the defender's view of the same networks: inventory, scanning theory, segmentation, firewalls and IDS. Networking for Security covers the protocols on the wire. The survey course Cybersecurity is the gentlest starting point if any of this is new.
Start with What a Penetration Test Is (and Isn't).
Test yourself
What turns the same commands from a crime into a penetration test?
- Using professional tools
- Written permission from someone entitled to give it, for an agreed scope, dates and techniques
- Good intentions and no damage
- Working from a VPN
In this course, what may a runnable bash session scan?
- Any host in 10.10.0.0/24
- Public test sites
- Only services the session starts itself on 127.0.0.1, in a container without network
- Anything with a low scan rate
Why does the guarded_scan function check the target before running Nmap, instead of relying on Nmap failing?
- Nmap is slow
- The habit of checking every target against the signed scope prevents typos and drift from ever reaching someone else's system
- Python is faster than Nmap
- It hides the scan from the log
Which part of an engagement do most clients actually read?
- The raw scanner output
- The report
- The activity log
- The exploit code