Overview
This node performs network scanning using the nmap
command-line tool. It supports multiple scan operations such as quick network ping scans, discovery scans with device and port detection, fast port scans, and full port scans on specified hosts or IP ranges.
Typical use cases include:
- Quickly identifying live hosts in a network.
- Discovering devices and open ports for security auditing.
- Performing detailed port scans to assess network exposure.
- Automating network reconnaissance tasks within workflows.
For example, you can scan an entire subnet to find active devices and then perform a full port scan on a specific host to identify all open ports.
Properties
Name | Meaning |
---|---|
Target Network Range / Host / IP (network_range ) |
The target IP address, host, or network range (CIDR) to scan, e.g., 192.168.0.0/24 . |
Options (options ) |
Collection of optional parameters: |
- Aggressive Mode (aggressive_mode ) |
Numeric value controlling scan speed; higher values mean faster execution (e.g., 5). |
- Check Top Ports (top_ports ) |
Number of top commonly used ports to check during the scan (e.g., 1000). |
- Host Discovery (host_discovery ) |
Boolean flag to enable host discovery; disabling it speeds up scan by skipping ping (-Pn). |
- Put Result in Field (ports_field ) |
Name of the output JSON field where scan results will be stored (default: "ports"). |
Operation (operation ) |
Type of scan to perform: |
- Quick Scan Network: Fast ping scan to detect live hosts (-sn). | |
- Discovery Network: SYN scan with host and port discovery (-sS). | |
- Ports Fast Scan: Fast scan of common ports (-F). | |
- All Ports Scan: Full scan of all ports (-p-). |
Output
The node outputs an array of items, each containing a json
object with scan results:
- For Quick Scan Network, each item represents a detected host with basic information parsed from the ping scan.
- For Discovery Network, each item contains detailed host and port information under a user-defined field (default
"ports"
). - For Ports Fast Scan and All Ports Scan, the scan results (open ports and related data) are placed inside the specified output field (default
"ports"
) within the original input item's JSON.
No binary data 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 certain
nmap
commands. - Needs 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 inaccessible
nmap
installation will cause command failures. - Incorrect sudo password or insufficient permissions will prevent command execution.
- Invalid target network range or malformed IP addresses may lead to errors or empty results.
- Network firewalls or restrictions might block scan packets, causing incomplete data.
- Missing or inaccessible
Error messages:
- Errors thrown during command execution typically indicate permission problems or invalid parameters.
- Parsing errors may occur if
nmap
output format changes or unexpected output is received.
Resolutions:
- Ensure
nmap
is installed and available in the system PATH. - Verify the provided sudo password is correct and has necessary privileges.
- Validate the target network/IP inputs before running scans.
- Adjust firewall settings or run scans from a permitted network location.
- Ensure
Links and References
- Nmap Official Website
- Nmap Command Reference
- n8n Documentation (for general node usage and credentials setup)