student@hack3rs:~$ cat exposure-audit-lab-nmap-ndiff.md
Exposure Audit Lab with Nmap and Ndiff (Defensive Validation)
Practice safe defensive scanning and drift comparison using Nmap and Ndiff to validate what a lab system is exposing and what changed over time.
prerequisites
- $Use only systems and networks you own or are explicitly authorized to test.
- $Basic familiarity with networking and logs.
- $Willingness to document evidence and assumptions.
1. Lab Goal and Ethics
Scan only systems you own or are explicitly authorized to scan. The goal here is a repeatable audit workflow — not probing random hosts or verifying whether some internet service is reachable.
Start with a clearly scoped target: one VM or one small lab subnet. Define the purpose before running anything: inventory validation, firewall rule check, or change comparison. Those three questions produce different scan designs.
Write down the exact command and timestamp so you can reproduce the same scan later and compare results. This habit also helps you explain expected scanner traffic to anyone reviewing network logs.
2. Baseline, Change, Compare
Run a baseline Nmap scan and save the output in XML format. Change one thing in the lab — start or stop a service, adjust a firewall rule, or change network reachability. Run the same scan again and pipe both XML files through Ndiff.
The key learning outcome is not the raw scan output. It is explaining what changed, why it changed, and whether the difference matches your intended configuration or represents drift you did not expect.
Pick one result from the diff and validate it manually with curl, nc, or a service log. That step teaches you to treat scan output as evidence to confirm rather than as a final answer.
3. Operational Habits to Build
Keep a simple scan log: date, operator, target, purpose, command, and findings. This scales into real environments and makes your work auditable when someone asks why a scan ran.
Choose the least intrusive scan that answers your question. A targeted SYN scan against a specific port range teaches more about scope discipline than a full -A scan when you are learning the basics.
Connect this lab to threat pages on exposed services so scanning is learned as a risk-reduction activity, not a standalone technical exercise.
exposure-audit-lab-checklist
- $Write down the target, scope, and purpose before running any scan.
- $Save baseline scan output in XML for Ndiff comparison.
- $Make one controlled change to the lab environment before rescanning.
- $Use Ndiff to identify and explain the delta.
- $Manually validate one changed result and document your conclusion.
how-to-workflow
- Define the authorized target, purpose, and scope of the exposure audit.
- Run and save a baseline Nmap scan using a repeatable command.
- Make one controlled lab change (service or firewall behavior).
- Run the same scan again and compare with Ndiff.
- Validate one changed result manually (for example with curl or nc/ncat).
- Document the delta, explanation, and defensive next action.