variable rename

This commit is contained in:
Adrien MALINGREY 2024-10-07 03:38:29 +02:00
parent bef547fae0
commit 85fab8e41b
3 changed files with 16 additions and 13 deletions

View File

@ -27,7 +27,7 @@ categories = {"discovery", "intrusive"}
author = "Adrien Malingrey" author = "Adrien Malingrey"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html" 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) action = function(host)

View File

@ -17,34 +17,36 @@ $dir = $SCANS_DIR;
if (!file_exists($SCANS_DIR)) { if (!file_exists($SCANS_DIR)) {
mkdir($SCANS_DIR); mkdir($SCANS_DIR);
} }
$firstPath = "$SCANS_DIR/".str_replace('/', '!', $targets).'_init.xml'; $initPath = "$SCANS_DIR/".str_replace('/', '!', $targets).'_init.xml';
if (file_exists($firstPath)) { if (file_exists($initPath)) {
$path = ("$SCANS_DIR/".str_replace('/', '!', $targets).'_current.xml'); $currentPath = ("$SCANS_DIR/".str_replace('/', '!', $targets).'_current.xml');
} else { } else {
$path = $firstPath; $currentPath = $initPath;
$firstPath = ''; $initPath = '';
} }
$stylesheetUrl = "$basedir/stylesheet.xsl"; $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); exec($command, $output, $retval);
if (!file_exists($path)) { if (!file_exists($currentPath)) {
http_response_code(500); http_response_code(500);
exit(implode("<br/>\n", $output)); exit(implode("<br/>\n", $output));
} }
// Add params // Add params
$xml = new DOMDocument(); $xml = new DOMDocument();
$xml->load($path); $xml->load($currentPath);
$processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='targets' value='$targets'"); $processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='targets' value='$targets'");
$xml->insertBefore($processingInstruction, $xml->documentElement); $xml->insertBefore($processingInstruction, $xml->documentElement);
$processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='basedir' value='$basedir'"); $processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='basedir' value='$basedir'");
$xml->insertBefore($processingInstruction, $xml->documentElement); $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->insertBefore($processingInstruction, $xml->documentElement);
$xml->save($path); $xml->save($currentPath);
header('Location: '.$path); //header('Location: '.$currentPath);
header('Content-type: text/xml');
exit($xml->saveXML());

View File

@ -14,6 +14,7 @@
<html lang="fr"> <html lang="fr">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta http-equiv="refresh" content="60"/>
<title>lanScan - <xsl:value-of select="$targets" /> <title>lanScan - <xsl:value-of select="$targets" />
</title> </title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" /> <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> </div>
</xsl:if> </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> <thead>
<tr> <tr>
<th>Etat</th> <th>Etat</th>