lanScan/discover
2023-04-29 07:10:06 +02:00

20 lines
527 B
Bash
Executable File

#!/usr/bin/env bash
###
#
# Scan un réseau avec nmap pour créer un fichier de configuration
# Usage : ./discover <network> avec network en notation CIDR XXX.XXX.XXX.XXX/XX
#
###
DIR="$(dirname -- "$0")"
network="$1"
filename="${network/\//_}"
mkdir -p "$DIR/scans"
nmap -F -oX "$DIR/scans/$filename.xml" $network
mkdir -p "$DIR/configs"
xsltproc --stringparam network "$network" to_config.xsl "$DIR/scans/$filename.xml" > "$DIR/configs/$filename.yaml"
php to_XML.php "$DIR/configs/$filename.yaml" > "$DIR/site/$site.xml"