Run an Authorized Nmap Asset Discovery
Before you begin
- Applies to:Asset inventory on networks the owner has explicitly approved for assessment.
- Where to start:Start from the approved assessment host and confirm its network vantage point with the owner.
- What you need:Have the permitted target list, scan window, rate limits, and escalation contact.
Guide tools
An accurate asset inventory helps defenders find unknown devices and confirm that expected services are exposed. Nmap can support that work, but even routine scans create network traffic and can trigger monitoring or affect fragile systems.
Use these commands only for networks and systems you are explicitly authorized to assess. Confirm the target list, scan window, rate limits, and escalation contact with the network owner before starting.
Set the Target from the Written Scope
AuthorizationReplace the documentation-only example address below with the exact approved CIDR or host list from the engagement record. Keep scope and the unique, private result directory in variables so each command uses the same reviewed target and does not overwrite an earlier scan. Keep this terminal open for the remaining steps. Do not widen the range to adjacent networks.
# Documentation range only: replace after confirming written authorization.TARGET_CIDR="192.0.2.0/24"umask 077RUN_DIR="nmap-results-$(date -u +%Y%m%dT%H%M%SZ)-$$"mkdir -m 0700 "$RUN_DIR" || { echo 'Result directory already exists; choose a new path.' >&2; exit 1; }printf 'Approved target: %s\n' "$TARGET_CIDR"nmap --versionβ― Illustrative Output (Results Vary)
Approved target: 192.0.2.0/24Nmap version 7.x ...Run Host Discovery and Save the Results
Low-Impact DiscoveryA host-discovery scan checks which addresses respond using probes selected by Nmap and the privileges available. Firewalls can suppress replies, so an empty result does not prove that an address is unused. Use a low scan rate and the approved maintenance window.
nmap -sn -T2 --reason -oA "$RUN_DIR/discovery" "$TARGET_CIDR" || exit 1β― Illustrative Output (Results Vary)
Nmap scan report for host-a.example (192.0.2.15)Host is up, received echo-reply ...Nmap done: 256 IP addresses ...
Figure 1: A low-rate Nmap host-discovery run reports responding hosts only within the documentation range.
Limit Service Detection to Approved Hosts
Service InventoryChoose only the hosts and ports listed in the approved plan. This example checks the top 20 ports with a TCP connect scan and light version detection. It does not run scripts or exploit checks; coordinate separately before any broader assessment.
# Example documentation address; replace with an approved host.TARGET_HOST="192.0.2.15"nmap -sT -sV --version-light --top-ports 20 -T2 \ --reason -oA "$RUN_DIR/service-review" "$TARGET_HOST" || exit 1β― Illustrative Output (Results Vary)
PORT STATE SERVICE VERSION22/tcp open ssh OpenSSH ...443/tcp open https ...Compare Findings with the Asset Register
Defensive Follow-UpKeep all three output formats with the scan record. Reconcile responding addresses and observed services against the CMDB or cloud inventory, then assign unknown assets and unexpected listeners to the responsible team for validation.
ls -l "$RUN_DIR"/discovery.nmap "$RUN_DIR"/discovery.gnmap "$RUN_DIR"/discovery.xml \ "$RUN_DIR"/service-review.nmap "$RUN_DIR"/service-review.gnmap "$RUN_DIR"/service-review.xmlsha256sum -- "$RUN_DIR"/discovery.* "$RUN_DIR"/service-review.* > "$RUN_DIR/scan-output.sha256" || exit 1sha256sum --check "$RUN_DIR/scan-output.sha256"β― Illustrative Output (Results Vary)
nmap-results-20261005T101500Z-12345/discovery.nmap: OKnmap-results-20261005T101500Z-12345/discovery.gnmap: OKnmap-results-20261005T101500Z-12345/discovery.xml: OKnmap-results-20261005T101500Z-12345/service-review.nmap: OKnmap-results-20261005T101500Z-12345/service-review.gnmap: OKnmap-results-20261005T101500Z-12345/service-review.xml: OKYour feedback keeps these production procedures accurate and battle-tested.