url
This commit is contained in:
parent
ae0abc39cf
commit
efed32d11d
102
home.php
Normal file
102
home.php
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?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 > .grid {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="ui middle aligned center aligned grid inverted">
|
||||||
|
<div class="column" style="max-width: 450px;">
|
||||||
|
<h2 class="ui inverted teal fluid image header logo">
|
||||||
|
lan<?php include 'logo.svg'; ?>can
|
||||||
|
</h2>
|
||||||
|
<form id="scanForm" class="ui large form initial inverted" action="." 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">
|
||||||
|
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
|
||||||
|
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
|
||||||
|
<?php
|
||||||
|
if (file_exists($SCANDIR)) {
|
||||||
|
foreach (scandir($SCANDIR) as $filename) {
|
||||||
|
if (substr($filename, -4) === '.xml') {
|
||||||
|
$name = substr($filename, 0, -4);
|
||||||
|
$name = str_replace("!", "/", $name);
|
||||||
|
echo " <option value='$name'>$name</option>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</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>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="ui inverted segment">
|
||||||
|
<a href="options.php">Options avancées</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/semantic-ui/dist/semantic.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
|
||||||
|
|
||||||
|
$('#scanForm').form({
|
||||||
|
fields: {
|
||||||
|
lan: {
|
||||||
|
identifier: 'lanSelect',
|
||||||
|
rules: [{
|
||||||
|
type: 'regExp',
|
||||||
|
value: /[a-zA-Z0-9._\/ \-]+/,
|
||||||
|
prompt: "Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.<br/>Exemples : <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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
|
123
index.php
123
index.php
@ -1,102 +1,37 @@
|
|||||||
<?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 > .grid {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
margin-right: 0 !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="ui middle aligned center aligned grid inverted">
|
|
||||||
<div class="column" style="max-width: 450px;">
|
|
||||||
<h2 class="ui inverted teal fluid image header logo">
|
|
||||||
lan<?php include 'logo.svg'; ?>can
|
|
||||||
</h2>
|
|
||||||
<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">
|
|
||||||
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
|
|
||||||
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
|
|
||||||
<?php
|
<?php
|
||||||
if (file_exists($SCANDIR)) {
|
|
||||||
foreach (scandir($SCANDIR) as $filename) {
|
include_once 'config.php';
|
||||||
if (substr($filename, -4) === '.xml') {
|
|
||||||
$name = substr($filename, 0, -4);
|
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||||
$name = str_replace("!", "/", $name);
|
if ($lan) {
|
||||||
echo " <option value='$name'>$name</option>\n";
|
$cmd = "$lanScanCmd $lan";
|
||||||
}
|
|
||||||
}
|
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||||
|
$filename = str_replace("/", "!", $lan);
|
||||||
|
$path = "$SCANSDIR/$filename.xml";
|
||||||
|
|
||||||
|
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
||||||
|
|
||||||
|
header('Content-type: text/xml');
|
||||||
|
system("$cmd", $retcode);
|
||||||
|
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</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>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class="ui inverted segment">
|
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||||
<a href="options.php">Options avancées</a>
|
if ($host) {
|
||||||
</div>
|
$cmd = "$hostScanCmd $host";
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||||
<script src="https://cdn.jsdelivr.net/npm/semantic-ui/dist/semantic.min.js"></script>
|
$filename = str_replace("/", "!", $host);
|
||||||
<script>
|
$path = "$SCANSDIR/$filename.xml";
|
||||||
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
|
|
||||||
|
|
||||||
$('#scanForm').form({
|
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
||||||
fields: {
|
|
||||||
lan: {
|
|
||||||
identifier: 'lanSelect',
|
|
||||||
rules: [{
|
|
||||||
type: 'regExp',
|
|
||||||
value: /[a-zA-Z0-9._\/ \-]+/,
|
|
||||||
prompt: "Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.<br/>Exemples : <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
scanForm.onsubmit = function(event) {
|
header('Content-type: text/xml');
|
||||||
if (this.checkValidity()) {
|
system("$cmd", $retcode);
|
||||||
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>
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
</body>
|
include "home.php";
|
||||||
|
|
||||||
</html
|
|
35
scan.php
35
scan.php
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
include_once 'config.php';
|
|
||||||
|
|
||||||
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
|
||||||
if ($lan) {
|
|
||||||
$cmd = "$lanScanCmd $lan";
|
|
||||||
|
|
||||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
|
||||||
$filename = str_replace("/", "!", $lan);
|
|
||||||
$path = "$SCANSDIR/$filename.xml";
|
|
||||||
|
|
||||||
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
|
||||||
|
|
||||||
header('Content-type: text/xml');
|
|
||||||
system("$cmd", $retcode);
|
|
||||||
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
|
||||||
if ($host) {
|
|
||||||
$cmd = "$hostScanCmd $host";
|
|
||||||
|
|
||||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
|
||||||
$filename = str_replace("/", "!", $host);
|
|
||||||
$path = "$SCANSDIR/$filename.xml";
|
|
||||||
|
|
||||||
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
|
||||||
|
|
||||||
header('Content-type: text/xml');
|
|
||||||
system("$cmd", $retcode);
|
|
||||||
|
|
||||||
exit();
|
|
||||||
}
|
|
@ -5,6 +5,7 @@
|
|||||||
version="1.1">
|
version="1.1">
|
||||||
|
|
||||||
<xsl:import href="head.xsl" />
|
<xsl:import href="head.xsl" />
|
||||||
|
<xsl:import href="nav.xsl" />
|
||||||
<xsl:import href="services.xsl" />
|
<xsl:import href="services.xsl" />
|
||||||
<xsl:import href="toast.xsl" />
|
<xsl:import href="toast.xsl" />
|
||||||
|
|
||||||
@ -153,7 +154,7 @@ $('.ui.dropdown').dropdown()
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="ui mini icon teal icon button" target="_blank">
|
<a class="ui mini icon teal icon button" target="_blank">
|
||||||
<xsl:attribute name="href">scan.php?host=<xsl:value-of select="$hostAddress" /></xsl:attribute>
|
<xsl:attribute name="href">?host=<xsl:value-of select="$hostAddress" /></xsl:attribute>
|
||||||
<i class="search plus icon"></i>
|
<i class="search plus icon"></i>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user