Command Anatomy, Scope, and Tool Safety
Read a tool command before running it, keep every action inside written scope, choose safe defaults, and save evidence that another person can reproduce.
By the end, you’ll be able to…
- Break a security tool command into its program, options, arguments, inputs, and outputs.
- Define written authorisation, scope, rules of engagement, and stop conditions.
- Choose rate limits and safe defaults that protect the target and the lab.
- Log commands, preserve evidence, handle sensitive output, and clean up after a test.
01Anatomy of a Security Command
A command line is a sentence with a strict grammar. The program comes first, then options that change behaviour, then arguments that name what to act on. In nmap -sV -p 22,80,443 10.10.10.20, nmap is the program, -sV asks for service and version detection, -p selects ports, and the address is the target. Change one part at a time and read the output before adding more.
Options are not interchangeable. nmap -O asks for operating-system detection; nmap -oA saves output in three formats. sqlmap --risk=3 enables heavy tests that can damage a fragile application; --batch accepts default answers but does not make the test safe. hashcat -m selects the hash mode; the wrong mode wastes time or produces nonsense. gobuster -t sets threads; more threads are not automatically better. Read the usage line and the defaults.
Know what is input and what is output. A target list, a wordlist, a hash file, and a request are inputs. A report, a capture, a potfile, and a log are outputs. Do not overwrite an input with an output redirection. Use distinct paths and a timestamped evidence directory. If a command takes both -o and -O, check which is which before you press Enter.
Some help flags are ambiguous. In many tools -h means help, but in Nikto -h specifies the host. Hydra's -h prints help; -l and -L select a login or a login list. When documentation and a blog disagree, trust the tool's own manual for the version you installed, then confirm with the project's official docs. Record the exact version because flags do change.
Exit codes and output streams carry information. Standard output is the normal result; standard error carries warnings and errors. A tool can print a scary warning and still exit 0, or find nothing and exit 1. Read both streams and save both. Use 2>&1 when you need one log, but remember that mixing them can make parsing harder.
02Scope, Authorisation, and the Law
Authorisation is the line between security work and crime. It must be explicit, written, and specific: who authorised you, which systems, which ports or URLs, which techniques, what time window, and what is out of scope. The client asking you to look around is not enough. A lab you own is authorised because you own it; a public website is not authorised just because it is reachable.
Scope is a technical boundary, not a feeling. Write down IP addresses, hostnames, domains, applications, accounts, and excluded systems. Include third-party services: a cloud-hosted target may have a provider whose terms forbid testing. Define whether denial-of-service, password guessing, social engineering, and data extraction are allowed. Many engagements forbid them entirely. Define stop conditions and an emergency contact before the first packet.
Unauthorised access is a crime in most countries even when nothing is damaged and even when the intent is to help. Scanning, exploiting, and credential attacks all send traffic that can disrupt a service or expose data. Good intentions are not a legal defence. If you find a vulnerability by accident, stop, do not pivot or download data, preserve what you observed, and report it through the organisation's security contact or a responsible-disclosure process.
Handle data as if it were a client's most sensitive asset, because it is. Packet captures can contain passwords, session cookies, personal messages, and medical or financial data. Password lists may contain real credentials. Reports can identify unpatched systems. Store evidence encrypted, restrict access, keep a retention period, and redact when sharing. Never paste client data into a public chat, a forum, or an AI assistant without permission.
A rules-of-engagement document protects both sides. It records scope, contacts, schedules, allowed techniques, data handling, reporting, and escalation. Both parties sign it. During the work, log deviations and ask before expanding scope. If the client asks for an extra host mid-test, get the change in writing. That habit is boring, and it is exactly what keeps a professional out of court.
03Safe Defaults, Rate Limits, and Isolation
Start smaller than you think. One target, one port, one request, low concurrency. A scan that takes ten minutes and produces a clean, explainable result is better than a flood that saturates a link and hides the evidence. Increase only after you understand the baseline and have permission for the extra load.
Rate limits and timing flags exist for a reason. Nmap -T2 is polite; --max-rate 50 caps packets per second; --scan-delay adds space between probes. Gobuster -t 10 keeps threads low; ffuf has a rate limit; hydra -t 2 avoids flooding a login service and triggering lockouts. sqlmap --level=1 --risk=1 and a single thread are sensible starting points. hashcat --runtime 60 stops a run and lets you inspect progress. tcpdump -c 50 stops after fifty packets.
Safe defaults are a starting point, not a guarantee. A default nmap scan is less intrusive than a vulnerability-script scan, but it still sends packets. A default sqlmap run may still test for injection in ways the application notices. Read what the tool does, not only what the preset is called. If a tool offers an exploitation mode, know exactly which request it will send before you enable it.
Isolate the target and the tool. Use the host-only network, a snapshot, and a dedicated evidence folder. Disable NAT during a test so a typo cannot reach the internet. If the target is a local web application, bind it to 127.0.0.1 or the lab address, not 0.0.0.0. Monitor the target's CPU, logs, and availability. Stop if it slows down, returns errors, or shows traffic you did not expect.
Have a kill switch. Know how to press Ctrl-C, stop a capture, power off a VM, or disconnect a virtual adapter. A kill switch is not a failure; it is a control. After stopping, preserve the output you already have, note why you stopped, and check whether anything outside the lab was affected. If it was, stop all work and follow your incident or disclosure process.
04Log, Save, and Clean Up
Log before you run. Start a terminal session with script -a evidence/session.log, or pipe individual commands through tee. Record the UTC time, hostname, tool version, exact command, target, and operator. A screenshot is useful, but text is searchable and diffable. A command you cannot reproduce is an anecdote, not evidence.
Save tool output in its native format. Nmap -oA writes normal, XML, and grepable files. tcpdump -w writes a pcap. sqlmap --output-dir keeps its session and logs. Gobuster -o writes results. Hydra -o writes found credentials, which are highly sensitive. Hashcat --potfile-path keeps recovered hashes separate from the main potfile. Burp Community does not save projects like the Professional edition, so export or copy the requests and responses you need.
Name evidence consistently: YYYYMMDD-host-tool-purpose. Keep a README in the folder that explains what each file is, how it was produced, and what it does not prove. Record SHA-256 checksums with sha256sum evidence/* > SHA256SUMS.txt, then restrict permissions with chmod -R go-rwx evidence. If the data is sensitive, encrypt the folder and store the key separately. Keep a copy outside the VM so a snapshot revert does not destroy it.
Clean up deliberately. Stop listeners and services you started, remove test accounts and uploaded files, close Burp and clear its temporary history if the machine is shared, and revert the VM to the pre-test snapshot. Check ss -tulpn for anything still listening. Delete temporary wordlists and captures you no longer need, subject to the retention rule. Record what you removed and when. Cleanup is part of the test, not an afterthought.
Reproducibility is the difference between a finding and a rumour. Your notes should let another tester run the same command against the same target and see the same behaviour. Include the tool version, the target, the time, the relevant configuration, and any deviation from the plan. State limitations: a scan from one network location cannot prove what another location sees. A negative result is still a result, but only if the method is clear.
05A Safe Command and Evidence Pattern
The pattern below uses one lab target and saves everything to a dated folder. The nmap command scans three common ports with version detection, caps the packet rate, and writes normal, XML, and grepable output. The rate cap is not a licence to scan faster elsewhere; it is a deliberate limit that keeps a small lab responsive and makes the result easier to interpret.
The sqlmap command tests one parameter with conservative levels, one thread, and a dedicated output directory. The hydra command uses a single synthetic username, a short lab password list, two tasks, and stop-after-first-found. Both are still intrusive in the wrong environment. Read their output, watch the target, and stop if the service slows down or the logs show errors.
The tcpdump command captures fifty packets to a pcap, filtered to one host and port. Gobuster uses ten threads and writes a result file. Hashcat runs for sixty seconds against synthetic hashes and keeps a separate potfile. Each command has an explicit input, an explicit output, and a limit. That is the shape of a safe lab command.
Burp scope is a control, not a convenience. In Burp, open Target > Scope > Add and enter http://10.10.10.20. Enable advanced scope control so the include rule is exactly that host and the exclude rule covers everything else. In Proxy > HTTP history, show only in-scope items. Do not send active scans or intrusion tools to any host outside the scope. If a request in history points to a third party, leave it alone.
Copy the pattern, not the target. Replace the address only with a host that is inside your written scope and inside the lab network. Keep the evidence folder outside the VM, record the tool versions, and revert the snapshot when the exercise is finished. A command that produced good evidence yesterday is not automatically safe today.
# Start a logged session and create an evidence folder.mkdir -p ~/lab-evidence/2026-11-01script -a ~/lab-evidence/2026-11-01/session.logdate -u# Nmap: one lab host, common ports, low rate, all output formats.nmap -sV -p 22,80,443 --max-rate 50 10.10.10.20 -oA ~/lab-evidence/2026-11-01/nmap-ubuntu# Capture only lab HTTP traffic, with a packet limit.sudo tcpdump -i eth0 -nn -c 50 -w ~/lab-evidence/2026-11-01/lab-http.pcap 'host 10.10.10.20 and port 80'# Web enumeration at a low thread count, saved to a file.gobuster dir -u http://10.10.10.20 -w wordlists/lab-dirs.txt -t 10 -o ~/lab-evidence/2026-11-01/gobuster.txt# Web injection testing with conservative levels and one thread.sqlmap -u "http://10.10.10.20/item.php?id=1" --batch --level=1 --risk=1 --threads=1 --output-dir ~/lab-evidence/2026-11-01/sqlmap# Password auditing against a synthetic lab account with two tasks.hydra -l analyst -P wordlists/lab-passwords.txt -t 2 -f ssh://10.10.10.20 -o ~/lab-evidence/2026-11-01/hydra.txt# Hash auditing against synthetic lab hashes only.hashcat -m 0 -a 0 hashes.txt wordlists/lab-words.txt --potfile-path ~/lab-evidence/2026-11-01/lab.pot --runtime 60# Record integrity, restrict access, and stop logging.sha256sum ~/lab-evidence/2026-11-01/* > ~/lab-evidence/2026-11-01/SHA256SUMS.txtchmod -R go-rwx ~/lab-evidenceexitThe ideas worth keeping.
- Read the usage line, then compose a command deliberately instead of pasting one blindly.
- Scope is a technical boundary: name targets, techniques, exclusions, contacts, and stop conditions in writing.
- Use low rate limits, one target at a time, and save evidence in the tool's native format with its version.
- Log before, during, and after: reproduction turns an observation into evidence.
Make it yours.
Type and test your code right here in the interactive workspace. Run your solution, check the output, and compare with the worked guide when ready.
Exercise 1: Parse the command
Break this command into its parts and explain what each one does: nmap -sV --max-rate 50 -p 80 -oA ~/lab-evidence/nmap 10.10.10.20. Then explain why the rate limit matters even in a small lab.
Explore a worked solution
nmap is the program. -sV probes open ports to detect service versions. --max-rate 50 limits packets per second to reduce load and make timing easier to interpret. -p 80 scopes the scan to one port, which lowers impact and speeds interpretation. -oA creates three output files with the given prefix in the evidence folder. The target is one lab host on the isolated network. The rate limit matters even in a small lab: it reduces load, makes the scan reproducible, and leaves room for the rest of your tools.Reading a command piece by piece is more useful than memorising the whole line. It also makes mistakes easier to spot before you press Enter.
Exercise 2: Rewrite an unsafe request
A friend who manages a public website asks you to 'run nmap and a quick password test' on their site. Write the exact minimum you would need before starting, and explain which parts you would still avoid and why.
Explore a worked solution
Minimum: a written scope with the exact hostname, IP, and ports, the test window, allowed techniques (for example 'service discovery only'), data handling, an emergency contact, and a stop condition. I would not run password guessing without explicit permission, because it can lock accounts and is usually out of scope. I would also confirm the host is not shared infrastructure, check third-party cloud rules, and use low rate limits and an evidence folder.Even a friendly request needs a technical boundary. Password guessing changes account state, which is a different risk than a read-only scan.
What stayed with you?
Check the ideas while they’re fresh. Your answers stay in this page and feedback appears as you go.
Keep exploring.
The official references behind this lesson, when you want a second angle or the full details.
One lesson closer.
Reading is a start. Trying it yourself makes the connection.