Resuming Interrupted Scan Only With Remaining Ports

Open
#3,403 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
c
Domain
networking

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.

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.

Dominant language
C
Stars
14k
Forks
3k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nmap/nmap

All issues in nmap/nmap

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.