Resuming Interrupted Scan Only With Remaining Ports
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.6k
- Forks
- 2.9k
- PR merge metrics
- No merged PRs in 30d
Description
TL;DR
Please add support for continuing to scan the remaining ports of interrupted scans (e.g. of a single target host) after an unexpected interruption (e.g. network loss, system reboot, or manual interruption).
Problem
Currently, --resume only works when Nmap has completely finished scanning at least one target in a multi-host scan. This only continues to scan the other IP addresses, but not remaining ports, if, for example, a full port scan was launched, but only 80% of these ports were successfully scanned. If a scan is interrupted while scanning all ports, it cannot be resumed, even though a significant portion of the port scan may already have completed.
This is especially inconvenient for long-running scans, such as:
- Full TCP port scans (-p-)
- UDP scans
- Scans over slow or unreliable network connections
In these situations, an interruption requires restarting the entire scan from the beginning, wasting considerable time.
Proposed Enhancement
Extend the option --resume so it can continue an interrupted scan and scan only the remaining ports of an IP address.
For example, Nmap could periodically save its port scan progress to the XML or GNMAP files including:
Target host:
- List of ports already scanned
- Scan state for each port
After an interruption, nmap --resume <output file> could continue with only the remaining ports instead of restarting the entire scan.
Benefits
- Saves significant time for long-running scans.
- Makes Nmap more resilient to temporary network failures.
- Reduces unnecessary network traffic caused by repeating completed work.
- Improves usability for remote scans over unstable connections.
- Provides more consistent behavior between single-target and multi-target scans.
Thoughts
Since Nmap already supports resuming scans across multiple targets after a completed host, much of the underlying resume infrastructure already exists. Extending this capability to preserve per-host progress would make the feature more generally useful without changing existing workflows. This shouldn't be too difficult technically, as just adding each successfully scanned port along with the status to a list would do the job. When resuming, read the least and calculate the remaining ports specificed in the -p parameter.
Thank you for considering this enhancement.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files, tests, or entry points are identified in the issue. Start by tracing Nmap's existing --resume implementation and its XML/GNMAP output handling; define how per-host port state would be persisted and restored. Done means an interrupted scan resumes only unscanned ports, including single-target and partial-port cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100