scan options draft
This commit is contained in:
parent
d5dd51921c
commit
7062b94aaa
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$SCANS_DIR = 'scans';
|
||||
$NMAP_DATADIR = '/usr/share/nmap';
|
||||
$NMAP_OPTIONS = '-PSssh,http,https,msrpc,microsoft-ds -F -T5';
|
||||
|
33
index.php
33
index.php
@ -20,26 +20,29 @@
|
||||
<a class="header item" href=".">
|
||||
lan<?php include 'logo.svg'; ?>can
|
||||
</a>
|
||||
<form class="right menu">
|
||||
<div class="ui category search item">
|
||||
<div class="ui icon input">
|
||||
<input class="prompt" type="text" id="targetsInput" name="targets" required=""
|
||||
<div class="right menu">
|
||||
<form class="ui category search item" onsubmit="targetsInputDiv.classList.add('loading')">
|
||||
<div id="targetsInputDiv" class="ui icon input">
|
||||
<input class="prompt" type="text" id="targetsInput" name="targets" required="" 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.
|
||||
Exemple: <?=$_SERVER['REMOTE_ADDR']; ?>/24 <?=$_SERVER['SERVER_NAME']; ?>"/>
|
||||
Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24 <?=$_SERVER['SERVER_NAME']; ?>"/>
|
||||
<i class="satellite dish icon"></i>
|
||||
<button style="display:none" type="submit" formaction="scan.php" formmethod="get"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" >
|
||||
<button class="ui teal button" type="submit" formaction="scan-options.php" formmethod="get">Options</button>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
<form class="item" method="get" action="scan-options.php">
|
||||
<input id="hiddenInput" type="hidden" name="targets" value="<?=$targets; ?>"/>
|
||||
<button class="ui teal submit button" type="submit">Options</button>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="ui main container">
|
||||
<h1 class="ui header">Scans</h1>
|
||||
<ul class="ui large relaxed link list">
|
||||
<div class="ui large relaxed card">
|
||||
<div class="content"><div class="header">Scans</div></div>
|
||||
<div class="content">
|
||||
<div class="ui link divided list">
|
||||
<?php
|
||||
if (!file_exists($SCANS_DIR)) {
|
||||
mkdir($SCANS_DIR);
|
||||
@ -47,11 +50,13 @@ if (!file_exists($SCANS_DIR)) {
|
||||
foreach (scandir($SCANS_DIR) as $scan) {
|
||||
if (substr($scan, -4) == '.xml') {
|
||||
$targets = str_replace('!', '/', substr_replace($scan, '', -4));
|
||||
echo "<li><a class='item' href='scan.php?targets=".urlencode($targets)."'>$targets</a></li>\n";
|
||||
echo "<a class='item' href='scan.php?targets=".urlencode($targets)."'>$targets</a>\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
|
14
ports.php
Normal file
14
ports.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
include_once 'config.php';
|
||||
|
||||
$nmap_services = file("$NMAP_DATADIR/nmap-services");
|
||||
foreach ($nmap_services as $service) {
|
||||
$comment = strpos($service, '#');
|
||||
if ($comment !== 0) {
|
||||
[$name, $port] = explode("\t", $service);
|
||||
[$portid, $protocole] = explode('/', $port);
|
||||
$protocole = strtoupper(substr($protocole, 0, 1));
|
||||
echo "<option value=$portid></option><option value=$protocole:$portid></option><option value=$name></option>\n";
|
||||
}
|
||||
}
|
116
scan-options.php
116
scan-options.php
@ -1,19 +1,15 @@
|
||||
<?php
|
||||
include_once 'common.php';
|
||||
|
||||
if (!$targets) {
|
||||
$targets = $_SERVER['SERVER_NAME'].' '.$_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
?>
|
||||
<?php include_once 'common.php'; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>lanScan</title>
|
||||
<link rel="icon" href="favicon.ico" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.js"></script>
|
||||
<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" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify"></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" />
|
||||
@ -23,46 +19,100 @@ if (!$targets) {
|
||||
<body>
|
||||
<nav class="ui inverted teal fixed menu">
|
||||
<a class="header item" href=".">
|
||||
lan<?php include 'logo.svg'; ?>can
|
||||
lan
|
||||
<?php include 'logo.svg'; ?>can
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<main class="ui main container">
|
||||
<div class="ui segment">
|
||||
<form id="newScanForm" class="ui form" method="get" action="scan.php">
|
||||
<h1 class="header">Nouveau scan</h1>
|
||||
<div class="field">
|
||||
<form id="newScanForm" class="ui form" method="get" action="scan.php">
|
||||
<h1 class="header">Nouveau scan</h1>
|
||||
<!--<div class="field">
|
||||
<label for="nameInput">Nom</label>
|
||||
<input id="nameInput" type="text" name="name" placeholder="Réseau local" pattern='[^<>:"\\\/\|@?]+'
|
||||
title='Nom de fichier valide (ne contenant pas les caractères <>:"\/|@?)'
|
||||
value="<?= htmlspecialchars($name); ?>">
|
||||
</div>-->
|
||||
<div class="required field">
|
||||
<label for="targetsInput">Cibles</label>
|
||||
<input id="targetsInput" type="text" name="targets" placeholder="Cibles" required=""
|
||||
pattern="[a-zA-Z0-9._\/ \-]+" value="<?= htmlspecialchars($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']; ?>" />
|
||||
</div>
|
||||
|
||||
<fieldset class="ui segment">
|
||||
<legend class="ui header">Découverte des hôtes</legend>
|
||||
<div class="inline field">
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" id="PnInput" name="Pn"/>
|
||||
<label for="PnInput">Tous les hôtes</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="targetsInput">Cibles</label>
|
||||
<input id="targetsInput" type="text" name="targets" placeholder="scanme.nmap.org 192.168.0.0/24" required=""
|
||||
title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
|
||||
Exemple: scanme.nmap.org microsoft.com/24 192.168.0.1 10.0-255.0-255.1-254"
|
||||
pattern="[a-zA-Z0-9._\/ \-]+" value="<?= htmlspecialchars($targets); ?>" />
|
||||
</div>
|
||||
<button id="newScanSubmitButton" type="submit" class="ui fluid large teal submit button">Démarrer</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Ping TCP SYN</label>
|
||||
<input type="text" id="PSInput" name="PS" placeholder="Port" list="servicesList" pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*"
|
||||
title="Liste de ports ex: 22,23,25,80,113,1050,35000">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="ui segment">
|
||||
<legend class="ui header">Techniques de scan</legend>
|
||||
<div class="field">
|
||||
<label>Ne scanner que les ports</label>
|
||||
<input type="text" id="pInput" name="p" placeholder="Port" list="servicesList" pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*"
|
||||
title="Liste de ports ex: ssh,ftp,U:53,111,137,T:21-25,80,139,8080">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<button type="submit" class="ui fluid large teal submit button">Démarrer</button>
|
||||
</form>
|
||||
|
||||
<datalist id='targetsList'>
|
||||
<option value="<?=$_SERVER['REMOTE_ADDR']; ?>"></option>
|
||||
<option value="<?=$_SERVER['REMOTE_ADDR']; ?>/24"></option>
|
||||
<option value="<?=$_SERVER['SERVER_NAME']; ?>"></option>
|
||||
</datalist>
|
||||
<datalist id='servicesList'>
|
||||
<?php
|
||||
$nmap_services = file("$NMAP_DATADIR/nmap-services");
|
||||
$services = [];
|
||||
foreach ($nmap_services as $service) {
|
||||
if (strpos($service, '#') !== 0) {
|
||||
[$name, $port] = explode("\t", $service);
|
||||
$services[$name] = $port;
|
||||
}
|
||||
}
|
||||
foreach ($services as $name => $port) {
|
||||
echo " <option value='$name'></option>\n";
|
||||
}
|
||||
?>
|
||||
</datalist>
|
||||
</main>
|
||||
<script>
|
||||
tagify = new Tagify(targetsInput, {
|
||||
pattern: /[a-zA-Z\d.-_/]+/,
|
||||
delimiters: " ",
|
||||
originalInputValueFormat: tags => tags.map(tag => tag.value).join(' ')
|
||||
})
|
||||
<script>
|
||||
new Tagify(targetsInput, {
|
||||
pattern: /^[a-zA-Z\d._/-]+$/,
|
||||
delimiters: " ",
|
||||
originalInputValueFormat: tags => tags.map(tag => tag.value).join(' '),
|
||||
whitelist: Array.from(targetsInput.list.options).map(option => option.value),
|
||||
})
|
||||
|
||||
newScanForm.onsubmit = function(event) {
|
||||
if (this.checkValidity()) return true
|
||||
new Tagify(pInput, {
|
||||
pattern: /^(([TU]:)?[\d-]+|[a-z-]+)$/,
|
||||
delimiters: ",",
|
||||
originalInputValueFormat: tags => tags.map(tag => tag.value).join(','),
|
||||
whitelist: Array.from(pInput.list.options).map(option => option.value),
|
||||
})
|
||||
|
||||
newScanForm.onsubmit = function (event) {
|
||||
if (this.checkValidity()) {
|
||||
newScanForm.classList.add("loading")
|
||||
return true
|
||||
} else {
|
||||
event.preventDefault()
|
||||
this.reportValidity()
|
||||
newScanSubmitButton.innerHTML = "<div class='ui active inline inverted loader'></div>"
|
||||
}
|
||||
</script>
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
2
server.php
Normal file
2
server.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
var_dump($_SERVER);
|
@ -15,6 +15,10 @@
|
||||
--placeholder-color-focus: rgba(115,115,115,.87);
|
||||
}
|
||||
|
||||
.ui.table {
|
||||
caption-side: bottom;
|
||||
}
|
||||
|
||||
.ui.label {
|
||||
margin: .14285714em;
|
||||
}
|
||||
|
@ -13,9 +13,10 @@
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="refresh" content="60"/>
|
||||
<title>lanScan - <xsl:value-of select="$targets" /></title>
|
||||
<link rel="icon" href="favicon.ico"/>
|
||||
<meta http-equiv="refresh" content="60" />
|
||||
<title>lanScan - <xsl:value-of select="$targets" />
|
||||
</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 href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.datatables.net/v/dt/jszip-3.10.1/dt-2.1.8/b-3.1.2/b-html5-3.1.2/b-print-3.1.2/fh-4.0.1/r-3.0.3/datatables.css" rel="stylesheet" />
|
||||
@ -82,22 +83,22 @@
|
||||
</svg>
|
||||
<xsl:text>can</xsl:text>
|
||||
</a>
|
||||
|
||||
<form class="right menu">
|
||||
<div class="ui category search item">
|
||||
<div class="ui icon input">
|
||||
<input class="prompt" type="text" id="targetsInput" name="targets" required=""
|
||||
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.
|
||||
Exemple: 192.168.1.0/24 scanme.nmap.org"/>
|
||||
<i class="satellite dish icon"></i>
|
||||
<div class="right menu">
|
||||
<form class="ui category search item" onsubmit="targetsInputDiv.classList.add('loading')">
|
||||
<div id="targetsInputDiv" class="ui icon input">
|
||||
<input class="prompt" type="text" id="targetsInput" name="targets" required="" 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"/>
|
||||
<i class="satellite dish icon"></i>
|
||||
<button style="display:none" type="submit" formaction="scan.php" formmethod="get"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" >
|
||||
<button class="ui teal button" type="submit" formaction="scan-options.php" formmethod="get">Options</button>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
<form class="item" method="get" action="scan-options.php">
|
||||
<input id="hiddenInput" type="hidden" name="targets" value="{$targets}"/>
|
||||
<button class="ui teal submit button" type="submit">Options</button>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="ui main container">
|
||||
@ -115,12 +116,9 @@ Exemple: 192.168.1.0/24 scanme.nmap.org"/>
|
||||
</div>
|
||||
</xsl:if>
|
||||
|
||||
<h1 class="ui header">
|
||||
<xsl:value-of select="$targets" />
|
||||
</h1>
|
||||
|
||||
<xsl:if test="$init">
|
||||
<div class="ui info message">
|
||||
<i class="calendar icon"></i>
|
||||
<xsl:text>Comparaison avec le scan de </xsl:text>
|
||||
<xsl:value-of select="$init/runstats/finished/@timestr" />
|
||||
</div>
|
||||
@ -245,11 +243,14 @@ Exemple: 192.168.1.0/24 scanme.nmap.org"/>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="service/@name" />://<xsl:value-of select="$hostAddress" />:<xsl:value-of select="@portid" />
|
||||
<xsl:value-of select="service/@name" />
|
||||
:// <xsl:value-of select="$hostAddress" />
|
||||
: <xsl:value-of select="@portid" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="service/@name='ms-wbt-server'">
|
||||
<xsl:attribute name="href">rdp.php?v=<xsl:value-of select="$hostAddress" />&p=<xsl:value-of select="@portid" />
|
||||
<xsl:attribute name="href">rdp.php?v=<xsl:value-of select="$hostAddress" />
|
||||
&p=<xsl:value-of select="@portid" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table">
|
||||
|
Reference in New Issue
Block a user