presets
This commit is contained in:
parent
a1aeefee47
commit
6c33080785
33
config.php
33
config.php
@ -1,24 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$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']);
|
||||||
|
$SCANSDIR = 'scans';
|
||||||
|
$DATADIR = '/usr/share/nmap';
|
||||||
|
|
||||||
$LANSCAN_OPTIONS = [
|
$presets = [
|
||||||
'PS' => 'microsoft-ds',
|
"lan" => [
|
||||||
'F' => true,
|
'PS' => 'microsoft-ds',
|
||||||
'T5' => true,
|
'F' => true,
|
||||||
'stylesheet' => "$BASEDIR/lanScan.xsl"
|
'T5' => true,
|
||||||
];
|
'stylesheet' => "$BASEDIR/lanScan.xsl"
|
||||||
|
],
|
||||||
$HOSTSCAN_OPTIONS = [
|
"host" => [
|
||||||
'Pn' => true,
|
'Pn' => true,
|
||||||
'F' => true,
|
'F' => true,
|
||||||
'sV' => true,
|
'sV' => true,
|
||||||
'T5' => true,
|
'T5' => true,
|
||||||
'stylesheet' => "$BASEDIR/hostScan.xsl"
|
'stylesheet' => "$BASEDIR/hostScan.xsl"
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$saveAs = null;
|
||||||
|
$compareWith = null;
|
||||||
$refreshPeriod = 60;
|
$refreshPeriod = 60;
|
||||||
$sudo = true;
|
$sudo = true;
|
||||||
|
|
||||||
$SCANSDIR = 'scans';
|
|
||||||
$DATADIR = '/usr/share/nmap';
|
|
||||||
|
@ -9,16 +9,11 @@ $portsListRegex = "/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/";
|
|||||||
$tempoRegex = "/^\d+[smh]?$/";
|
$tempoRegex = "/^\d+[smh]?$/";
|
||||||
$fileNameRegex = '/^[^<>:"\/|?]+$/';
|
$fileNameRegex = '/^[^<>:"\/|?]+$/';
|
||||||
|
|
||||||
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
$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]);
|
$preset = filter_input(INPUT_GET, "preset");
|
||||||
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
|
||||||
|
|
||||||
if ($lan) {
|
if ($preset && isset($presets[$preset])) {
|
||||||
$targets = $lan;
|
$args = $presets[$preset];
|
||||||
$args = $LANSCAN_OPTIONS;
|
|
||||||
} else if ($host) {
|
|
||||||
$targets = $host;
|
|
||||||
$args = $HOSTSCAN_OPTIONS;
|
|
||||||
} else {
|
} else {
|
||||||
$args = filter_input_array(INPUT_GET, [
|
$args = filter_input_array(INPUT_GET, [
|
||||||
'iR' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
'iR' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
@ -111,7 +106,7 @@ if ($lan) {
|
|||||||
'unprivileged' => FILTER_VALIDATE_BOOLEAN,
|
'unprivileged' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'h' => FILTER_VALIDATE_BOOLEAN,
|
'h' => FILTER_VALIDATE_BOOLEAN,
|
||||||
'stylesheet' => FILTER_VALIDATE_URL,
|
'stylesheet' => FILTER_VALIDATE_URL,
|
||||||
], false) ?: $LANSCAN_OPTIONS;
|
], false) ?: $presets["lan"];
|
||||||
|
|
||||||
$saveAs = filter_input(INPUT_GET, 'saveAs', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex]]);
|
$saveAs = filter_input(INPUT_GET, 'saveAs', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex]]);
|
||||||
$compareWith = filter_input(INPUT_GET, 'compareWith', FILTER_VALIDATE_URL);
|
$compareWith = filter_input(INPUT_GET, 'compareWith', FILTER_VALIDATE_URL);
|
||||||
|
@ -169,7 +169,7 @@ $.toast({
|
|||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
hiddenButton.onclick = function(event) {
|
hiddenButton.onclick = function(event) {
|
||||||
if (lanScanForm.form.checkValidity()) {
|
if (lanScanForm.checkValidity()) {
|
||||||
targetsInputDiv.classList.add('loading')
|
targetsInputDiv.classList.add('loading')
|
||||||
$.toast({
|
$.toast({
|
||||||
title : 'Scan en cours...',
|
title : 'Scan en cours...',
|
||||||
@ -308,7 +308,7 @@ function hostScanning(link) {
|
|||||||
<td>
|
<td>
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="class">
|
<xsl:attribute name="class">
|
||||||
<xsl:text>ui mini button </xsl:text>
|
<xsl:text>ui mini fluid button </xsl:text>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
|
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
|
||||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">orange</xsl:when>
|
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">orange</xsl:when>
|
||||||
|
12
index.php
12
index.php
@ -1,7 +1,4 @@
|
|||||||
<?php
|
<?php include_once "config.php"; ?>
|
||||||
include_once 'config.php';
|
|
||||||
include_once 'filter_inputs.php';
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr">
|
<html lang="fr">
|
||||||
|
|
||||||
@ -24,10 +21,11 @@ include_once 'filter_inputs.php';
|
|||||||
lan<?php include 'logo.svg'; ?>can
|
lan<?php include 'logo.svg'; ?>can
|
||||||
</a>
|
</a>
|
||||||
<form id="lanScanForm" class="right menu">
|
<form id="lanScanForm" class="right menu">
|
||||||
|
<input type="hidden" name="preset" value="lan"/>
|
||||||
<div class="ui category search item">
|
<div class="ui category search item">
|
||||||
<div id="targetsInputDiv" class="ui icon input">
|
<div id="targetsInputDiv" class="ui icon input">
|
||||||
<input class="prompt" type="text" id="targetsInput" name="lan"
|
<input class="prompt" type="text" id="targetsInput" name="targets"
|
||||||
pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $targets; ?>" placeholder="Scanner un réseau..."
|
pattern="[a-zA-Z0-9._\/ \-]+" 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>
|
||||||
@ -64,7 +62,7 @@ foreach (scandir($SCANSDIR) as $filename) {
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
hiddenButton.onclick = (event) => {
|
hiddenButton.onclick = (event) => {
|
||||||
if (lanScanForm.form.checkValidity()) {
|
if (lanScanForm.checkValidity()) {
|
||||||
targetsInputDiv.classList.add('loading')
|
targetsInputDiv.classList.add('loading')
|
||||||
$.toast({
|
$.toast({
|
||||||
title: 'Scan en cours...',
|
title: 'Scan en cours...',
|
||||||
|
@ -189,7 +189,7 @@ $.toast({
|
|||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
hiddenButton.onclick = function(event) {
|
hiddenButton.onclick = function(event) {
|
||||||
if (lanScanForm.form.checkValidity()) {
|
if (lanScanForm.checkValidity()) {
|
||||||
targetsInputDiv.classList.add('loading')
|
targetsInputDiv.classList.add('loading')
|
||||||
$.toast({
|
$.toast({
|
||||||
title : 'Scan en cours...',
|
title : 'Scan en cours...',
|
||||||
@ -292,7 +292,7 @@ function hostScanning(link) {
|
|||||||
<a class="ui mini icon teal button" onclick="hostScanning(this)">
|
<a class="ui mini icon teal button" onclick="hostScanning(this)">
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="$basedir"/>
|
<xsl:value-of select="$basedir"/>
|
||||||
<xsl:text>/scan.php?host=</xsl:text>
|
<xsl:text>/scan.php?preset=host&targets=</xsl:text>
|
||||||
<xsl:value-of select="$hostAddress"/>
|
<xsl:value-of select="$hostAddress"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<i class="satellite dish icon"></i>
|
<i class="satellite dish icon"></i>
|
||||||
@ -301,7 +301,7 @@ function hostScanning(link) {
|
|||||||
<a class="ui mini icon teal label">
|
<a class="ui mini icon teal label">
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="$basedir"/>
|
<xsl:value-of select="$basedir"/>
|
||||||
<xsl:text>/options.php?host=</xsl:text>
|
<xsl:text>/options.php?preset=host&targets=</xsl:text>
|
||||||
<xsl:value-of select="$hostAddress"/>
|
<xsl:value-of select="$hostAddress"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<i class="sliders horizontal icon"></i>
|
<i class="sliders horizontal icon"></i>
|
||||||
|
@ -43,7 +43,7 @@ include_once 'filter_inputs.php';
|
|||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<h1 class="header">Scanner un <?=$host? "hôte" : "réseau" ?></h1>
|
<h1 class="header">Scanner un <?=$preset == "host"? "hôte" : "réseau" ?></h1>
|
||||||
|
|
||||||
<form id="newScanForm" class="ui form" method="get" action="scan.php">
|
<form id="newScanForm" class="ui form" method="get" action="scan.php">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
Reference in New Issue
Block a user