rescan named scan
This commit is contained in:
parent
566a5a4c67
commit
72396e5071
46
index.php
46
index.php
@ -9,36 +9,36 @@
|
|||||||
<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" />
|
||||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-image: url(bg.jpg);
|
background-image: url(bg.jpg);
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
body > .grid {
|
body>.grid {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
margin-right: 0 !important;
|
margin-right: 0 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="ui middle aligned center aligned grid inverted">
|
<div class="ui middle aligned center aligned inverted grid">
|
||||||
<div class="column" style="max-width: 450px;">
|
<div class="column" style="max-width: 450px;">
|
||||||
<h2 class="ui inverted teal fluid image header logo">
|
<h2 class="ui inverted teal fluid image header logo">
|
||||||
lan<?php include 'logo.svg'; ?>can
|
lan<?php include 'logo.svg'; ?>can
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<?php if(isset($errorMessage)) { ?>
|
<?php if (isset($errorMessage)) { ?>
|
||||||
<div class="ui negative message">
|
<div class="ui negative message">
|
||||||
<i class="close icon"></i>
|
<i class="close icon"></i>
|
||||||
<div class="header">Erreur</div>
|
<div class="header">Erreur</div>
|
||||||
<p><?=$errorMessage?></p>
|
<p><?= $errorMessage ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
|
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
|
||||||
<div class="ui left aligned stacked segment inverted">
|
<div class="ui left aligned stacked segment inverted">
|
||||||
@ -46,8 +46,8 @@ body > .grid {
|
|||||||
<div class="inverted field">
|
<div class="inverted field">
|
||||||
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
|
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
|
||||||
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
|
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
|
||||||
<?php
|
<?php
|
||||||
if (file_exists($SCANSDIR)) {
|
if (file_exists($SCANSDIR)) {
|
||||||
foreach (scandir($SCANSDIR) as $filename) {
|
foreach (scandir($SCANSDIR) as $filename) {
|
||||||
if (substr($filename, -4) === '.xml') {
|
if (substr($filename, -4) === '.xml') {
|
||||||
$name = substr($filename, 0, -4);
|
$name = substr($filename, 0, -4);
|
||||||
@ -55,8 +55,8 @@ if (file_exists($SCANSDIR)) {
|
|||||||
echo " <option value='$name'>$name</option>\n";
|
echo " <option value='$name'>$name</option>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui error message"></div>
|
<div class="ui error message"></div>
|
||||||
@ -72,7 +72,10 @@ if (file_exists($SCANSDIR)) {
|
|||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
|
$('#lanSelect').dropdown({
|
||||||
|
allowAdditions: true,
|
||||||
|
clearable: true
|
||||||
|
})
|
||||||
|
|
||||||
$('#scanForm').form({
|
$('#scanForm').form({
|
||||||
fields: {
|
fields: {
|
||||||
@ -91,13 +94,13 @@ if (file_exists($SCANSDIR)) {
|
|||||||
if (this.checkValidity()) {
|
if (this.checkValidity()) {
|
||||||
scanForm.classList.add("loading")
|
scanForm.classList.add("loading")
|
||||||
$.toast({
|
$.toast({
|
||||||
title : 'Scan en cours...',
|
title: 'Scan en cours...',
|
||||||
message : 'Merci de patienter',
|
message: 'Merci de patienter',
|
||||||
class : 'info',
|
class: 'info',
|
||||||
showIcon : 'satellite dish',
|
showIcon: 'satellite dish',
|
||||||
displayTime: 0,
|
displayTime: 0,
|
||||||
closeIcon : true,
|
closeIcon: true,
|
||||||
position : 'bottom right',
|
position: 'bottom right',
|
||||||
})
|
})
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
@ -105,7 +108,6 @@ if (file_exists($SCANSDIR)) {
|
|||||||
this.reportValidity()
|
this.reportValidity()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
121
name.php
Normal file
121
name.php
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?php include_once "config.php"; ?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>lanScan</title>
|
||||||
|
<link rel="icon" href="favicon.ico" />
|
||||||
|
<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="style.css" />
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-image: url(bg.jpg);
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
body>.grid {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="ui center aligned inverted grid">
|
||||||
|
<div class="column" style="max-width: 450px;">
|
||||||
|
<h2 class="ui inverted teal fluid image header logo" style="margin-top: 15vh">
|
||||||
|
lan<?php include 'logo.svg'; ?>can
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<?php if (isset($errorMessage)) { ?>
|
||||||
|
<div class="ui negative message">
|
||||||
|
<i class="close icon"></i>
|
||||||
|
<div class="header">Erreur</div>
|
||||||
|
<p><?= $errorMessage ?></p>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
|
||||||
|
<div class="ui left aligned stacked segment inverted">
|
||||||
|
<h4 class="ui header">Découvrir ou superviser un réseau</h4>
|
||||||
|
<div class="inverted field">
|
||||||
|
<div class="ui large input">
|
||||||
|
<input id="nameInput" type="text" name="lan" placeholder="<?= $_SERVER['REMOTE_ADDR']; ?>" list="targetsList" pattern="[a-zA-Z0-9._\/ \-]+" required
|
||||||
|
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" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="nameInput">Enregistrer sous le nom (optionnel)</label>
|
||||||
|
<div class="ui small input">
|
||||||
|
<input id="nameInput" type="text" name="name" placeholder="Réseau local" pattern='[^<>:"\\\/\|@?]+'
|
||||||
|
title="Caractères interdits : <>:"\/|@?">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ui error message"></div>
|
||||||
|
<button type="submit" class="ui fluid large teal labeled icon submit button">
|
||||||
|
<i class="satellite dish icon"></i>Scanner
|
||||||
|
</button>
|
||||||
|
<div class="ui divider"></div>
|
||||||
|
<a href="options.php">Options avancées</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php if (file_exists($SCANSDIR)) { ?>
|
||||||
|
<div class="ui inverted fluid card" style="margin-top: 10vh">
|
||||||
|
<div class="content">
|
||||||
|
<div class="header">Scans enregistrés</div>
|
||||||
|
</div>
|
||||||
|
<table class="ui very basic inverted table">
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach (scandir($SCANSDIR) as $filename) {
|
||||||
|
if (substr($filename, -4) == '.xml') {
|
||||||
|
$name = str_replace('!', '/', substr_replace($filename, '', -4));
|
||||||
|
echo "<tr><td class='selectable'><a href='$SCANSDIR/" . rawurlencode($filename) . "'>$name</a></td><td><a href='rescan.php?name=$name' class='ui mini labelled button'><i class='sync icon'></i>Rescanner</a></td></tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<datalist id='targetsList'>
|
||||||
|
<option value="<?= $_SERVER['REMOTE_ADDR']; ?>/24"></option>
|
||||||
|
<option value="<?= $_SERVER['SERVER_NAME']; ?>"></option>
|
||||||
|
</datalist>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
|
||||||
|
<script>
|
||||||
|
scanForm.onsubmit = function(event) {
|
||||||
|
if (this.checkValidity()) {
|
||||||
|
scanForm.classList.add("loading")
|
||||||
|
$.toast({
|
||||||
|
title: 'Scan en cours...',
|
||||||
|
message: 'Merci de patienter',
|
||||||
|
class: 'info',
|
||||||
|
showIcon: 'satellite dish',
|
||||||
|
displayTime: 0,
|
||||||
|
closeIcon: true,
|
||||||
|
position: 'bottom right',
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
event.preventDefault()
|
||||||
|
this.reportValidity()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html
|
20
options.php
20
options.php
@ -1,7 +1,7 @@
|
|||||||
<!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" />
|
||||||
@ -13,9 +13,9 @@
|
|||||||
<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 secondary menu">
|
<nav class="ui inverted secondary menu">
|
||||||
<a href="." class="ui header button item logo">lan<?php include 'logo.svg'; ?>can</a>
|
<a href="." class="ui header button item logo">lan<?php include 'logo.svg'; ?>can</a>
|
||||||
<div class="right menu">
|
<div class="right menu">
|
||||||
@ -577,7 +577,6 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="inverted field">
|
|
||||||
<div class="two inverted fields">
|
<div class="two inverted fields">
|
||||||
<div class="inverted field">
|
<div class="inverted field">
|
||||||
<label for="mtu" title="--mtu">Taille des paquets</label>
|
<label for="mtu" title="--mtu">Taille des paquets</label>
|
||||||
@ -589,7 +588,6 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
|||||||
<input type="number" id="d" name="-d" min="0">
|
<input type="number" id="d" name="-d" min="0">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="inverted field">
|
<div class="inverted field">
|
||||||
<label for="g" title="-g">Port source</label>
|
<label for="g" title="-g">Port source</label>
|
||||||
@ -741,10 +739,14 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
|||||||
}
|
}
|
||||||
new TagsInput(dnsServersInput)
|
new TagsInput(dnsServersInput)
|
||||||
new TagsInput(scanflagsInput)
|
new TagsInput(scanflagsInput)
|
||||||
new TagsInput(scriptInput, { enforceWhitelist: true })
|
new TagsInput(scriptInput, {
|
||||||
new TagsInput(scriptArgsInput, { delimiters: ',' })
|
enforceWhitelist: true
|
||||||
|
})
|
||||||
|
new TagsInput(scriptArgsInput, {
|
||||||
|
delimiters: ','
|
||||||
|
})
|
||||||
|
|
||||||
newScanForm.onsubmit = function (event) {
|
newScanForm.onsubmit = function(event) {
|
||||||
if (this.checkValidity()) {
|
if (this.checkValidity()) {
|
||||||
newScanForm.classList.add("loading")
|
newScanForm.classList.add("loading")
|
||||||
$.toast({
|
$.toast({
|
||||||
@ -763,6 +765,6 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
32
rescan.php
Normal file
32
rescan.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
|
ini_set('display_startup_errors', '1');
|
||||||
|
|
||||||
|
include_once 'config.php';
|
||||||
|
|
||||||
|
$fileNameRegex = '/^[^<>:\/|?]+$/';
|
||||||
|
|
||||||
|
$name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||||
|
if (!$name) {
|
||||||
|
die("Paramètre manquant : name");
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = "$SCANSDIR/$name.xml";
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
die("Scan inconnu : $name");
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml = simplexml_load_file($path);
|
||||||
|
$cmd = $xml["args"];
|
||||||
|
if (substr( $cmd, 0, 5 ) != "nmap ") {
|
||||||
|
die("Erreur : $path n'est pas un fichier de scan nmap");
|
||||||
|
}
|
||||||
|
|
||||||
|
$cmd = $NMAP . substr($xml["args"], 4);
|
||||||
|
|
||||||
|
header('Content-type: text/xml');
|
||||||
|
system("$cmd", $retcode);
|
||||||
|
|
||||||
|
exit();
|
32
scan.php
32
scan.php
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
include_once 'config.php';
|
include_once 'config.php';
|
||||||
|
|
||||||
|
$fileNameRegex = '/^[^<>:\/|?]+$/';
|
||||||
$targetsListRegex = '/^[\da-zA-Z-. \/]+$/';
|
$targetsListRegex = '/^[\da-zA-Z-. \/]+$/';
|
||||||
|
|
||||||
|
$name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||||
|
|
||||||
$lan = filter_input(INPUT_GET, 'lan', 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]);
|
||||||
if ($lan) {
|
if ($lan) {
|
||||||
$cmd = "$NMAP $LANSCANOPTIONS $lan";
|
$cmd = "$NMAP $LANSCANOPTIONS $lan";
|
||||||
@ -22,13 +25,12 @@ if ($targets) {
|
|||||||
$protocolePortsListRegex = '/^(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*$/';
|
$protocolePortsListRegex = '/^(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*$/';
|
||||||
$portsListRegex = '/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/';
|
$portsListRegex = '/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/';
|
||||||
$tempoRegex = '/^\d+[smh]?$/';
|
$tempoRegex = '/^\d+[smh]?$/';
|
||||||
$fileNameRegex = '/^[^<>:\/|?]+$/';
|
|
||||||
|
|
||||||
$inputs = filter_input_array(INPUT_GET, [
|
$inputs = filter_input_array(INPUT_GET, [
|
||||||
// TARGET SPECIFICATION:
|
// TARGET SPECIFICATION:
|
||||||
'-iR' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
'-iR' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
'--exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
'--exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||||
// HOST DISCOVERY:
|
// HOST DISCOVERY:
|
||||||
'-sL' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
'-sL' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||||
'-sP' => FILTER_VALIDATE_BOOLEAN,
|
'-sP' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'-P0' => FILTER_VALIDATE_BOOLEAN,
|
'-P0' => FILTER_VALIDATE_BOOLEAN,
|
||||||
@ -45,7 +47,7 @@ if ($targets) {
|
|||||||
'-n' => FILTER_VALIDATE_BOOLEAN,
|
'-n' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'-R' => FILTER_VALIDATE_BOOLEAN,
|
'-R' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--dns-servers' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
'--dns-servers' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||||
// SCAN TECHNIQUES:
|
// SCAN TECHNIQUES:
|
||||||
'-sS' => FILTER_VALIDATE_BOOLEAN,
|
'-sS' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'-sT' => FILTER_VALIDATE_BOOLEAN,
|
'-sT' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'-sA' => FILTER_VALIDATE_BOOLEAN,
|
'-sA' => FILTER_VALIDATE_BOOLEAN,
|
||||||
@ -61,28 +63,28 @@ if ($targets) {
|
|||||||
'-b' => FILTER_VALIDATE_URL,
|
'-b' => FILTER_VALIDATE_URL,
|
||||||
'--traceroute' => FILTER_VALIDATE_BOOLEAN,
|
'--traceroute' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--reason' => FILTER_VALIDATE_BOOLEAN,
|
'--reason' => FILTER_VALIDATE_BOOLEAN,
|
||||||
// PORT SPECIFICATION AND SCAN ORDER:
|
// PORT SPECIFICATION AND SCAN ORDER:
|
||||||
'-p' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
|
'-p' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
|
||||||
'-F' => FILTER_VALIDATE_BOOLEAN,
|
'-F' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'-r' => FILTER_VALIDATE_BOOLEAN,
|
'-r' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--top-ports' => FILTER_VALIDATE_INT,
|
'--top-ports' => FILTER_VALIDATE_INT,
|
||||||
'--port-ratio' => ['filter' => FILTER_VALIDATE_FLOAT, 'options' => ['min_range' => 0, 'max_range' => 1]],
|
'--port-ratio' => ['filter' => FILTER_VALIDATE_FLOAT, 'options' => ['min_range' => 0, 'max_range' => 1]],
|
||||||
// SERVICE/VERSION DETECTION:
|
// SERVICE/VERSION DETECTION:
|
||||||
'-sV' => FILTER_VALIDATE_BOOLEAN,
|
'-sV' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--version-light' => FILTER_VALIDATE_BOOLEAN,
|
'--version-light' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--version-intensity' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 9]],
|
'--version-intensity' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 9]],
|
||||||
'--version-all' => FILTER_VALIDATE_BOOLEAN,
|
'--version-all' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--version-trace' => FILTER_VALIDATE_BOOLEAN,
|
'--version-trace' => FILTER_VALIDATE_BOOLEAN,
|
||||||
// SCRIPT SCAN:
|
// SCRIPT SCAN:
|
||||||
'-sC' => FILTER_VALIDATE_BOOLEAN,
|
'-sC' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--script' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-z][a-z0-9,\-\.\/]*$/']],
|
'--script' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-z][a-z0-9,\-\.\/]*$/']],
|
||||||
'--script-args' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^([a-zA-Z][a-zA-Z0-9\-_]*=[^"]+(,[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+)?)$/']],
|
'--script-args' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^([a-zA-Z][a-zA-Z0-9\-_]*=[^"]+(,[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+)?)$/']],
|
||||||
// OS DETECTION:
|
// OS DETECTION:
|
||||||
'-O' => FILTER_VALIDATE_BOOLEAN,
|
'-O' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--osscan-limit' => FILTER_VALIDATE_BOOLEAN,
|
'--osscan-limit' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--osscan-guess' => FILTER_VALIDATE_BOOLEAN,
|
'--osscan-guess' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--max-os-tries' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
'--max-os-tries' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
// TIMING AND PERFORMANCE:
|
// TIMING AND PERFORMANCE:
|
||||||
'-T' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 5]],
|
'-T' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 5]],
|
||||||
'--min-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
'--min-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
'--max-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
'--max-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
@ -95,7 +97,7 @@ if ($targets) {
|
|||||||
'--host-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
'--host-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
||||||
'--scan-delay' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
'--scan-delay' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
||||||
'--max-scan-delay' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
'--max-scan-delay' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
||||||
// FIREWALL/IDS EVASION AND SPOOFING:
|
// FIREWALL/IDS EVASION AND SPOOFING:
|
||||||
'-f' => FILTER_VALIDATE_INT,
|
'-f' => FILTER_VALIDATE_INT,
|
||||||
'--mtu' => FILTER_VALIDATE_INT,
|
'--mtu' => FILTER_VALIDATE_INT,
|
||||||
'-D' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
'-D' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||||
@ -108,7 +110,7 @@ if ($targets) {
|
|||||||
'--ttl' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 255]],
|
'--ttl' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 255]],
|
||||||
'--spoof-mac' => FILTER_VALIDATE_MAC,
|
'--spoof-mac' => FILTER_VALIDATE_MAC,
|
||||||
'--badsum' => FILTER_VALIDATE_BOOLEAN,
|
'--badsum' => FILTER_VALIDATE_BOOLEAN,
|
||||||
// MISC:
|
// MISC:
|
||||||
// '6' => FILTER_VALIDATE_BOOLEAN,
|
// '6' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'-A' => FILTER_VALIDATE_BOOLEAN,
|
'-A' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--send-eth' => FILTER_VALIDATE_BOOLEAN,
|
'--send-eth' => FILTER_VALIDATE_BOOLEAN,
|
||||||
@ -117,7 +119,7 @@ if ($targets) {
|
|||||||
'--unprivileged' => FILTER_VALIDATE_BOOLEAN,
|
'--unprivileged' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'-h' => FILTER_VALIDATE_BOOLEAN,
|
'-h' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'--stylesheet' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
|
'--stylesheet' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
|
||||||
// lanScan
|
// lanScan
|
||||||
'name' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
|
'name' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
|
||||||
'originalURL' => FILTER_VALIDATE_URL,
|
'originalURL' => FILTER_VALIDATE_URL,
|
||||||
'refreshPeriod' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
'refreshPeriod' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
@ -148,10 +150,12 @@ if ($targets) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($cmd) {
|
if ($cmd) {
|
||||||
|
if ($name) {
|
||||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||||
$path = "$SCANSDIR/$filename.xml";
|
|
||||||
|
|
||||||
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
$path = "$SCANSDIR/" . escapeshellarg($name) . ".xml";
|
||||||
|
$cmd .= " | tee '$path'";
|
||||||
|
}
|
||||||
|
|
||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml');
|
||||||
system("$cmd", $retcode);
|
system("$cmd", $retcode);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user