From 4e0a723ef01ea020c51408f0e13ddac25e6c6daa Mon Sep 17 00:00:00 2001 From: adrien Date: Wed, 5 Feb 2025 21:09:14 +0100 Subject: [PATCH] rescan named scan --- config.php | 6 +- index.php | 220 +++++++++++++++++++++----------------- name.php => index.php.bak | 76 ++++++------- moi.xml | 147 +++++++++++++++++++++++++ options.php | 36 +++---- rescan.php | 2 +- scan.php | 10 +- scans/scanme.nmap.org.xml | 31 ------ stylesheets/head.xsl | 12 ++- stylesheets/hostScan.xsl | 8 +- stylesheets/lanScan.xsl | 73 +++++++------ stylesheets/nav.xsl | 150 ++++++++++++++------------ 12 files changed, 465 insertions(+), 306 deletions(-) rename name.php => index.php.bak (51%) create mode 100644 moi.xml delete mode 100644 scans/scanme.nmap.org.xml diff --git a/config.php b/config.php index 59fb2b8..a251ee7 100644 --- a/config.php +++ b/config.php @@ -7,6 +7,6 @@ $STYLESHEETSDIR = "stylesheets"; $NMAP = "sudo nmap"; # nmap command, E.g. 'nmap', 'sudo nmap' for root privileges or '/usr/bin/nmap' if not in PATH $DATADIR = "."; $SCRIPTARGSFILE = "script-args.ini"; -$LANSCANOPTIONS = "-PSmicrosoft-ds -F -T5 --datadir '$DATADIR' --script http-info,smb-shares-size --script-args-file '$SCRIPTARGSFILE' -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/lanScan.xsl"; -$HOSTSCANOPTIONS = "-A -T5 --datadir '$DATADIR' --script http-info,smb-shares-size --script-args-file '$SCRIPTARGSFILE' -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/hostScan.xsl"; -$CUSTOMSCANOPTIONS = "--datadir '$DATADIR' --script-args-file '$SCRIPTARGSFILE' -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/lanScan.xsl"; \ No newline at end of file +$LANSCANOPTIONS = "-PSmicrosoft-ds -F -T5 --datadir '$DATADIR' --script http-info,smb-shares-size --script-args-file '$SCRIPTARGSFILE'"; +$HOSTSCANOPTIONS = "-A -T5 --datadir '$DATADIR' --script http-info,smb-shares-size --script-args-file '$SCRIPTARGSFILE'"; +$CUSTOMSCANOPTIONS = "--datadir '$DATADIR' --script-args-file '$SCRIPTARGSFILE'"; \ No newline at end of file diff --git a/index.php b/index.php index c1b0c8a..24c0e39 100644 --- a/index.php +++ b/index.php @@ -2,114 +2,138 @@ - - - lanScan - - - - - + .logo { + margin-right: 0 !important; + } + + - + -
-
- +
+
+ - -
- -
Erreur
-

-
- - -
-
-

Découvrir ou superviser un réseau

-
- + +
+ +
Erreur
+

-
- -
- Options avancées - + + +
+
+

Découvrir ou superviser un réseau

+
+
+ +
+
+
+ +
+ +
+
+
+ +
+ Options avancées +
+
+ + +
+
+
Scans enregistrés
+
+ + + \n"; + } + } + ?> + +
$nameRescanner
+
+
+
+ +
-
- - - + + - scanForm.onsubmit = function(event) { - if (this.checkValidity()) { - scanForm.classList.add("loading") - $.toast({ - title: 'Scan en cours...', - message: 'Merci de patienter', - class: 'info', - showIcon: 'satellite dish', - displayTime: 0, - closeIcon: true, - position: 'bottom right', - }) - return true - } else { - event.preventDefault() - this.reportValidity() - } - } - - - + -
+
- @@ -44,58 +44,52 @@

Découvrir ou superviser un réseau

