mirror of
https://github.com/lopes/netbox-scanner.git
synced 2025-07-05 13:04:40 +02:00
29 lines
800 B
Bash
29 lines
800 B
Bash
#!/bin/sh
|
|
#
|
|
# This is just an example.
|
|
#
|
|
# Since scanning many networks can produce huge XML files,
|
|
# the idea is to create one XML file per network, then
|
|
# use all of them as input to nbs.nmap.Nmap().
|
|
#
|
|
# If you scan few networks with few hosts or if you just
|
|
# want to experiment, feel free to use the `-iL` option of
|
|
# Nmap, passing a list of all networks and hosts to be
|
|
# scanned.
|
|
#
|
|
# For the purpose of this example, assume that netbox-scanner
|
|
# is configured to use the same directory of this script
|
|
# to look for XML files.
|
|
##
|
|
|
|
NETWORKS = "10.1.2.3/24 10.2.3.4/32 192.168.0.0/19"
|
|
TODAY="$(date +%d.%m.%yT%H:%M:%S%Z)"
|
|
|
|
for net in $NETWORKS; do
|
|
nmap -T4 -O -F --host-timeout 30s -oX nmap-"$net".xml
|
|
done
|
|
|
|
python ../netbox-scanner.py nmap
|
|
tar -czvf nmap-"$TODAY".tar.gz *.xml
|
|
rm -rf *.xml
|