This repository has been archived on 2025-02-13. You can view files and clone it, but cannot push or open issues or pull requests.
lanScan2/discover
2023-04-29 08:25:51 +02:00

25 lines
653 B
Bash
Executable File

#!/usr/bin/env bash
###
#
# Scan un réseau avec nmap pour créer un fichier de configuration
# Usage : ./discover <reseau> avec reseau en notation CIDR XXX.XXX.XXX.XXX/XX
#
###
if [ "$#" -ne 1 ]; then
echo -e "Usage : ./discover <CIDR>\navec <CIDR> l'adresse réseau en notation CIDR (XXX.XXX.XXX.XXX/XX)" >&2
exit 1
fi
pushd "$(dirname -- "$0")" > /dev/null
network="$1"
site="${network/\//_}"
mkdir -p "scans"
nmap -F -oX "scans/$site.xml" $network
mkdir -p "configs"
xsltproc --stringparam network "$network" to_config.xsl "scans/$site.xml" > "configs/$site.yaml"
php to_XML.php "configs/$site.yaml" > "site/$site.xml"
popd > /dev/null