rescan named scan

This commit is contained in:
2025-02-05 18:37:33 +01:00
parent 566a5a4c67
commit 72396e5071
5 changed files with 1031 additions and 870 deletions

32
rescan.php Normal file
View 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();