Nmap Scan icon

Nmap Scan

Scan with nmap command

Overview

This node performs network scanning using the nmap command-line tool. It supports multiple scan operations, including a quick ping scan of a network range, discovery scans with port and device detection, fast port scans on hosts, and full port scans on hosts. This node is useful for network administrators and security professionals who want to automate network reconnaissance and port scanning tasks within n8n workflows.

Practical examples:

  • Quickly identify live hosts in a subnet using the "Quick Scan Network" operation.
  • Discover open ports and devices on a network with the "Discovery Network" operation.
  • Perform a fast scan of common ports on a specific host.
  • Conduct a comprehensive scan of all ports on a host to detect services running on non-standard ports.

Properties

Name Meaning
Operation The type of scan to perform. Options: Quick Scan Network, Discovery Network, Ports Fast Scan, All Ports Scan.
Target Network Range / Host / IP The target IP address, host, or network range (e.g., 192.168.0.0/24) to scan.
Options Collection of additional options:
- Aggressive Mode Numeric value (default 5) to enable faster execution mode (-T5).
- Check Top Ports Number of top ports to check (default 1000).
- Host Discovery Boolean to enable host discovery; if disabled, uses faster no-host-discovery mode (-Pn).
- Put Result in Field Name of the output JSON field where port scan results will be stored (default "ports").

Output

The node outputs an array of items, each containing a json object with scan results. The structure depends on the selected operation:

  • Quick Scan Network: Outputs one item per detected host with basic information parsed from the quick ping scan.
  • Discovery Network: Outputs one item per host with detailed discovery data, including open ports placed under the user-defined field (default "ports").
  • Ports Fast Scan and All Ports Scan: Outputs a single item with the port scan results stored in the specified field (default "ports").

No binary data output is produced by this node.

Dependencies

  • Requires the nmap command-line tool installed and accessible on the system where n8n runs.
  • Requires sudo privileges with password authentication to execute nmap commands with elevated permissions.
  • The node expects a credential providing the local sudo password to run commands securely.
  • Uses internal utility classes for shell command execution and parsing nmap output.

Troubleshooting

  • Common issues:

    • Missing or incorrect sudo password credential will cause command execution failure.
    • nmap not installed or not in PATH will result in command not found errors.
    • Incorrect target network range or host input may lead to no results or errors.
    • Firewall or network restrictions might block scanning attempts.
  • Error messages:

    • Errors thrown during command execution are wrapped as node operation errors with the original error message.
    • If the node fails with permission denied, verify that the provided sudo password is correct and that the user has sudo rights.
    • Parsing errors may occur if nmap output format changes or unexpected output is received.

Links and References

Discussion