Starting in v24.1, Network Discovery supports the ability to upload the discovery output
file generated from NMAP to Network Discovery via the PUT
…/upload_discovery_file
API (Upload File
resource). The
output file is generated in XML and converted to JSON format. The extracted information
is returned to BAM and reconciled with existing BAM data.
NMAP is an open source command-line tool used to scan and detect hosts in a network and extract information from them. For details on the API endpoint and parameters, see the in-product Swagger documentation.
The following is an example of the NMAP
command:
sudo nmap \
-vv \
-sU \
-A \
-p 161 \
--script "snmp-info,snmp-interfaces,snmp-netstat" \
--script-args "newtargets,snmp.version=v1,snmp-interfaces.host=<target-IP>" \
--traceroute \
-oX "${OUTPUT_FILE_BASENAME}.xml" \
-oG "${OUTPUT_FILE_BASENAME}.grep.txt" \
-oN "${OUTPUT_FILE_BASENAME}.normal.txt" \
-iL "${THIS}/input-subnets.txt"
In the above example:
-vv
: Enables extra verbose output.Tip: If you'd like the default verbose output instead, use-v
.-sU
: Performs a UDP scan.-p 161
: Scans port 161, used by SNMP.-oX
: NMAP prints the scan output in XML format to the specified output file.-oG
: NMAP prints the scan output in a greppable format to the specified output file.-oN
: NMAP prints the scan output in plain text format to the specified output file.-iL
: Scans subnets listed in the specified input file.- The input file (input-subnets.txt in this example) has the
following format:
subnet-1 subnet-2 subnet-3 subnet-4
For example:192.168.60.0/24 192.168.61.0/24 192.168.62.0/24 192.168.63.0/24