new scan menu
This commit is contained in:
parent
b02c89973c
commit
d5dd51921c
13
common.php
Normal file
13
common.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
include_once 'config.php';
|
||||
|
||||
$name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, [
|
||||
'flags' => FILTER_NULL_ON_FAILURE,
|
||||
'options' => ['regexp' => '/^[^<>:"\/|?]+$/'],
|
||||
]);
|
||||
|
||||
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [
|
||||
'flags' => FILTER_NULL_ON_FAILURE,
|
||||
'options' => ['regexp' => '/^[\da-zA-Z.:\/_ -]+$/'],
|
||||
]);
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
$NMAP_OPTIONS = '-PSssh,http,https,msrpc,microsoft-ds -F -T5';
|
||||
|
||||
$SCANS_DIR = 'scans';
|
||||
?>
|
||||
$NMAP_OPTIONS = '-PSssh,http,https,msrpc,microsoft-ds -F -T5';
|
||||
|
28
index.php
28
index.php
@ -1,11 +1,4 @@
|
||||
<?php
|
||||
include_once 'config.php';
|
||||
|
||||
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [
|
||||
'flags' => FILTER_NULL_ON_FAILURE,
|
||||
'options' => ['regexp' => '/^[\da-zA-Z.:\/_ -]+$/'],
|
||||
]);
|
||||
?>
|
||||
<?php include_once 'common.php'; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@ -27,18 +20,21 @@ $targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [
|
||||
<a class="header item" href=".">
|
||||
lan<?php include 'logo.svg'; ?>can
|
||||
</a>
|
||||
<div class="right menu">
|
||||
<iconsearch class="ui right aligned search category item">
|
||||
<form class="right menu">
|
||||
<div class="ui category search item">
|
||||
<div class="ui icon input">
|
||||
<form id="newScanForm" class="ui form" method="get" action="scan.php">
|
||||
<input class="prompt" type="text" name="targets" placeholder="Scanner un réseau..." required="" autocomplete="off" 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']; ?>" pattern="[a-zA-Z0-9._\/ \-]+" value="<?=$targets; ?>" />
|
||||
</form>
|
||||
<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: <?=$_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 class="results"></div>
|
||||
</iconsearch>
|
||||
</div>
|
||||
<div class="item" >
|
||||
<button class="ui teal button" type="submit" formaction="scan-options.php" formmethod="get">Options</button>
|
||||
</div>
|
||||
</form>
|
||||
</nav>
|
||||
|
||||
<main class="ui main container">
|
||||
|
@ -1,13 +1,6 @@
|
||||
<?php
|
||||
$name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, [
|
||||
'flags' => FILTER_NULL_ON_FAILURE,
|
||||
'options' => ['regexp' => '/^[^<>:"\/|?]+$/'],
|
||||
]);
|
||||
include_once 'common.php';
|
||||
|
||||
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [
|
||||
'flags' => FILTER_NULL_ON_FAILURE,
|
||||
'options' => ['regexp' => '/^[\da-zA-Z.:\/_ -]+$/'],
|
||||
]);
|
||||
if (!$targets) {
|
||||
$targets = $_SERVER['SERVER_NAME'].' '.$_SERVER['REMOTE_ADDR'];
|
||||
}
|
19
scan.php
19
scan.php
@ -1,14 +1,16 @@
|
||||
<?php
|
||||
|
||||
include_once 'config.php';
|
||||
|
||||
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [
|
||||
'flags' => FILTER_NULL_ON_FAILURE,
|
||||
'options' => ['regexp' => "/^[\da-zA-Z.:\/_ -]+$/"],
|
||||
]);
|
||||
if (!$targets) {
|
||||
http_response_code(400);
|
||||
exit('Paramètre targets manquant.');
|
||||
}
|
||||
|
||||
$name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, [
|
||||
'flags' => FILTER_NULL_ON_FAILURE,
|
||||
'options' => ['regexp' => '/^[^@<>:"\/|!?]+$/'],
|
||||
]);
|
||||
|
||||
$dir = $SCANS_DIR;
|
||||
if (!file_exists($SCANS_DIR)) {
|
||||
@ -26,8 +28,11 @@ if (file_exists($initPath)) {
|
||||
$basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}".dirname($_SERVER['REQUEST_URI']);
|
||||
|
||||
$result = `nmap $NMAP_OPTIONS --stylesheet $basedir/stylesheet.xsl -oX - $targets`;
|
||||
if (!$result) {
|
||||
http_response_code(500);
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$xml = new DOMDocument();
|
||||
$xml->loadXML($result);
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='targets' value='$targets'"), $xml->documentElement);
|
||||
@ -47,7 +52,3 @@ if ($result) {
|
||||
|
||||
header('Content-type: text/xml');
|
||||
exit($xml->saveXML());
|
||||
} else {
|
||||
http_response_code(500);
|
||||
exit();
|
||||
}
|
@ -31,7 +31,7 @@
|
||||
|
||||
<body>
|
||||
<nav class="ui inverted teal fixed menu">
|
||||
<a class="header item" href=".">
|
||||
<a class="header item" href="./?targets={$targets}">
|
||||
<xsl:text>lan</xsl:text>
|
||||
<svg class="logo" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 24 24" xml:space="preserve" width="40" height="40"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@ -83,18 +83,21 @@
|
||||
<xsl:text>can</xsl:text>
|
||||
</a>
|
||||
|
||||
<div class="right menu">
|
||||
<iconsearch class="ui right aligned search category item">
|
||||
<form class="right menu">
|
||||
<div class="ui category search item">
|
||||
<div class="ui icon input">
|
||||
<form id="newScanForm" class="ui form" method="get" action="scan.php">
|
||||
<input class="prompt" type="text" name="targets" placeholder="Scanner un réseau..." required="" autocomplete="off" 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="{$targets}" />
|
||||
</form>
|
||||
<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>
|
||||
<button style="display:none" type="submit" formaction="scan.php" formmethod="get"></button>
|
||||
</div>
|
||||
<div class="results"></div>
|
||||
</iconsearch>
|
||||
</div>
|
||||
<div class="item" >
|
||||
<button class="ui teal button" type="submit" formaction="scan-options.php" formmethod="get">Options</button>
|
||||
</div>
|
||||
</form>
|
||||
</nav>
|
||||
|
||||
<main class="ui main container">
|
||||
@ -246,7 +249,7 @@ Exemple: scanme.nmap.org microsoft.com/24 192.168.0.1 10.0-255.0-255.1-254" patt
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="service/@name='ms-wbt-server'">
|
||||
<xsl:attribute name="href">rdp.php?v=<xsl:value-of select="$hostAddress" />:<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">
|
||||
|
Loading…
x
Reference in New Issue
Block a user