targets no longer required
This commit is contained in:
parent
ec917b4602
commit
5e76b92b96
@ -17,6 +17,8 @@ $HOSTSCAN_OPTIONS = [
|
||||
'stylesheet' => "$BASEDIR/hostScan.xsl"
|
||||
];
|
||||
|
||||
$refreshPeriod = 60;
|
||||
$sudo = true;
|
||||
|
||||
$SCANSDIR = 'scans';
|
||||
$DATADIR = '/usr/share/nmap';
|
||||
|
||||
|
@ -12,10 +12,6 @@ $fileNameRegex = '/^[^<>:"\/|?]+$/';
|
||||
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||
$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);
|
||||
|
||||
if ($lan) {
|
||||
$targets = $lan;
|
||||
@ -116,4 +112,9 @@ if ($lan) {
|
||||
'h' => FILTER_VALIDATE_BOOLEAN,
|
||||
'stylesheet' => FILTER_VALIDATE_URL,
|
||||
], false) ?: $LANSCAN_OPTIONS;
|
||||
|
||||
$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);
|
||||
}
|
26
hostScan.xsl
26
hostScan.xsl
@ -79,7 +79,7 @@
|
||||
<form id="lanScanForm" class="right menu" onsubmit="targetsInputDiv.classList.add('loading')">
|
||||
<div class="ui category search item">
|
||||
<div id="targetsInputDiv" class="ui icon input">
|
||||
<input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value" required=""
|
||||
<input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value"
|
||||
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.
|
||||
Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
|
||||
@ -88,7 +88,7 @@ Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
|
||||
<input type="hidden" name="compareWith" value="{$nextCompareWith}"/>
|
||||
<input type="hidden" name="refreshPeriod" value="{$refreshPeriod}"/>
|
||||
<button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php"></button>
|
||||
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/options.php" onclick="targetsInput.required=false">
|
||||
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/options.php">
|
||||
<i class="sliders horizontal icon"></i>
|
||||
</button>
|
||||
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/scan.php" onclick="this.getElementsByTagName('i')[0].className = 'loading spinner icon'">
|
||||
@ -169,16 +169,18 @@ $.toast({
|
||||
</xsl:if>
|
||||
|
||||
hiddenButton.onclick = function(event) {
|
||||
targetsInputDiv.classList.add('loading')
|
||||
$.toast({
|
||||
title : 'Scan en cours...',
|
||||
message : 'Merci de patienter',
|
||||
class : 'info',
|
||||
showIcon : 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
if (lanScanForm.form.checkValidity()) {
|
||||
targetsInputDiv.classList.add('loading')
|
||||
$.toast({
|
||||
title : 'Scan en cours...',
|
||||
message : 'Merci de patienter',
|
||||
class : 'info',
|
||||
showIcon : 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
}
|
||||
}
|
||||
refreshButton.onclick = function(event) {
|
||||
refreshButton.getElementsByTagName('i')[0].className = 'loading spinner icon'
|
||||
|
24
index.php
24
index.php
@ -26,7 +26,7 @@ include_once 'filter_inputs.php';
|
||||
<form id="lanScanForm" class="right menu">
|
||||
<div class="ui category search item">
|
||||
<div id="targetsInputDiv" class="ui icon input">
|
||||
<input class="prompt" type="text" id="targetsInput" name="lan" required
|
||||
<input class="prompt" type="text" id="targetsInput" name="lan"
|
||||
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.
|
||||
Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254" />
|
||||
@ -64,16 +64,18 @@ foreach (scandir($SCANSDIR) as $filename) {
|
||||
</div>
|
||||
<script>
|
||||
hiddenButton.onclick = (event) => {
|
||||
targetsInputDiv.classList.add('loading')
|
||||
$.toast({
|
||||
title: 'Scan en cours...',
|
||||
message: 'Merci de patienter',
|
||||
class: 'info',
|
||||
showIcon: 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon: true,
|
||||
position: 'bottom right',
|
||||
})
|
||||
if (lanScanForm.form.checkValidity()) {
|
||||
targetsInputDiv.classList.add('loading')
|
||||
$.toast({
|
||||
title: 'Scan en cours...',
|
||||
message: 'Merci de patienter',
|
||||
class: 'info',
|
||||
showIcon: 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon: true,
|
||||
position: 'bottom right',
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</main>
|
||||
|
26
lanScan.xsl
26
lanScan.xsl
@ -83,7 +83,7 @@
|
||||
</xsl:call-template>
|
||||
<div class="ui category search item">
|
||||
<div id="targetsInputDiv" class="ui icon input">
|
||||
<input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value" required=""
|
||||
<input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value"
|
||||
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.
|
||||
Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
|
||||
@ -92,7 +92,7 @@ Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
|
||||
<input type="hidden" name="compareWith" value="{$nextCompareWith}"/>
|
||||
<input type="hidden" name="refreshPeriod" value="{$refreshPeriod}"/>
|
||||
<button id="hiddenButton" style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php"></button>
|
||||
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/options.php" onclick="targetsInput.required=false">
|
||||
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/options.php">
|
||||
<i class="sliders horizontal icon"></i>
|
||||
</button>
|
||||
<button id="refreshButton" class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/scan.php">
|
||||
@ -189,16 +189,18 @@ $.toast({
|
||||
</xsl:if>
|
||||
|
||||
hiddenButton.onclick = function(event) {
|
||||
targetsInputDiv.classList.add('loading')
|
||||
$.toast({
|
||||
title : 'Scan en cours...',
|
||||
message : 'Merci de patienter',
|
||||
class : 'info',
|
||||
showIcon : 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
if (lanScanForm.form.checkValidity()) {
|
||||
targetsInputDiv.classList.add('loading')
|
||||
$.toast({
|
||||
title : 'Scan en cours...',
|
||||
message : 'Merci de patienter',
|
||||
class : 'info',
|
||||
showIcon : 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
}
|
||||
}
|
||||
refreshButton.onclick = function(event) {
|
||||
refreshButton.getElementsByTagName('i')[0].className = 'loading spinner icon'
|
||||
|
@ -46,10 +46,10 @@ include_once 'filter_inputs.php';
|
||||
<h1 class="header">Scanner un <?=$host? "hôte" : "réseau" ?></h1>
|
||||
|
||||
<form id="newScanForm" class="ui form" method="get" action="scan.php">
|
||||
<div class="required field">
|
||||
<div class="field">
|
||||
<label for="targetsInput" 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">Cibles</label>
|
||||
<input id="targetsInput" type="text" name="targets" placeholder="Cibles" required
|
||||
<input id="targetsInput" type="text" name="targets" placeholder="Cibles"
|
||||
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.
|
||||
Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254" />
|
||||
|
7
scan.php
7
scan.php
@ -2,13 +2,6 @@
|
||||
|
||||
include_once 'filter_inputs.php';
|
||||
|
||||
if (!$targets) {
|
||||
http_response_code(400);
|
||||
$errorMessage = "Valeur incorecte pour le paramètre <var>targets</var> : " . filter_input(INPUT_GET, "targets", FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
include_once "options.php";
|
||||
die();
|
||||
}
|
||||
|
||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||
|
||||
$args = '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user