undo URL
This commit is contained in:
parent
eeba9d613b
commit
13f42cad36
123
index.php
123
index.php
@ -1,37 +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="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($SCANSDIR)) {
|
||||||
include_once 'config.php';
|
foreach (scandir($SCANSDIR) as $filename) {
|
||||||
|
if (substr($filename, -4) === '.xml') {
|
||||||
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
$name = substr($filename, 0, -4);
|
||||||
if ($lan) {
|
$name = str_replace("!", "/", $name);
|
||||||
$cmd = "$lanScanCmd $lan";
|
echo " <option value='$name'>$name</option>\n";
|
||||||
|
}
|
||||||
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>
|
||||||
|
|
||||||
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
<div class="ui inverted segment">
|
||||||
if ($host) {
|
<a href="options.php">Options avancées</a>
|
||||||
$cmd = "$hostScanCmd $host";
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
$filename = str_replace("/", "!", $host);
|
<script src="https://cdn.jsdelivr.net/npm/semantic-ui/dist/semantic.min.js"></script>
|
||||||
$path = "$SCANSDIR/$filename.xml";
|
<script>
|
||||||
|
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
|
||||||
|
|
||||||
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
$('#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"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
header('Content-type: text/xml');
|
scanForm.onsubmit = function(event) {
|
||||||
system("$cmd", $retcode);
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exit();
|
</script>
|
||||||
}
|
|
||||||
|
|
||||||
include "home.php";
|
</body>
|
||||||
|
|
||||||
|
</html
|
37
scan.php
Normal file
37
scan.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?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();
|
||||||
|
}
|
||||||
|
|
||||||
|
include "index.php";
|
31
scans/scanme.nmap.org.xml
Normal file
31
scans/scanme.nmap.org.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE nmaprun>
|
||||||
|
<?xml-stylesheet href="https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl" type="text/xsl"?>
|
||||||
|
<!-- Nmap 7.93 scan initiated Tue Feb 4 03:30:34 2025 as: nmap -PSmicrosoft-ds -F -T5 -oX - --stylesheet https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl scanme.nmap.org -->
|
||||||
|
<nmaprun scanner="nmap" args="nmap -PSmicrosoft-ds -F -T5 -oX - --stylesheet https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl scanme.nmap.org" start="1738636234" startstr="Tue Feb 4 03:30:34 2025" version="7.93" xmloutputversion="1.05">
|
||||||
|
<scaninfo type="syn" protocol="tcp" numservices="100" services="7,9,13,21-23,25-26,37,53,79-81,88,106,110-111,113,119,135,139,143-144,179,199,389,427,443-445,465,513-515,543-544,548,554,587,631,646,873,990,993,995,1025-1029,1110,1433,1720,1723,1755,1900,2000-2001,2049,2121,2717,3000,3128,3306,3389,3986,4899,5000,5009,5051,5060,5101,5190,5357,5432,5631,5666,5800,5900,6000-6001,6646,7070,8000,8008-8009,8080-8081,8443,8888,9100,9999-10000,32768,49152-49157"/>
|
||||||
|
<verbose level="0"/>
|
||||||
|
<debugging level="0"/>
|
||||||
|
<hosthint><status state="up" reason="unknown-response" reason_ttl="0"/>
|
||||||
|
<address addr="45.33.32.156" addrtype="ipv4"/>
|
||||||
|
<hostnames>
|
||||||
|
<hostname name="scanme.nmap.org" type="user"/>
|
||||||
|
</hostnames>
|
||||||
|
</hosthint>
|
||||||
|
<host starttime="1738636234" endtime="1738636234"><status state="up" reason="reset" reason_ttl="48"/>
|
||||||
|
<address addr="45.33.32.156" addrtype="ipv4"/>
|
||||||
|
<hostnames>
|
||||||
|
<hostname name="scanme.nmap.org" type="user"/>
|
||||||
|
<hostname name="scanme.nmap.org" type="PTR"/>
|
||||||
|
</hostnames>
|
||||||
|
<ports><extraports state="closed" count="98">
|
||||||
|
<extrareasons reason="reset" count="98" proto="tcp" ports="7,9,13,21,23,25-26,37,53,79,81,88,106,110-111,113,119,135,139,143-144,179,199,389,427,443-445,465,513-515,543-544,548,554,587,631,646,873,990,993,995,1025-1029,1110,1433,1720,1723,1755,1900,2000-2001,2049,2121,2717,3000,3128,3306,3389,3986,4899,5000,5009,5051,5060,5101,5190,5357,5432,5631,5666,5800,5900,6000-6001,6646,7070,8000,8008-8009,8080-8081,8443,8888,9100,9999-10000,32768,49152-49157"/>
|
||||||
|
</extraports>
|
||||||
|
<port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="48"/><service name="ssh" method="table" conf="3"/></port>
|
||||||
|
<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="48"/><service name="http" method="table" conf="3"/></port>
|
||||||
|
</ports>
|
||||||
|
<times srtt="153298" rttvar="2254" to="162314"/>
|
||||||
|
</host>
|
||||||
|
<runstats><finished time="1738636234" timestr="Tue Feb 4 03:30:34 2025" summary="Nmap done at Tue Feb 4 03:30:34 2025; 1 IP address (1 host up) scanned in 1.05 seconds" elapsed="1.05" exit="success"/><hosts up="1" down="0" total="1"/>
|
||||||
|
</runstats>
|
||||||
|
</nmaprun>
|
@ -24,10 +24,11 @@
|
|||||||
<xsl:variable name="init"
|
<xsl:variable name="init"
|
||||||
select="document(concat($base, 'scans/', translate($targets,'/', '!'), '.xml'))/nmaprun" />
|
select="document(concat($base, 'scans/', translate($targets,'/', '!'), '.xml'))/nmaprun" />
|
||||||
|
|
||||||
<html lang="fr">
|
<html
|
||||||
|
lang="fr">
|
||||||
<xsl:apply-templates select="." mode="head">
|
<xsl:apply-templates select="." mode="head">
|
||||||
<xsl:with-param name="base" select="$base"/>
|
<xsl:with-param name="base" select="$base" />
|
||||||
<xsl:with-param name="targets" select="$targets"/>
|
<xsl:with-param name="targets" select="$targets" />
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -78,7 +79,7 @@ table.order([1, 'asc']).draw()
|
|||||||
$('.ui.dropdown').dropdown()
|
$('.ui.dropdown').dropdown()
|
||||||
</script>
|
</script>
|
||||||
<xsl:apply-templates select="runstats">
|
<xsl:apply-templates select="runstats">
|
||||||
<xsl:with-param name="init" select="$init"/>
|
<xsl:with-param name="init" select="$init" />
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
@ -143,18 +144,20 @@ $('.ui.dropdown').dropdown()
|
|||||||
<td>
|
<td>
|
||||||
<xsl:value-of select="address[@addrtype='mac']/@vendor" />
|
<xsl:value-of select="address[@addrtype='mac']/@vendor" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<xsl:apply-templates select="$initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')] | $currentHost/ports/port" mode="service">
|
<xsl:apply-templates
|
||||||
<xsl:with-param name="initHost" select="$initHost"/>
|
select="$initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')] | $currentHost/ports/port"
|
||||||
<xsl:with-param name="currentHost" select="$currentHost"/>
|
mode="service">
|
||||||
<xsl:with-param name="hostAddress" select="$hostAddress"/>
|
<xsl:with-param name="initHost" select="$initHost" />
|
||||||
<xsl:with-param name="class" select="'ui mini label'"/>
|
<xsl:with-param name="currentHost" select="$currentHost" />
|
||||||
<xsl:sort select="number(@portid)" order="ascending"/>
|
<xsl:with-param name="hostAddress" select="$hostAddress" />
|
||||||
</xsl:apply-templates>
|
<xsl:with-param name="class" select="'ui mini label'" />
|
||||||
</td>
|
<xsl:sort select="number(@portid)" order="ascending" />
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</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">?host=<xsl:value-of select="$hostAddress" /></xsl:attribute>
|
<xsl:attribute name="href">scan.php?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