inclure lanScan options in presets
This commit is contained in:
38
scan.php
38
scan.php
@ -4,19 +4,21 @@ include_once 'filter_inputs.php';
|
||||
|
||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||
|
||||
$command = ($sudo? "sudo " : "") . "nmap";
|
||||
foreach ($args as $arg => $value) {
|
||||
if (is_null($value)) {
|
||||
http_response_code(400);
|
||||
$errorMessage = "Valeur incorecte pour le paramètre <var>$arg</var> : " . filter_input(INPUT_GET, $arg, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
include_once "options.php";
|
||||
die();
|
||||
} else if ($value) {
|
||||
if ($value === true) {
|
||||
$command .= " $arg";
|
||||
} else {
|
||||
if (substr($arg, 0, 2) == '--') $command .= " $arg $value";
|
||||
else $command .= " $arg$value";
|
||||
$command = ($options["sudo"]?? false ? "sudo " : "") . "nmap";
|
||||
foreach ($options as $arg => $value) {
|
||||
if (substr($arg, 0, 1) == '-') {
|
||||
if (is_null($value)) {
|
||||
http_response_code(400);
|
||||
$errorMessage = "Valeur incorecte pour le paramètre <var>$arg</var> : " . filter_input(INPUT_GET, $arg, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
include_once "options.php";
|
||||
die();
|
||||
} else if ($value) {
|
||||
if ($value === true) {
|
||||
$command .= " $arg";
|
||||
} else {
|
||||
if (substr($arg, 0, 2) == '--') $command .= " $arg $value";
|
||||
else $command .= " $arg$value";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -38,13 +40,13 @@ $xml = new DOMDocument();
|
||||
$xml->load($tempPath);
|
||||
`rm "$tempPath"`;
|
||||
|
||||
$saveAsURL = $saveAs? "$BASEDIR/$SCANSDIR/$saveAs.xml" : "";
|
||||
$saveAsURL = isset($options["saveAs"])? "$BASEDIR/$SCANSDIR/{$options["saveAs"]}.xml" : "";
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='savedAs' value='".htmlentities($saveAsURL, ENT_QUOTES)."'"), $xml->documentElement);
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value='".htmlentities($compareWith, ENT_QUOTES)."'"), $xml->documentElement);
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='refreshPeriod' value='".htmlentities($refreshPeriod, ENT_QUOTES)."'"), $xml->documentElement);
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value='".htmlentities($options["compareWith"] ?? "", ENT_QUOTES)."'"), $xml->documentElement);
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='refreshPeriod' value='".htmlentities($options["refreshPeriod"] ?? "", ENT_QUOTES)."'"), $xml->documentElement);
|
||||
|
||||
if ($saveAs) {
|
||||
$path = "$SCANSDIR/$saveAs.xml";
|
||||
if (isset($options["saveAs"])) {
|
||||
$path = "$SCANSDIR/{$options["saveAs"]}.xml";
|
||||
$xml->save($path);
|
||||
|
||||
header("Location: $path");
|
||||
|
Reference in New Issue
Block a user