rescan named scan
This commit is contained in:
32
rescan.php
Normal file
32
rescan.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('display_startup_errors', '1');
|
||||
|
||||
include_once 'config.php';
|
||||
|
||||
$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");
|
||||
}
|
||||
|
||||
$path = "$SCANSDIR/$name.xml";
|
||||
if (!file_exists($path)) {
|
||||
die("Scan inconnu : $name");
|
||||
}
|
||||
|
||||
$xml = simplexml_load_file($path);
|
||||
$cmd = $xml["args"];
|
||||
if (substr( $cmd, 0, 5 ) != "nmap ") {
|
||||
die("Erreur : $path n'est pas un fichier de scan nmap");
|
||||
}
|
||||
|
||||
$cmd = $NMAP . substr($xml["args"], 4);
|
||||
|
||||
header('Content-type: text/xml');
|
||||
system("$cmd", $retcode);
|
||||
|
||||
exit();
|
Reference in New Issue
Block a user