From 85fab8e41b53bcb4e526c8a3d90b7d58d1623c0f Mon Sep 17 00:00:00 2001 From: adrien <adrien@malingrey.fr> Date: Mon, 7 Oct 2024 03:38:29 +0200 Subject: [PATCH] variable rename --- nmap/scripts/smb-shares-size.nse | 2 +- scan.php | 24 +++++++++++++----------- stylesheet.xsl | 3 ++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/nmap/scripts/smb-shares-size.nse b/nmap/scripts/smb-shares-size.nse index ab6b5a2..d40a43e 100644 --- a/nmap/scripts/smb-shares-size.nse +++ b/nmap/scripts/smb-shares-size.nse @@ -27,7 +27,7 @@ categories = {"discovery", "intrusive"} author = "Adrien Malingrey" license = "Same as Nmap--See https://nmap.org/book/man-legal.html" -portrule = shortport.service({"microsoft-ds", "netbios-ssn"}) +portrule = shortport.service({"microsoft-ds", "netbios-ssn", "smb"}) action = function(host) diff --git a/scan.php b/scan.php index 2409779..0b5c89f 100755 --- a/scan.php +++ b/scan.php @@ -17,34 +17,36 @@ $dir = $SCANS_DIR; if (!file_exists($SCANS_DIR)) { mkdir($SCANS_DIR); } -$firstPath = "$SCANS_DIR/".str_replace('/', '!', $targets).'_init.xml'; -if (file_exists($firstPath)) { - $path = ("$SCANS_DIR/".str_replace('/', '!', $targets).'_current.xml'); +$initPath = "$SCANS_DIR/".str_replace('/', '!', $targets).'_init.xml'; +if (file_exists($initPath)) { + $currentPath = ("$SCANS_DIR/".str_replace('/', '!', $targets).'_current.xml'); } else { - $path = $firstPath; - $firstPath = ''; + $currentPath = $initPath; + $initPath = ''; } $stylesheetUrl = "$basedir/stylesheet.xsl"; -$command = "NMAPDIR=./nmap nmap $NMAP_OPTIONS -oX ".escapeshellarg($path)." --stylesheet $basedir/stylesheet.xsl $targets"; +$command = "NMAPDIR=./nmap nmap $NMAP_OPTIONS -oX ".escapeshellarg($currentPath)." --stylesheet $basedir/stylesheet.xsl $targets"; exec($command, $output, $retval); -if (!file_exists($path)) { +if (!file_exists($currentPath)) { http_response_code(500); exit(implode("<br/>\n", $output)); } // Add params $xml = new DOMDocument(); -$xml->load($path); +$xml->load($currentPath); $processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='targets' value='$targets'"); $xml->insertBefore($processingInstruction, $xml->documentElement); $processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='basedir' value='$basedir'"); $xml->insertBefore($processingInstruction, $xml->documentElement); -$processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='compareWith' value='$firstPath'"); +$processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='compareWith' value='$initPath'"); $xml->insertBefore($processingInstruction, $xml->documentElement); -$xml->save($path); +$xml->save($currentPath); -header('Location: '.$path); +//header('Location: '.$currentPath); +header('Content-type: text/xml'); +exit($xml->saveXML()); diff --git a/stylesheet.xsl b/stylesheet.xsl index cff05b7..32254c7 100755 --- a/stylesheet.xsl +++ b/stylesheet.xsl @@ -14,6 +14,7 @@ <html lang="fr"> <head> <meta charset="utf-8" /> + <meta http-equiv="refresh" content="60"/> <title>lanScan - <xsl:value-of select="$targets" /> </title> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" /> @@ -123,7 +124,7 @@ Exemple: scanme.nmap.org microsoft.com/24 192.168.0.1 10.0-255.0-255.1-254" patt </div> </xsl:if> - <table id="scanResultsTable" style="width:100%" role="grid" class="ui sortable table"> + <table id="scanResultsTable" style="width:100%" role="grid" class="ui sortable small table"> <thead> <tr> <th>Etat</th>