-
- -
-
-
- -
- -
+
-
- Options avancées
+ Options avancées - - -
-
-
Scans enregistrés
-
- - - \n"; - } - } - } - ?> - -
$nameRescanner
-
- - - - - + + + + +
+
+ + + + + + + + + +
+
+ + + + + + + + + +
+
+ + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + diff --git a/options.php b/options.php index 7aeea6b..26c78ee 100755 --- a/options.php +++ b/options.php @@ -434,11 +434,11 @@ Exemples: /24 10.
@@ -453,13 +453,13 @@ Exemples: /24 10. @@ -475,13 +475,13 @@ Exemples: /24 10. @@ -506,11 +506,11 @@ Exemples: /24 10.
@@ -527,11 +527,11 @@ Exemples: /24 10.
@@ -546,13 +546,13 @@ Exemples: /24 10. diff --git a/rescan.php b/rescan.php index 42dfd67..2fd0ce1 100644 --- a/rescan.php +++ b/rescan.php @@ -10,7 +10,7 @@ $fileNameRegex = '/^[^<>:\/|?]+$/'; $name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex], "flags" => FILTER_NULL_ON_FAILURE]); if (!$name) { - die("Paramètre manquant : name"); + die("Paramètre manquant ou incorrect : name"); } $path = "$SCANSDIR/$name.xml"; diff --git a/scan.php b/scan.php index b809bc6..db0be00 100644 --- a/scan.php +++ b/scan.php @@ -9,13 +9,13 @@ $name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, ['options' => [' $lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]); if ($lan) { - $cmd = "$NMAP $LANSCANOPTIONS $lan"; + $cmd = "$NMAP $LANSCANOPTIONS --stylesheet '$BASEDIR/$STYLESHEETSDIR/lanScan.xsl?name=$name&' -oX - $lan"; $filename = str_replace("/", "!", $lan); } $host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]); if ($host) { - $cmd = "$NMAP $HOSTSCANOPTIONS $host"; + $cmd = "$NMAP $HOSTSCANOPTIONS --stylesheet '$BASEDIR/$STYLESHEETSDIR/hostScan.xsl?name=$name&' -oX - $host"; $filename = str_replace("/", "!", $host); } @@ -145,7 +145,7 @@ if ($targets) { } } - $cmd = "$NMAP$options $CUSTOMSCANOPTIONS $targets"; + $cmd = "$NMAP$options $CUSTOMSCANOPTIONS --stylesheet $BASEDIR/$STYLESHEETSDIR/lanScan.xsl?name=$name&' -oX - $targets"; $filename = str_replace("/", "!", $targets); } @@ -153,8 +153,8 @@ if ($cmd) { if ($name) { if (!file_exists($SCANSDIR)) mkdir($SCANSDIR); - $path = "$SCANSDIR/" . escapeshellarg($name) . ".xml"; - $cmd .= " | tee '$path'"; + $path = "$SCANSDIR/$name.xml"; + $cmd .= " | tee " .escapeshellarg($path); } header('Content-type: text/xml'); diff --git a/scans/scanme.nmap.org.xml b/scans/scanme.nmap.org.xml deleted file mode 100644 index 59dad30..0000000 --- a/scans/scanme.nmap.org.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - diff --git a/stylesheets/head.xsl b/stylesheets/head.xsl index 25d3bdf..f15761d 100644 --- a/stylesheets/head.xsl +++ b/stylesheets/head.xsl @@ -4,12 +4,22 @@ + - lanScan - <xsl:value-of select="$targets" /> + <title> + <xsl:text>lanScan - </xsl:text> + <xsl:choose> + <xsl:when test="$name"> + <xsl:value-of select="$name" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$targets" /> + </xsl:otherwise> + </xsl:choose> diff --git a/stylesheets/hostScan.xsl b/stylesheets/hostScan.xsl index 3c747db..349552f 100644 --- a/stylesheets/hostScan.xsl +++ b/stylesheets/hostScan.xsl @@ -11,17 +11,19 @@ - + + - + - + + diff --git a/stylesheets/lanScan.xsl b/stylesheets/lanScan.xsl index 3b13075..f8f6e5e 100644 --- a/stylesheets/lanScan.xsl +++ b/stylesheets/lanScan.xsl @@ -1,8 +1,6 @@ - + @@ -13,21 +11,19 @@ - + + - - - + + + - + + @@ -36,12 +32,21 @@
-

- +

+ + + +
+ +
+
+ + + +

- +
@@ -53,8 +58,7 @@ - + @@ -89,14 +93,11 @@ $('.ui.dropdown').dropdown() - - - - - + + + + + @@ -106,7 +107,7 @@ $('.ui.dropdown').dropdown() - + positive @@ -119,7 +120,7 @@ $('.ui.dropdown').dropdown()
ui mini circular label - + green red @@ -127,7 +128,9 @@ $('.ui.dropdown').dropdown()
-
down
+ +
down
+
diff --git a/stylesheets/nav.xsl b/stylesheets/nav.xsl index 78b28cc..81fa988 100644 --- a/stylesheets/nav.xsl +++ b/stylesheets/nav.xsl @@ -1,79 +1,77 @@ - + + + + + - - +refreshLink.onclick = function(event) { + refreshLink.getElementsByTagName('i')[0].className = 'loading spinner icon' + $.toast({ + title : 'Scan en cours...', + message : 'Merci de patienter', + class : 'info', + showIcon : 'satellite dish', + displayTime: 0, + closeIcon : true, + position : 'bottom right', + }) +} + + \ No newline at end of file
Etat
@@ -138,16 +141,15 @@ $('.ui.dropdown').dropdown() - . + +. - + @@ -157,7 +159,8 @@ $('.ui.dropdown').dropdown() - scan.php?host= + scan.php?host= +