Compare commits
2 Commits
42e16d3ef8
...
85fab8e41b
Author | SHA1 | Date | |
---|---|---|---|
85fab8e41b | |||
bef547fae0 |
@ -31,7 +31,7 @@ $targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [
|
|||||||
<div class="ui icon input">
|
<div class="ui icon input">
|
||||||
<form id="newScanForm" class="ui form" method="get" action="scan.php">
|
<form id="newScanForm" class="ui form" method="get" action="scan.php">
|
||||||
<input class="prompt" type="text" name="targets" placeholder="Scanner un réseau..." required="" autocomplete="off" title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
|
<input class="prompt" type="text" name="targets" placeholder="Scanner un réseau..." required="" autocomplete="off" title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
|
||||||
Exemple: scanme.nmap.org microsoft.com/24 192.168.0.1 10.0-255.0-255.1-254" pattern="[a-zA-Z0-9._\/ \-]+" value="<?=$targets; ?>" />
|
Exemple: <?=$_SERVER['REMOTE_ADDR']; ?>/24 <?=$_SERVER['SERVER_NAME']; ?>" pattern="[a-zA-Z0-9._\/ \-]+" value="<?=$targets; ?>" />
|
||||||
</form>
|
</form>
|
||||||
<i class="satellite dish icon"></i>
|
<i class="satellite dish icon"></i>
|
||||||
</div>
|
</div>
|
||||||
@ -49,7 +49,8 @@ if (!file_exists($SCANS_DIR)) {
|
|||||||
}
|
}
|
||||||
foreach (scandir($SCANS_DIR) as $scan) {
|
foreach (scandir($SCANS_DIR) as $scan) {
|
||||||
if (substr($scan, -9) == '_init.xml') {
|
if (substr($scan, -9) == '_init.xml') {
|
||||||
echo "<li><a class='item' href='$SCANS_DIR/$scan'>".str_replace('!', '/', substr_replace($scan, '', -9))."</a></li>\n";
|
$targets = str_replace('!', '/', substr_replace($scan, '', -9));
|
||||||
|
echo "<li><a class='item' href='scan.php?targets=".urlencode($targets)."'>$targets</a></li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -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)
|
||||||
|
24
scan.php
24
scan.php
@ -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());
|
||||||
|
@ -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>
|
||||||
|
Reference in New Issue
Block a user