inclure lanScan options in presets
This commit is contained in:
parent
653bb604f5
commit
9f2826d522
24
config.php
24
config.php
@ -9,19 +9,17 @@ $presets = [
|
||||
'-PS' => 'microsoft-ds',
|
||||
'-F' => true,
|
||||
'-T5' => true,
|
||||
'--stylesheet' => "$BASEDIR/lanScan.xsl"
|
||||
'--stylesheet' => "$BASEDIR/lanScan.xsl",
|
||||
'refreshPeriod' => 60,
|
||||
'sudo' => false,
|
||||
],
|
||||
"host" => [
|
||||
'-Pn' => true,
|
||||
'-F' => true,
|
||||
'-sV' => true,
|
||||
'-T5' => true,
|
||||
'--stylesheet' => "$BASEDIR/hostScan.xsl"
|
||||
'-Pn' => true,
|
||||
'-F' => true,
|
||||
'-sV' => true,
|
||||
'-T5' => true,
|
||||
'--stylesheet' => "$BASEDIR/hostScan.xsl",
|
||||
'refreshPeriod' => 60,
|
||||
'sudo' => false,
|
||||
],
|
||||
];
|
||||
|
||||
$saveAs = null;
|
||||
$compareWith = null;
|
||||
$refreshPeriod = 60;
|
||||
$sudo = true;
|
||||
|
||||
];
|
@ -13,9 +13,9 @@ $targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options'
|
||||
$preset = filter_input(INPUT_GET, "preset");
|
||||
|
||||
if ($preset && isset($presets[$preset])) {
|
||||
$args = $presets[$preset];
|
||||
$options = $presets[$preset];
|
||||
} else {
|
||||
$args = filter_input_array(INPUT_GET, [
|
||||
$options = filter_input_array(INPUT_GET, [
|
||||
// TARGET SPECIFICATION:
|
||||
'-iR' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||
'--exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||
@ -107,10 +107,10 @@ if ($preset && isset($presets[$preset])) {
|
||||
'--unprivileged' => FILTER_VALIDATE_BOOLEAN,
|
||||
'-h' => FILTER_VALIDATE_BOOLEAN,
|
||||
'--stylesheet' => FILTER_VALIDATE_URL,
|
||||
// lanScan
|
||||
'saveAs' => ["filter" => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
|
||||
'compareWith' => FILTER_VALIDATE_URL,
|
||||
'refreshPeriod' => ["filter" => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||
'sudo' => FILTER_VALIDATE_BOOLEAN,
|
||||
], false) ?: $presets["lan"];
|
||||
|
||||
$saveAs = filter_input(INPUT_GET, 'saveAs', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex]]);
|
||||
$compareWith = filter_input(INPUT_GET, 'compareWith', FILTER_VALIDATE_URL);
|
||||
$refreshPeriod = filter_input(INPUT_GET, 'refreshPeriod', FILTER_VALIDATE_INT, ['options' => ['min_range' => 0]]);
|
||||
$sudo = filter_input(INPUT_GET, 'sudo', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
||||
}
|
80
options.php
80
options.php
@ -64,13 +64,13 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="field" title="--exclude">
|
||||
<label for="excludeInput">Exclure les hôtes ou réseaux</label>
|
||||
<input type="text" id="excludeInput" name="--exclude" placeholder="Hôte/réseau" list="targetsList"
|
||||
pattern="[a-zA-Z0-9._\/,\-]*" value="<?= $args['--exclude'] ?? "" ?>">
|
||||
pattern="[a-zA-Z0-9._\/,\-]*" value="<?= $options['--exclude'] ?? "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="field" title="-iR">
|
||||
<label for="iRInput">Nombre de cibles au hasard</label>
|
||||
<input type="number" min="0" id="iRInput" name="-iR" placeholder="Nombre de cibles"
|
||||
value="<?= $args['-iR'] ?? "" ?>">
|
||||
value="<?= $options['-iR'] ?? "" ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -81,7 +81,7 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="content">
|
||||
<div class="inline field" title="-Pn">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="PnCheckbox" name="-Pn" <?= $args['-Pn'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="PnCheckbox" name="-Pn" <?= $options['-Pn'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="PnCheckbox">Sauter cette étape (considérer tous les hôtes comme actifs)</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -89,21 +89,21 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="field" title="-PS">
|
||||
<label for="PSInput">TCP SYN</label>
|
||||
<input type="text" id="PSInput" name="-PS" placeholder="Ports" list="servicesList"
|
||||
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $args['-PS'] ?? "" ?>"
|
||||
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-PS'] ?? "" ?>"
|
||||
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
|
||||
</div>
|
||||
|
||||
<div class="field" title="-PA">
|
||||
<label for="PAInput">TCP ACK</label>
|
||||
<input type="text" id="PAInput" name="-PA" placeholder="Ports" list="servicesList"
|
||||
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $args['-PA'] ?? "" ?>"
|
||||
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-PA'] ?? "" ?>"
|
||||
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
|
||||
</div>
|
||||
|
||||
<div class="field" title="-PU">
|
||||
<label for="PUInput">UDP</label>
|
||||
<input type="text" id="PUInput" name="-PU" placeholder="Ports" list="servicesList"
|
||||
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $args['-PU'] ?? "" ?>"
|
||||
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-PU'] ?? "" ?>"
|
||||
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
|
||||
</div>
|
||||
|
||||
@ -112,19 +112,19 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="inline fields">
|
||||
<div class="field" title="-PE">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="PECheckbox" name="-PE" <?= $args['-PE'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="PECheckbox" name="-PE" <?= $options['-PE'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="PECheckbox">Echo request</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field" title="-PP">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="PPCheckbox" name="-PP" <?= $args['-PP'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="PPCheckbox" name="-PP" <?= $options['-PP'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="PPCheckbox">Timestamp request</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field" title="-PM">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="PMCheckbox" name="-PM" <?= $args['-PM'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="PMCheckbox" name="-PM" <?= $options['-PM'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="PMCheckbox">Mask request</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -134,20 +134,20 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="field" title="-PO">
|
||||
<label for="POInput" title="PO">Protocole IP (par type)</label>
|
||||
<input type="text" id="POInput" name="-PO" placeholder="Protocole"
|
||||
pattern="[0-9,\-]+" value="<?= $args['-PO'] ?? "" ?>"
|
||||
pattern="[0-9,\-]+" value="<?= $options['-PO'] ?? "" ?>"
|
||||
title="[num de protocole]">
|
||||
</div>
|
||||
|
||||
<div class="fields">
|
||||
<div class="inline field" title="-PR">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="PRCheckbox" name="-PR" <?= $args['-PR'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="PRCheckbox" name="-PR" <?= $options['-PR'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="PRCheckbox">Ping ARP</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field" title="--send-ip">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sendIPCheckbox" name="--send-ip" <?= $args['--send-ip'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sendIPCheckbox" name="--send-ip" <?= $options['--send-ip'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sendIPCheckbox">Pas de scan ARP</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -156,13 +156,13 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="fields">
|
||||
<div class="inline field" title="-n">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="nCheckbox" name="-n" <?= $args['-n'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="nCheckbox" name="-n" <?= $options['-n'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="nCheckbox">Ne jamais résoudre les noms DNS</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field" title="-R">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="RCheckbox" name="-R" <?= $args['-R'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="RCheckbox" name="-R" <?= $options['-R'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="nCheckbox">Toujours résoudre les noms DNS<br />(par défault seuls les hôtes actifs sont résolus)</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -171,7 +171,7 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="field">
|
||||
<label for="dnsServersInput" title="--dns-servers">Utiliser les serveurs DNS</label>
|
||||
<input type="text" id="dnsServersInput" name="--dns-servers" placeholder="serveur"
|
||||
pattern="[a-zA-Z0-9._,\-]*" value="<?= $args['--dns-servers'] ?? "" ?>"
|
||||
pattern="[a-zA-Z0-9._,\-]*" value="<?= $options['--dns-servers'] ?? "" ?>"
|
||||
title="serv1[,serv2],...">
|
||||
</div>
|
||||
</div>
|
||||
@ -185,19 +185,19 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="fields">
|
||||
<div class="field" title="-sS">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sSCheckbox" name="-sS" <?= $args['-sS'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sSCheckbox" name="-sS" <?= $options['-sS'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sSCheckbox">TCP SYN</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field" title="-sT">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sTCheckbox" name="-sT" <?= $args['-sT'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sTCheckbox" name="-sT" <?= $options['-sT'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sTCheckbox">TCP Connect()</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field" title="-sA">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sACheckbox" name="-sA" <?= $args['-sA'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sACheckbox" name="-sA" <?= $options['-sA'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sACheckbox">TCP ACK</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -206,19 +206,19 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="fields">
|
||||
<div class="field" title="-sW">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sWCheckbox" name="-sW" <?= $args['-sW'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sWCheckbox" name="-sW" <?= $options['-sW'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sWCheckbox">Fenêtre TCP</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field" title="-sM">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sMCheckbox" name="-sM" <?= $args['-sM'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sMCheckbox" name="-sM" <?= $options['-sM'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sMCheckbox">Maimon</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field" title="-sN">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sNCheckbox" name="-sN" <?= $args['-sN'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sNCheckbox" name="-sN" <?= $options['-sN'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sNCheckbox">TCP Null</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -227,19 +227,19 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="fields">
|
||||
<div class="field" title="-sF">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sFCheckbox" name="-sF" <?= $args['-sF'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sFCheckbox" name="-sF" <?= $options['-sF'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sFCheckbox">TCP FIN</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field" title="-sX">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sXCheckbox" name="-sX" <?= $args['-sX'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sXCheckbox" name="-sX" <?= $options['-sX'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sXCheckbox">Sapin de Noël</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field" title="-sU">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sUCheckbox" name="-sU" <?= $args['-sU'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sUCheckbox" name="-sU" <?= $options['-sU'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sUCheckbox">UDP</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -248,27 +248,27 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="field" title="--scanflags">
|
||||
<label for="scanflagsInput">Scan TCP personnalisé</label>
|
||||
<input type="text" id="scanflagsInput" name="--scanflags" placeholder="Drapeaux TCP" list="flagsList"
|
||||
pattern="(URG|ACK|PSH|RST|SYN|FIN|,)+|[1-9]?[0-9]|[1-2][0-9][0-9]" value="<?= $args['--scanflags'] ?? "" ?>"
|
||||
pattern="(URG|ACK|PSH|RST|SYN|FIN|,)+|[1-9]?[0-9]|[1-2][0-9][0-9]" value="<?= $options['--scanflags'] ?? "" ?>"
|
||||
title="Mélanger simplement les drapeaux URG, ACK, PSH, RST, SYN et FIN.">
|
||||
</div>
|
||||
|
||||
<div class="field" title="-sI">
|
||||
<label for="sIInput">Hôte zombie</label>
|
||||
<input type="text" id="sIInput" name="-p" placeholder="zombie host[:probeport]"
|
||||
pattern="[a-zA-Z0-9._\-]+(:[0-9]+)?" value="<?= $args['-sI'] ?? "" ?>"
|
||||
pattern="[a-zA-Z0-9._\-]+(:[0-9]+)?" value="<?= $options['-sI'] ?? "" ?>"
|
||||
title="zombie host[:probeport]">
|
||||
</div>
|
||||
|
||||
<div class="field" title="-b">
|
||||
<label for="bInput">Rebond FTP</label>
|
||||
<input type="text" id="bInput" name="-p" placeholder="[<username>[:<password>]@]<server>[:<port>]"
|
||||
pattern="([a-zA-Z0-9._\-]+(:.+)?@)?[a-zA-Z0-9._\-]+(:[0-9]+)?" value="<?= $args['-b'] ?? "" ?>"
|
||||
pattern="([a-zA-Z0-9._\-]+(:.+)?@)?[a-zA-Z0-9._\-]+(:[0-9]+)?" value="<?= $options['-b'] ?? "" ?>"
|
||||
title="[<username>[:<password>]@]<server>[:<port>]">
|
||||
</div>
|
||||
|
||||
<div class="field" title="-sO">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sUCheckbox" name="-sU" <?= $args['-sU'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sUCheckbox" name="-sU" <?= $options['-sU'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sUCheckbox">Scan des protocoles supportés par la couche IP</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -282,14 +282,14 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="content">
|
||||
<div class="inline field" title="-sP">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="sPCheckbox" name="-sP" <?= $args['-sP'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="sPCheckbox" name="-sP" <?= $options['-sP'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="sPCheckbox">Sauter cette étape</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inline field" title="-F">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="FCheckbox" name="-F" <?= $args['-F'] ?? false ? 'checked' : ''; ?>
|
||||
<input type="checkbox" id="FCheckbox" name="-F" <?= $options['-F'] ?? false ? 'checked' : ''; ?>
|
||||
onchange="pInput.disabled = FCheckbox.checked" />
|
||||
<label for="FCheckbox">Scanner les ports connus</label>
|
||||
</div>
|
||||
@ -297,14 +297,14 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
|
||||
<div class="field" title="-p">
|
||||
<label for="pInput">Scanner les ports</label>
|
||||
<input type="text" id="pInput" name="-p" placeholder="Ports" list="servicesList" <?= $args['-F'] ?? false ? 'disabled' : ''; ?>
|
||||
pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*" value="<?= $args['-p'] ?? "" ?>"
|
||||
<input type="text" id="pInput" name="-p" placeholder="Ports" list="servicesList" <?= $options['-F'] ?? false ? 'disabled' : ''; ?>
|
||||
pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-p'] ?? "" ?>"
|
||||
title="Liste de ports ex: ssh,ftp,U:53,111,137,T:21-25,80,139,8080">
|
||||
</div>
|
||||
|
||||
<div class="inline field" title="-r">
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" id="rCheckbox" name="-r" <?= $args['-r'] ?? false ? 'checked' : ''; ?> />
|
||||
<input type="checkbox" id="rCheckbox" name="-r" <?= $options['-r'] ?? false ? 'checked' : ''; ?> />
|
||||
<label for="rCheckbox">Ne pas mélanger les ports</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -317,13 +317,13 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<div class="content">
|
||||
<div class="field" title="--stylesheet">
|
||||
<label for="stylesheetSelect">Feuille de style</label>
|
||||
<select class="ui dropdown" id="stylesheetSelect" name="--stylesheet" value="<?= $args["stylesheet"] ?? ""?>">
|
||||
<select class="ui dropdown" id="stylesheetSelect" name="--stylesheet" value="<?= $options["stylesheet"] ?? ""?>">
|
||||
<?php
|
||||
foreach (scandir('.') as $filename) {
|
||||
if (substr($filename, -4) === '.xsl') {
|
||||
$name = substr($filename, 0, -4);
|
||||
$URL = htmlentities("$BASEDIR/$filename", ENT_QUOTES);
|
||||
if (isset($args["stylesheet"]) && $URL == $args["stylesheet"]) {
|
||||
if (isset($options["--stylesheet"]) && $URL == $options["--stylesheet"]) {
|
||||
echo " <option value='$URL' selected>$name</option>\n";
|
||||
} else {
|
||||
echo " <option value='$URL'>$name</option>\n";
|
||||
@ -336,7 +336,7 @@ foreach (scandir('.') as $filename) {
|
||||
|
||||
<div class="field">
|
||||
<label for="compareWithSelect">Comparer avec un précédent scan</label>
|
||||
<select class="ui dropdown" id="compareWithSelect" name="compareWith" value="<?= $compareWith ?>">
|
||||
<select class="ui dropdown" id="compareWithSelect" name="compareWith" value="<?= $options["compareWith"] ?? "" ?>">
|
||||
<option value="">Précédent scan</option>
|
||||
<?php
|
||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||
@ -344,7 +344,7 @@ foreach (scandir($SCANSDIR) as $filename) {
|
||||
if (substr($filename, -4) === '.xml') {
|
||||
$name = substr($filename, 0, -4);
|
||||
$URL = htmlentities("$BASEDIR/$SCANSDIR/$filename", ENT_QUOTES);
|
||||
if ($URL == $compareWith) {
|
||||
if (isset($options["compareWith"]) && $URL == $options["compareWith"]) {
|
||||
echo " <option value='$URL' selected>$name</option>\n";
|
||||
} else {
|
||||
echo " <option value='$URL'>$name</option>\n";
|
||||
@ -359,14 +359,14 @@ foreach (scandir($SCANSDIR) as $filename) {
|
||||
<label for="refreshPeriodInput">Rafraîchir toutes les</label>
|
||||
<div class="ui right labeled input">
|
||||
<input type="number" min="0" id="refreshPeriodInput" name="refreshPeriod" placeholder="Période"
|
||||
value="<?= $refreshPeriod ?? "" ?>">
|
||||
value="<?= $options["refreshPeriod"] ?? "" ?>">
|
||||
<div class="ui label">secondes</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inline field">
|
||||
<div class="ui toggle checkbox" title="sudo">
|
||||
<input type="checkbox" id="sudoCheckbox" name="sudo" <?= $sudo ?? false ? 'checked' : ''; ?>/>
|
||||
<input type="checkbox" id="sudoCheckbox" name="sudo" <?= $options["sudo"] ?? false ? 'checked' : ''; ?>/>
|
||||
<label for="sudoCheckbox">Exécuter en tant qu'administrateur</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -377,7 +377,7 @@ foreach (scandir($SCANSDIR) as $filename) {
|
||||
<label for="saveAsInput">Enregistrer sous le nom</label>
|
||||
<input id="saveAsInput" type="text" name="saveAs" placeholder="Réseau local" pattern='[^<>:"\\\/\|@?]+'
|
||||
title="Caractères interdits : <>:"\/|@?"
|
||||
value="<?= htmlentities($saveAs, ENT_QUOTES); ?>">
|
||||
value="<?= htmlentities($options["saveAs"] ?? "", ENT_QUOTES); ?>">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="ui teal submit button">Démarrer</button>
|
||||
|
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