fix scan args

This commit is contained in:
Adrien MALINGREY 2024-10-10 18:07:44 +02:00
parent 01f8ee3ea0
commit f413212db9
4 changed files with 301 additions and 299 deletions

View File

@ -15,7 +15,7 @@ $protocolePortsListRegex = "/^(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-
$portsListRegex = "/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/"; $portsListRegex = "/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/";
$tempoRegex = "/^\d+[smh]?$/"; $tempoRegex = "/^\d+[smh]?$/";
$options = filter_input_array(INPUT_GET, [ $inputs = filter_input_array(INPUT_GET, [
'iR' => ['filter' => FILTER_VALIDATE_INT], 'iR' => ['filter' => FILTER_VALIDATE_INT],
'-exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]], '-exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],

View File

@ -5,10 +5,10 @@ include_once 'filter_inputs.php';
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>lanScan</title> <title>lanScan</title>
<link rel="icon" href="favicon.ico"/> <link rel="icon" href="favicon.ico" />
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" /> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
@ -16,9 +16,9 @@ include_once 'filter_inputs.php';
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.polyfills.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.polyfills.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" /> <link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" /> <link href="style.css" rel="stylesheet" type="text/css" />
</head> </head>
<body> <body>
<nav class="ui inverted teal fixed menu"> <nav class="ui inverted teal fixed menu">
<a class="header item" href="."> <a class="header item" href=".">
lan<?php include 'logo.svg'; ?>can lan<?php include 'logo.svg'; ?>can
@ -27,17 +27,17 @@ include_once 'filter_inputs.php';
<form class="ui category search item" onsubmit="targetsInputDiv.classList.add('loading')"> <form class="ui category search item" onsubmit="targetsInputDiv.classList.add('loading')">
<div id="targetsInputDiv" class="ui icon input"> <div id="targetsInputDiv" class="ui icon input">
<input class="prompt" type="text" id="targetsInput" name="targets" required="" oninput="hiddenInput.value=this.value" <input class="prompt" type="text" id="targetsInput" name="targets" required="" oninput="hiddenInput.value=this.value"
pattern="[a-zA-Z0-9._\/ \-]+" value="<?=$targets; ?>" placeholder="Scanner un réseau..." pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $targets; ?>" placeholder="Scanner un réseau..."
title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc. title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24 <?=$_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"/> Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254" />
<i class="satellite dish icon"></i> <i class="satellite dish icon"></i>
<button style="display:none" type="submit" formaction="scan.php" formmethod="get"></button> <button style="display:none" type="submit" formaction="scan.php" formmethod="get"></button>
</div> </div>
</form> </form>
<form class="item" method="get" action="scan-options.php"> <form class="item" method="get" action="scan-options.php">
<input id="hiddenInput" type="hidden" name="targets" value="<?=$targets; ?>"/> <input id="hiddenInput" type="hidden" name="targets" value="<?= $targets; ?>" />
<input id="hiddenInput" type="hidden" name="name" value="<?=$name; ?>"/> <input id="hiddenInput" type="hidden" name="name" value="<?= $name; ?>" />
<?='<input type="hidden" name="'.str_replace('=', '" value="', http_build_query($options, '', '/><input type="hidden" name="')).'"/>'; ?> <?= '<input type="hidden" name="' . str_replace('=', '" value="', http_build_query($inputs, '', '/><input type="hidden" name="')) . '"/>'; ?>
<button class="ui teal submit button" type="submit">Options</button> <button class="ui teal submit button" type="submit">Options</button>
</form> </form>
</div> </div>
@ -48,21 +48,21 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24 <?=$_SERVER['SERVER_NAME']; ?> 10.0-
<div class="content"> <div class="content">
<div class="header">Précédents scans</div> <div class="header">Précédents scans</div>
<div class="ui divided link list"> <div class="ui divided link list">
<?php <?php
if (!file_exists($SCANS_DIR)) { if (!file_exists($SCANS_DIR)) {
mkdir($SCANS_DIR); mkdir($SCANS_DIR);
} }
foreach (scandir($SCANS_DIR) as $scan) { foreach (scandir($SCANS_DIR) as $scan) {
if (substr($scan, -4) == '.xml') { if (substr($scan, -4) == '.xml') {
$targets = str_replace('!', '/', substr_replace($scan, '', -4)); $targets = str_replace('!', '/', substr_replace($scan, '', -4));
echo "<a class='item' href='scan.php?targets=".urlencode($targets)."'>$targets</a>\n"; echo "<a class='item' href='scan.php?targets=" . urlencode($targets) . "'>$targets</a>\n";
} }
} }
?> ?>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -5,7 +5,7 @@ include_once 'filter_inputs.php';
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>lanScan</title> <title>lanScan</title>
<link rel="icon" href="favicon.ico" /> <link rel="icon" href="favicon.ico" />
@ -17,9 +17,9 @@ include_once 'filter_inputs.php';
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.polyfills.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.polyfills.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" /> <link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" /> <link href="style.css" rel="stylesheet" type="text/css" />
</head> </head>
<body> <body>
<nav class="ui inverted teal fixed menu"> <nav class="ui inverted teal fixed menu">
<a class="header item" href="."> <a class="header item" href=".">
lan<?php include 'logo.svg'; ?>can lan<?php include 'logo.svg'; ?>can
@ -42,7 +42,7 @@ include_once 'filter_inputs.php';
<input id="targetsInput" type="text" name="targets" placeholder="Cibles" required <input id="targetsInput" type="text" name="targets" placeholder="Cibles" required
pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $targets; ?>" list="targetsList" pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $targets; ?>" list="targetsList"
title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc. title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24 <?=$_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254" /> Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254" />
</div> </div>
<div class="ui styled fluid accordion field"> <div class="ui styled fluid accordion field">
@ -51,9 +51,9 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24 <?=$_SERVER['SERVER_NAME']; ?> 10.0-
<div class="field"> <div class="field">
<label for="excludeInput">Exclure les hôtes ou réseaux</label> <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" <input type="text" id="excludeInput" name="-exclude" placeholder="Hôte/réseau" list="targetsList"
pattern="[a-zA-Z0-9._\/,\-]*" value="<?=$options['-exclude']?? "" ?>" pattern="[a-zA-Z0-9._\/,\-]*" value="<?= $inputs['-exclude'] ?? "" ?>"
title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc. title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24,<?=$_SERVER['SERVER_NAME']; ?>,10.0-255.0-255.1-254"> Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24,<?= $_SERVER['SERVER_NAME']; ?>,10.0-255.0-255.1-254">
</div> </div>
</div> </div>
@ -61,14 +61,14 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24,<?=$_SERVER['SERVER_NAME']; ?>,10.0-
<div class="content"> <div class="content">
<div class="inline field"> <div class="inline field">
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">
<input type="checkbox" id="sPCheckbox" name="sP" <?=$options['sP']?? false? 'checked' : ''; ?>/> <input type="checkbox" id="sPCheckbox" name="sP" <?= $inputs['sP'] ?? false ? 'checked' : ''; ?> />
<label for="sPCheckbox">N'effectuer que l'étape de découverte des hôtes actifs</label> <label for="sPCheckbox">N'effectuer que l'étape de découverte des hôtes actifs</label>
</div> </div>
</div> </div>
<div class="inline field"> <div class="inline field">
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">
<input type="checkbox" id="PnCheckbox" name="Pn" <?=$options['Pn']?? false? 'checked' : ''; ?>/> <input type="checkbox" id="PnCheckbox" name="Pn" <?= $inputs['Pn'] ?? false ? 'checked' : ''; ?> />
<label for="PnCheckbox">Considérer tous les hôtes comme actifs (saute la découverte des hôtes)</label> <label for="PnCheckbox">Considérer tous les hôtes comme actifs (saute la découverte des hôtes)</label>
</div> </div>
</div> </div>
@ -77,19 +77,19 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24,<?=$_SERVER['SERVER_NAME']; ?>,10.0-
<div class="field"> <div class="field">
<label for="PSInput">Ping TCP SYN</label> <label for="PSInput">Ping TCP SYN</label>
<input type="text" id="PSInput" name="PS" placeholder="Ports" list="servicesList" <input type="text" id="PSInput" name="PS" placeholder="Ports" list="servicesList"
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?=$options['PS']?? "" ?>" pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $inputs['PS'] ?? "" ?>"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-"> title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
</div> </div>
<div class="field"> <div class="field">
<label for="PAInput">Ping TCP ACK</label> <label for="PAInput">Ping TCP ACK</label>
<input type="text" id="PAInput" name="PA" placeholder="Ports" list="servicesList" <input type="text" id="PAInput" name="PA" placeholder="Ports" list="servicesList"
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?=$options['PA']?? "" ?>" pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $inputs['PA'] ?? "" ?>"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-"> title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
</div> </div>
<div class="field"> <div class="field">
<label for="PUInput">Ping UDP</label> <label for="PUInput">Ping UDP</label>
<input type="text" id="PUInput" name="PU" placeholder="Ports" list="servicesList" <input type="text" id="PUInput" name="PU" placeholder="Ports" list="servicesList"
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?=$options['PU']?? "" ?>" pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $inputs['PU'] ?? "" ?>"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-"> title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
</div> </div>
</div> </div>
@ -99,19 +99,19 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24,<?=$_SERVER['SERVER_NAME']; ?>,10.0-
<div class="inline fields"> <div class="inline fields">
<div class="field"> <div class="field">
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">
<input type="checkbox" id="PECheckbox" name="PE" <?=$options['PE']?? false? 'checked' : ''; ?>/> <input type="checkbox" id="PECheckbox" name="PE" <?= $inputs['PE'] ?? false ? 'checked' : ''; ?> />
<label for="PECheckbox">Echo request</label> <label for="PECheckbox">Echo request</label>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">
<input type="checkbox" id="PPCheckbox" name="PP" <?=$options['PP']?? false? 'checked' : ''; ?>/> <input type="checkbox" id="PPCheckbox" name="PP" <?= $inputs['PP'] ?? false ? 'checked' : ''; ?> />
<label for="PPCheckbox">Timestamp request</label> <label for="PPCheckbox">Timestamp request</label>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">
<input type="checkbox" id="PMCheckbox" name="PM" <?=$options['PM']?? false? 'checked' : ''; ?>/> <input type="checkbox" id="PMCheckbox" name="PM" <?= $inputs['PM'] ?? false ? 'checked' : ''; ?> />
<label for="PMCheckbox">Mask request</label> <label for="PMCheckbox">Mask request</label>
</div> </div>
</div> </div>
@ -120,7 +120,7 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24,<?=$_SERVER['SERVER_NAME']; ?>,10.0-
<div class="field"> <div class="field">
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">
<input type="checkbox" id="PRCheckbox" name="PR" <?=$options['PR']?? false? 'checked' : ''; ?>/> <input type="checkbox" id="PRCheckbox" name="PR" <?= $inputs['PR'] ?? false ? 'checked' : ''; ?> />
<label for="PRCheckbox">Ping ARP</label> <label for="PRCheckbox">Ping ARP</label>
</div> </div>
</div> </div>
@ -128,7 +128,7 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24,<?=$_SERVER['SERVER_NAME']; ?>,10.0-
<div class="field"> <div class="field">
<label for="P0Input">Ping IP Protocol</label> <label for="P0Input">Ping IP Protocol</label>
<input type="text" id="P0Input" name="P0" placeholder="Ports" <input type="text" id="P0Input" name="P0" placeholder="Ports"
pattern="[0-9\-]+" value="<?=$options['P0']?? "" ?>" pattern="[0-9\-]+" value="<?= $inputs['P0'] ?? "" ?>"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-"> title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
</div> </div>
</div> </div>
@ -137,7 +137,7 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24,<?=$_SERVER['SERVER_NAME']; ?>,10.0-
<div class="content"> <div class="content">
<div class="field"> <div class="field">
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">
<input type="checkbox" id="FCheckbox" name="F" <?=$options['F']?? false? 'checked' : ''; ?>/> <input type="checkbox" id="FCheckbox" name="F" <?= $inputs['F'] ?? false ? 'checked' : ''; ?> />
<label for="FCheckbox">Scanner que les ports connus</label> <label for="FCheckbox">Scanner que les ports connus</label>
</div> </div>
</div> </div>
@ -145,13 +145,13 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24,<?=$_SERVER['SERVER_NAME']; ?>,10.0-
<div class="field"> <div class="field">
<label for="pInput">Scanner que les ports</label> <label for="pInput">Scanner que les ports</label>
<input type="text" id="pInput" name="p" placeholder="Ports" list="servicesList" <input type="text" id="pInput" name="p" placeholder="Ports" list="servicesList"
pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*" value="<?=$options['p']?? "" ?>" pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*" value="<?= $inputs['p'] ?? "" ?>"
title="Liste de ports ex: ssh,ftp,U:53,111,137,T:21-25,80,139,8080"> title="Liste de ports ex: ssh,ftp,U:53,111,137,T:21-25,80,139,8080">
</div> </div>
<div class="field"> <div class="field">
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">
<input type="checkbox" id="rCheckbox" name="r" <?=$options['r']?? false? 'checked' : ''; ?>/> <input type="checkbox" id="rCheckbox" name="r" <?= $inputs['r'] ?? false ? 'checked' : ''; ?> />
<label for="rCheckbox">Ne pas mélanger les ports</label> <label for="rCheckbox">Ne pas mélanger les ports</label>
</div> </div>
</div> </div>
@ -163,87 +163,88 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24,<?=$_SERVER['SERVER_NAME']; ?>,10.0-
</form> </form>
<datalist id='targetsList'> <datalist id='targetsList'>
<option value="<?=$_SERVER['REMOTE_ADDR']; ?>"></option> <option value="<?= $_SERVER['REMOTE_ADDR']; ?>"></option>
<option value="192.168.1.0/24"></option> <option value="192.168.1.0/24"></option>
<option value="<?=$_SERVER['SERVER_NAME']; ?>"></option> <option value="<?= $_SERVER['SERVER_NAME']; ?>"></option>
<?php <?php
if (!file_exists($SCANS_DIR)) { if (!file_exists($SCANS_DIR)) {
mkdir($SCANS_DIR); mkdir($SCANS_DIR);
} }
foreach (scandir($SCANS_DIR) as $scan) { foreach (scandir($SCANS_DIR) as $scan) {
if ('.xml' == substr($scan, -4)) { if ('.xml' == substr($scan, -4)) {
$targets = str_replace('!', '/', substr_replace($scan, '', -4)); $targets = str_replace('!', '/', substr_replace($scan, '', -4));
echo " <option value='$targets'></option>\n"; echo " <option value='$targets'></option>\n";
} }
} }
?> ?>
</datalist> </datalist>
<datalist id='servicesList'> <datalist id='servicesList'>
<?php <?php
$nmap_services = file("$NMAP_DATADIR/nmap-services"); $nmap_services = file("$NMAP_DATADIR/nmap-services");
$services = []; $services = [];
foreach ($nmap_services as $service) { foreach ($nmap_services as $service) {
if (0 !== strpos($service, '#')) { if (0 !== strpos($service, '#')) {
[$name, $port] = explode("\t", $service); [$name, $port] = explode("\t", $service);
$services[$name] = explode("/", $port); $services[$name] = explode("/", $port);
} }
} }
foreach ($services as $name => [$portid, $protocol]) { foreach ($services as $name => [$portid, $protocol]) {
echo " <option value='$name'></option>\n"; echo " <option value='$name'></option>\n";
} }
?> ?>
</datalist> </datalist>
</main> </main>
<script> <script>
const targetsWhitelist = Array.from(targetsList.options).map(option => option.value) class TagsInput extends Tagify {
const servicesWhitelist = Array.from(servicesList.options).map(option => option.value) constructor(input, options) {
const joinWithSpaces = tags => tags.map(tag => tag.value).join(' ') super(input, options)
const joinWithCommas = tags => tags.map(tag => tag.value).join(',') if (!this.whitelist.length && input.list) this.whitelist = Array.from(input.list.options).map(option => option.value)
console.log(this.whitelist, input.list)
}
}
$('.ui.accordion').accordion()
new Tagify(targetsInput, { const joinWithSpaces = tags => tags.map(tag => tag.value).join(' ')
const joinWithCommas = tags => tags.map(tag => tag.value).join(',')
$('.ui.accordion').accordion()
new TagsInput(targetsInput, {
delimiters: " |,", delimiters: " |,",
originalInputValueFormat: joinWithSpaces, originalInputValueFormat: joinWithSpaces,
whitelist: targetsWhitelist, })
})
new Tagify(excludeInput, { new TagsInput(excludeInput, {
delimiters: " |,", delimiters: " |,",
originalInputValueFormat: joinWithCommas, originalInputValueFormat: joinWithCommas,
whitelist: targetsWhitelist, })
})
new Tagify(PSInput, { new TagsInput(PSInput, {
delimiters: " |,", delimiters: " |,",
originalInputValueFormat: joinWithCommas, originalInputValueFormat: joinWithCommas,
whitelist: servicesWhitelist, })
})
new Tagify(PAInput, { new TagsInput(PAInput, {
delimiters: " |,", delimiters: " |,",
originalInputValueFormat: joinWithCommas, originalInputValueFormat: joinWithCommas,
whitelist: servicesWhitelist, })
})
new Tagify(PUInput, { new TagsInput(PUInput, {
delimiters: " |,", delimiters: " |,",
originalInputValueFormat: joinWithCommas, originalInputValueFormat: joinWithCommas,
whitelist: servicesWhitelist, })
})
new Tagify(P0Input, { new TagsInput(P0Input, {
delimiters: " |,", delimiters: " |,",
originalInputValueFormat: joinWithCommas originalInputValueFormat: joinWithCommas
}) })
new Tagify(pInput, { new TagsInput(pInput, {
delimiters: " |,", delimiters: " |,",
originalInputValueFormat: joinWithCommas, originalInputValueFormat: joinWithCommas,
whitelist: servicesWhitelist, })
})
newScanForm.onsubmit = function (event) { newScanForm.onsubmit = function(event) {
if (this.checkValidity()) { if (this.checkValidity()) {
newScanForm.classList.add("loading") newScanForm.classList.add("loading")
return true return true
@ -251,8 +252,8 @@ newScanForm.onsubmit = function (event) {
event.preventDefault() event.preventDefault()
this.reportValidity() this.reportValidity()
} }
} }
</script> </script>
</body> </body>
</html> </html>

View File

@ -12,18 +12,19 @@ if (!file_exists($SCANS_DIR)) {
mkdir($SCANS_DIR); mkdir($SCANS_DIR);
} }
$basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}".dirname($_SERVER['REQUEST_URI']); $basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . dirname($_SERVER['REQUEST_URI']);
$args = ''; $args = '';
foreach ($options as $arg => $value) { foreach ($inputs as $name => $value) {
echo "$name : $value $args<br>";
if (is_null($value)) { if (is_null($value)) {
http_response_code(400); http_response_code(400);
exit("Valeur incorecte pour le paramètre $option : ".filter_input(INPUT_GET, $option, FILTER_SANITIZE_FULL_SPECIAL_CHARS)); exit("Valeur incorecte pour le paramètre $option : " . filter_input(INPUT_GET, $option, FILTER_SANITIZE_FULL_SPECIAL_CHARS));
} else if ($value) { } else if ($value) {
if ($value === true) { if ($value === true) {
$args .= " -$arg"; $args .= " -$name";
} else { } else {
$arg .= " -$arg ".escapeshellarg($value); $args .= " -$name " . ($value);
} }
} }
} }
@ -42,7 +43,7 @@ if (!file_exists($SCANS_DIR)) {
mkdir($SCANS_DIR); mkdir($SCANS_DIR);
} }
$path = "$SCANS_DIR/".str_replace('/', '!', $targets).'.xml'; $path = "$SCANS_DIR/" . str_replace('/', '!', $targets) . '.xml';
if (!file_exists($path)) { if (!file_exists($path)) {
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value=''"), $xml->documentElement); $xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value=''"), $xml->documentElement);
$xml->save($path); $xml->save($path);