Skip to content

Resuming Interrupted Scan Only With Remaining Ports #3403

Description

@mgierer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions