update sample to use networks.txt by default

This commit is contained in:
bile0026 2020-11-23 20:34:31 -06:00
parent 354af84dbd
commit 95fbba2c79

View File

@ -11,15 +11,29 @@
# Nmap, passing a list of all networks and hosts to be
# scanned.
#
# If you have a large number of networks, use the mapfile option.
# In order to use mapfile, populate your networks, one per line,
# in a file called networks.txt.
#
# If you have a small number of networks, comment out the mapfile
# lines, and uncomment the "small array" line.
#
# 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="192.168.3.0/24 192.168.252.0/24"
# mapfile
declare -a NETWORKS
mapfile -t NETWORKS < samples/networks.txt
# small array
#NETWORKS="192.168.3.0/24 192.168.252.0/24"
TODAY="$(date +%d.%m.%yT%H:%M:%S%Z)"
for net in $NETWORKS; do
for net in "${NETWORKS[@]}"; do
NETNAME=$(echo $net | tr -s '/' '-')
#nmap "$net" -T4 -O -F --host-timeout 30s -oX nmap-"$NETNAME".xml
nmap "$net" -T4 -sn --host-timeout 30s -oX nmap-"$NETNAME".xml