Compare commits

..

2 Commits

Author SHA1 Message Date
baef7123b8 option -T 2024-10-20 01:56:33 +02:00
f14062fda5 rename var 2024-10-20 01:32:54 +02:00
5 changed files with 40 additions and 39 deletions

View File

@ -10,8 +10,8 @@ $presets = [
"default" => [
'-PS' => 'microsoft-ds',
'-F' => true,
'-T5' => true,
'--stylesheet' => "$BASEDIR/xslt/hostsTable.xsl",
'-T' => 5,
'--stylesheet' => "$BASEDIR/templates/hostsTable.xsl",
'refreshPeriod' => 60,
'sudo' => false,
],
@ -19,10 +19,11 @@ $presets = [
'-Pn' => true,
'-F' => true,
'-sV' => true,
'-T5' => true,
'--stylesheet' => "$BASEDIR/xslt/servicesTable.xsl",
'-T' => 5,
'--script' => "http-info,smb-shares-size",
'--stylesheet' => "$BASEDIR/templates/servicesTable.xsl",
'refreshPeriod' => 60,
'sudo' => false,
'sudo' => true,
],
];
```

View File

@ -10,7 +10,7 @@ $presets = [
"default" => [
'-PS' => 'microsoft-ds',
'-F' => true,
'-T5' => true,
'-T' => 5,
'--stylesheet' => "$BASEDIR/templates/hostsTable.xsl",
'refreshPeriod' => 60,
'sudo' => false,
@ -19,7 +19,7 @@ $presets = [
'-Pn' => true,
'-F' => true,
'-sV' => true,
'-T5' => true,
'-T' => 5,
'--script' => "http-info,smb-shares-size",
'--stylesheet' => "$BASEDIR/templates/servicesTable.xsl",
'refreshPeriod' => 60,

View File

@ -73,12 +73,7 @@ if ($preset && isset($presets[$preset])) {
'--osscan-guess' => FILTER_VALIDATE_BOOLEAN,
'--max-os-tries' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
// TIMING AND PERFORMANCE:
'-T0' => FILTER_VALIDATE_BOOLEAN,
'-T1' => FILTER_VALIDATE_BOOLEAN,
'-T2' => FILTER_VALIDATE_BOOLEAN,
'-T3' => FILTER_VALIDATE_BOOLEAN,
'-T4' => FILTER_VALIDATE_BOOLEAN,
'-T5' => FILTER_VALIDATE_BOOLEAN,
'-T' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 5]],
'--min-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'--max-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'--min-parallelism' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],

View File

@ -321,19 +321,9 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
</div>
<div class="field">
<label for="versionIntensitySelect" title="--version-intensity">Intensité des tests de version</label>
<select class="ui dropdown" id="versionIntensitySelect" name="--version-intensity" value="<?= $options["--version-intensity"] ?? ""?>">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2 Léger</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7 Défaut</option>
<option value="8">8</option>
<option value="9">9 Tous</option>
</select>
<label for="versionIntensityInput" title="--version-intensity">Intensité des tests de version</label>
<input type="number" min="0" max="9" id="versionIntensityInput" name="--version-intensity" placeholder="Intensité"
value="<?= $options["--version-intensity"] ?? "" ?>" title="2: léger, 9: tous, défaut: 7">
</div>
<div class="inline field">
@ -385,12 +375,27 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
</div>
<div class="field">
<label for="maxOSTriesInput">Nombre d'essais maximum</label>
<label for="maxOSTriesInput" title="--max-os-tries">Nombre d'essais maximum</label>
<input type="number" min="0" id="maxOSTriesInput" name="--max-os-tries" placeholder="Nombre d'essais"
value="<?= $options["--max-os-tries"] ?? "" ?>">
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Temporisation et performances</div>
<div class="content">
<div class="field">
<label for="TSelect" title="--T">Intensité des tests de version</label>
<select class="ui dropdown" id="TSelect" name="-T" value="<?= $options["-T"] ?? ""?>">
<option value="0"<?=($options["-T"]??"")==0?" selected":""?>>Paranoïaque</option>
<option value="1"<?=($options["-T"]??"")==1?" selected":""?>>Sournois</option>
<option value="2"<?=($options["-T"]??"")==2?" selected":""?>>Poli</option>
<option value="3"<?=($options["-T"]??"")==3?" selected":""?>>Normal</option>
<option value="4"<?=($options["-T"]??"")==4?" selected":""?>>Aggressif</option>
<option value="5"<?=($options["-T"]??"")==5?" selected":""?>>Dément</option>
</select>
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Divers</div>
<div class="content">
<div class="field">

View File

@ -6,19 +6,19 @@ include_once 'filter_inputs.php';
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
$command = ($options["sudo"]?? false ? "sudo " : "") . "nmap";
foreach ($options as $arg => $value) {
if (substr($arg, 0, 1) == '-') {
foreach ($options as $option => $value) {
if (substr($option, 0, 1) == '-') {
if (is_null($value)) {
http_response_code(400);
$errorMessage = "Valeur incorrecte pour le paramètre <var>$arg</var> : " . filter_input(INPUT_GET, $arg, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$errorMessage = "Valeur incorrecte pour le paramètre <var>$option</var> : " . filter_input(INPUT_GET, $option, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
include_once ".";
die();
} else if ($value) {
if ($value === true) {
$command .= " $arg";
$command .= " $option";
} else {
if (substr($arg, 0, 2) == '--') $command .= " $arg " . escapeshellarg($value);
else $command .= " $arg" . escapeshellarg($value);
if (substr($option, 0, 2) == '--') $command .= " $option " . escapeshellarg($value);
else $command .= " $option" . escapeshellarg($value);
}
}
}
@ -43,9 +43,9 @@ $xml->load($tempPath);
$saveAsURL = $options["saveAs"]?? false ? "$BASEDIR/$SCANSDIR/{$options["saveAs"]}.xml" : "";
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='savedAs' value='".htmlentities($saveAsURL, ENT_QUOTES)."'"), $xml->documentElement);
foreach ($options as $arg => $value) {
if (substr($arg, 0, 1) != '-') {
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='$arg' value='".htmlentities($value, ENT_QUOTES)."'"), $xml->documentElement);
foreach ($options as $option => $value) {
if (substr($option, 0, 1) != '-') {
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='$option' value='".htmlentities($value, ENT_QUOTES)."'"), $xml->documentElement);
}
}