Overview
This node performs network scanning using the nmap
command-line tool. It supports multiple scan operations such as quick ping scans, discovery scans with device and port detection, fast port scans, and full port scans on specified targets like IP addresses, hosts, or network ranges.
Common scenarios for this node include:
- Quickly identifying live hosts in a network.
- Discovering devices and open ports within a subnet.
- Performing fast scans of common ports on a host.
- Conducting comprehensive port scans to audit security or troubleshoot connectivity.
For example, a user can scan their local network range 192.168.0.0/24
to find active devices and open ports, helping with network inventory or vulnerability assessment.
Properties
Name | Meaning |
---|---|
Target Network Range / Host / IP (network_range ) |
The target IP address, host, or CIDR network range to scan (e.g., 192.168.0.0/24 ). |
Options (options ) |
Collection of optional parameters: |
- Aggressive Mode (aggressive_mode ) |
Numeric value controlling scan speed/aggressiveness; default is 5 (equivalent to -T5 ). |
- Check Top Ports (top_ports ) |
Number of top ports to check during scan; default is 1000 (used as --top-ports <number> ). |
- Host Discovery (host_discovery ) |
Boolean flag to enable host discovery; if false, disables it for faster execution (-Pn ). |
- Put Result in Field (ports_field ) |
Name of the output JSON field where port scan results will be stored; default is "ports" . |
Output
The node outputs an array of items, each containing a json
object with scan results:
- For Discovery Network operation, the output includes detailed information about discovered hosts and their ports, placed under the user-defined field (default
"ports"
). - For Quick Scan Network, the output contains basic host availability data parsed from the ping scan.
- For Ports Fast Scan and All Ports Scan, the output JSON includes port scan details under the specified field name.
If binary data were involved, it would represent raw scan output or files, but this node only outputs structured JSON data parsed from the nmap
command results.
Dependencies
- Requires the
nmap
command-line tool installed and accessible on the system where n8n runs. - Needs a local sudo password credential to execute
nmap
commands with elevated privileges. - Uses internal utility classes for shell command execution and parsing
nmap
output. - No external API keys or online services are required.
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.- Invalid target network range or host input may cause scan failures or no results.
- Error messages:
- Errors thrown by the node typically originate from failed shell command execution or parsing errors.
- To resolve, verify that
nmap
is installed, the sudo password is correct, and the target input is valid. - Check system permissions to ensure the user running n8n can execute
sudo
commands.
Links and References
- Nmap Official Website
- Nmap Command Reference
- n8n Documentation on Credentials (for setting up sudo password credentials)