88 Commits

Author SHA1 Message Date
adrien c85c175416 improve smb share size 2023-05-11 12:09:05 +02:00
adrien 08187df3a8 rename script-args.ini 2023-05-11 11:13:28 +02:00
adrien e42c1342eb Merge branch 'master' of https://git.malingrey.fr/adrien/lanScan2 2023-05-11 11:12:13 +02:00
adrien e577ccb4c1 rename script-args.ini 2023-05-11 11:11:51 +02:00
adrien 5e4fb1aa61 fix "/usr/bin/../share/nmap/nselib/http.lua:1795: attempt to index a nil value (local 'options')" 2023-05-10 21:10:44 +02:00
adrien 556268b1e1 script_args.ini 2023-05-10 20:41:00 +02:00
adrien 8cb8a6cb04 ignore script_args.ini 2023-05-10 20:34:42 +02:00
adrien 8098697c4d Mise à jour de 'nse/script_args.ini' 2023-05-10 18:56:22 +02:00
adrien 2f3bb6c4f3 share size xsl 2023-05-10 18:54:57 +02:00
adrien d6207258ac rename 2023-05-10 17:42:17 +02:00
adrien 0ffd304d2d du script working! 2023-05-10 16:15:36 +02:00
adrien a3c06ef825 merge 2023-05-09 16:18:07 +02:00
adrien bbee70cef8 merge 2023-05-09 16:15:16 +02:00
adrien e2e255f690 merge 2023-05-09 15:27:40 +02:00
adrien 5378e16e24 new nse script 2023-05-09 15:15:27 +02:00
adrien c3082c9442 small fixes 2023-04-29 08:25:51 +02:00
adrien e1bde27789 Merge branch 'master' of https://git.malingrey.fr/adrien/lanScan2 2023-04-29 07:10:07 +02:00
adrien 330205b297 save site when discover 2023-04-29 07:10:06 +02:00
adrien 2505c1d974 stuff 2023-04-28 16:55:18 +02:00
adrien 36b7a91c48 select service distinct 2023-04-28 15:21:18 +02:00
adrien 7354c2158a change format again 2023-04-28 11:15:09 +02:00
adrien 88edeee596 change yaml format 2023-04-28 04:39:52 +02:00
adrien 3d1a0ac214 400<=http status<=500 => yellow 2023-04-27 18:48:44 +02:00
adrien ff9f5b3b33 tune 2023-04-27 18:45:08 +02:00
adrien 272d97ebf7 verbose 2023-04-27 17:46:56 +02:00
adrien 8973dc8979 split scan 2023-04-27 17:11:06 +02:00
adrien 874e5bb833 @ip on title 2023-04-24 18:48:04 +02:00
adrien 6eb3eb434d scannedHostAddress 2023-04-24 18:45:14 +02:00
adrien c70d24a837 select on click 2023-04-24 18:41:42 +02:00
adrien 8bfd90a8c4 onfocus display FQDN 2023-04-24 18:31:51 +02:00
adrien c6cc4aad16 placeholder 2023-04-24 18:27:52 +02:00
adrien d676af67e2 refresh 60s 2023-04-14 17:57:01 +02:00
adrien 823a78f0ed header 2023-04-14 17:28:17 +02:00
adrien 1383944787 icon message 2023-04-14 17:17:59 +02:00
adrien 0027932ecd title 2023-04-14 17:06:19 +02:00
adrien fbd0f19ced http-info 2023-04-14 16:47:39 +02:00
adrien d9d996e081 remove smb-enum-shares script to speed up 2023-04-14 16:11:49 +02:00
adrien 17c5c02818 fix stuff 2023-04-14 15:11:28 +02:00
adrien 8537c2a0ca fix results 2023-04-13 21:14:27 +02:00
adrien c6e1977ca2 fix scan_all.sh 2023-04-13 20:54:28 +02:00
adrien fad7c6164e scan_all.sh 2023-04-13 19:39:06 +02:00
adrien d4af5b181f merge nmap scripts 2023-04-13 16:30:06 +02:00
adrien 48d6a52931 descrease scan output size 2023-04-13 15:55:49 +02:00
adrien ea98cd9903 scan_all in bash script 2023-04-13 15:46:47 +02:00
adrien 6e0e3b60e3 tmp 2023-04-12 20:25:59 +02:00
adrien 12a0a5ac93 commit 2023-04-12 18:41:45 +02:00
adrien 0439aecb98 https 2023-04-12 12:11:33 +02:00
adrien f8c4ea0903 change yaml format 2023-04-11 20:33:11 +02:00
adrien ba3c1e1b8a __DIR__ 2023-04-11 18:47:24 +02:00
adrien c2d62a5ccb tmp 2023-04-11 18:45:42 +02:00
adrien 72ad03b03b commit 2023-04-11 18:39:57 +02:00
adrien 6eac85d5ad tiny favicon 2023-04-11 14:35:30 +02:00
adrien cdf14a09d9 fix heredoc string for old php 2023-04-11 11:28:27 +02:00
adrien fee3f2a043 fix heredoc syntax for old php 2023-04-11 11:18:27 +02:00
adrien b3aa55c9b4 inverse 2023-04-11 01:43:48 +02:00
adrien 6243bc66e5 nmap script http-get 2023-04-10 22:03:32 +02:00
adrien a552a3cc06 nmap http status script 2023-04-10 21:26:53 +02:00
adrien 72a9c62d4a nmap favicon url 2023-04-10 21:02:42 +02:00
adrien 61486d7dab always favicon 2023-04-10 03:13:29 +02:00
adrien c2bd2ee679 https favicon 2023-04-09 20:02:18 +02:00
adrien 7d25fd2472 three columns, dl favicons only of http 2023-04-09 18:02:15 +02:00
adrien c6691ed1d2 factorisation 2023-04-09 17:28:10 +02:00
adrien 4822ad3e5d title 2023-04-09 04:43:48 +02:00
adrien a640f71c7e services when host down 2023-04-09 04:32:10 +02:00
adrien 0d8d3d0c7b hostname without . 2023-04-09 03:42:00 +02:00
adrien e37ba4993e info 2023-04-09 03:36:01 +02:00
adrien 64d2dece69 remove comment 2023-04-09 03:08:17 +02:00
adrien a09777bdc4 button padding 2023-04-09 02:44:58 +02:00
adrien 32423db827 input value and title change when only @ip 2023-04-09 01:51:14 +02:00
adrien e6b9a7a6be pseudo regex 2023-04-09 01:25:50 +02:00
adrien 15e33765e5 uncomment exec 2023-04-09 01:18:04 +02:00
adrien 98b7fab684 compact 2023-04-09 01:13:02 +02:00
adrien 3a162f4568 use xslt! 2023-04-09 01:06:01 +02:00
adrien c7b85862e6 yo 2023-04-07 17:55:30 +02:00
adrien 24c32fa513 stuff 2023-04-07 13:59:48 +02:00
adrien 7b66313c01 toxml 2023-04-07 02:34:57 +02:00
adrien d3b5a014e1 separate confs and scans 2023-04-07 02:34:42 +02:00
adrien 7592b803fb selection list 2023-04-07 01:12:52 +02:00
adrien 3a5d60e1c0 ui 2023-04-06 20:29:03 +02:00
adrien 69f4127f9e ui 2023-04-06 20:28:38 +02:00
adrien 4d06c3407b ui 2023-04-05 21:53:52 +02:00
adrien 01c4b662d5 update 2023-04-05 18:20:01 +02:00
adrien 9b3e6537d5 fix readme 2023-04-04 10:32:55 +02:00
adrien e152780a72 fomanticui 2023-04-04 08:04:55 +02:00
adrien d640f6144a fix README.md 2023-04-03 23:06:07 +02:00
adrien 4aac159021 dont ignore example 2023-04-03 23:04:15 +02:00
adrien d259b626d5 README.md 2023-04-03 23:03:42 +02:00
adrien e93d37cacd init 2023-04-03 22:43:26 +02:00
34 changed files with 529 additions and 2502 deletions
+3 -2
View File
@@ -1,3 +1,4 @@
nse/script-args.ini
configs/
scans/ scans/
datadir/script-args.ini site/
test.php
+28
View File
@@ -0,0 +1,28 @@
# lanScan
Scanne des hôtes avec `nmap`
et affiche le résultat dans une page web.
* Créer un fichier de configuration YAML dans un sous-dossier ./configs/ (voir l'exemple ci-dessous).
Il peut être généré en scannant un réseau avec : `./discover <CIDR>`.
* Scanner avec le script `./scan_all` (utiliser une tâche cron !).
* Voir les résultats en ouvrant `.\index.php` dans le navigateur web.
## Exemple
```yaml
---
site: Nom du site
hosts:
- name: Nom du premier groupe
host:
- address: host1.local
services: [ssh, http]
- address: 192.168.1.100
services: [ftp, https, 5432]
- name: Nom du 2ème groupe
host:
- adress: host3.local
services: [ssh, ftp, 8006]
```
+21 -32
View File
@@ -1,38 +1,27 @@
# lanScan # lanScan
Scanne le réseau avec `nmap` et affiche les résultats dans une page web. Scan hosts with `nmap` and display results in webpage.
## Configuration * Create a configuration yaml file in ./configs/ subdirectory (see example below).
It may be generated by scanning a network with `./discover <CIDR>`.
* Scan with `./scan_all` (use a cron task!).
* Open `.\index.php` in web browser to see results.
On peut personnaliser les options prédéfinies pour les scans de réseau ou d'hôte dans le fichier `config.php` : ## Example
```php ```yaml
$presets = [ ---
"default" => [ site: Nom du site
'-PS' => 'microsoft-ds',
'-F' => true, hosts:
'-T' => 5, - name: Nom du premier groupe
'--stylesheet' => "$BASEDIR/templates/lanScan.xsl", host:
'refreshPeriod' => 60, - address: host1.local
'sudo' => false, services: [ssh, http]
], - address: 192.168.1.100
"host" => [ services: [ftp, https, 5432]
'-Pn' => true, - name: Nom du 2ème groupe
'-F' => true, host:
'-sV' => true, - adress: host3.local
'-T' => 5, services: [ssh, ftp, 8006]
'--script' => "http-info,smb-shares-size",
'--stylesheet' => "$BASEDIR/templates/hostScan.xsl",
'refreshPeriod' => 60,
'sudo' => true,
],
];
``` ```
## Accès root
Certaines options nécessitent l'accès root.
Pour donner les droits à lanScan sous Linux, installer `sudo` au besoin, puis créer le fichier `/etc/sudoers.d/lanScan` avec le contenu
(en remplaçant `www-data` par l'utilisateur du service web) :
```
www-data ALL = NOPASSWD: /usr/bin/nmap
````
-31
View File
@@ -1,31 +0,0 @@
<?php
$port = (($_SERVER['REQUEST_SCHEME'] == "http" && $_SERVER['SERVER_PORT'] == 80) || ($_SERVER['REQUEST_SCHEME'] == "https" && $_SERVER['SERVER_PORT'] == 443)) ? "" : ":{$_SERVER['SERVER_PORT']}";
$BASEDIR = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}$port" . dirname($_SERVER['SCRIPT_NAME']);
$SCANSDIR = 'scans';
$TEMPLATESDIR = "templates";
$NMAP = 'sudo nmap'; # nmap command, E.g. 'nmap', 'sudo nmap' for root privileges or '/usr/bin/nmap' if not in PATH
$NMAPDIR = dirname(`which nmap`) . "/../share/nmap";
$DATADIR = ".";
$SCRIPTARGS = "script-args.ini";
$presets = [
"default" => [
'-PS' => 'microsoft-ds',
'-F' => true,
'-T' => 5,
'--stylesheet' => "lanScan",
'refreshPeriod' => 60,
#'sudo' => false,
],
"host" => [
'-Pn' => true,
'-F' => true,
'-sV' => true,
'-T' => 5,
'--script' => "http-info,smb-shares-size",
'--stylesheet' => "hostScan",
'refreshPeriod' => 60,
#'sudo' => true,
],
];
Executable
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
###
#
# Scan un réseau avec nmap pour créer un fichier de configuration
# Usage : ./discover <reseau> avec reseau en notation CIDR XXX.XXX.XXX.XXX/XX
#
###
if [ "$#" -ne 1 ]; then
echo -e "Usage : ./discover <CIDR>\navec <CIDR> l'adresse réseau en notation CIDR (XXX.XXX.XXX.XXX/XX)" >&2
exit 1
fi
pushd "$(dirname -- "$0")" > /dev/null
network="$1"
site="${network/\//_}"
mkdir -p "scans"
nmap -F -oX "scans/$site.xml" $network
mkdir -p "configs"
xsltproc --stringparam network "$network" to_config.xsl "scans/$site.xml" > "configs/$site.yaml"
php to_XML.php "configs/$site.yaml" > "site/$site.xml"
popd > /dev/null
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

-124
View File
@@ -1,124 +0,0 @@
<?php
include_once "config.php";
$targetsListRegex = '/^[\da-zA-Z-. \/]+$/';
$hostsListRegex = '/^[\da-zA-Z-.,:\/]+$/';
$protocolePortsListRegex = '/^(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*$/';
$portsListRegex = '/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/';
$tempoRegex = '/^\d+[smh]?$/';
$fileNameRegex = '/^[^<>:\/|?]+$/';
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
$preset = filter_input(INPUT_GET, "preset", FILTER_SANITIZE_STRING);
if ($preset && isset($presets[$preset])) {
$options = $presets[$preset];
} else {
$options = filter_input_array(INPUT_GET, [
// TARGET SPECIFICATION:
'-iR' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'--exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
// HOST DISCOVERY:
'-sL' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
'-sP' => FILTER_VALIDATE_BOOLEAN,
'-P0' => FILTER_VALIDATE_BOOLEAN,
'-Pn' => FILTER_VALIDATE_BOOLEAN,
'-PS' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
'-PA' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
'-PU' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
'-PE' => FILTER_VALIDATE_BOOLEAN,
'-PP' => FILTER_VALIDATE_BOOLEAN,
'-PM' => FILTER_VALIDATE_BOOLEAN,
'-PO' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 255]],
'-PR' => FILTER_VALIDATE_BOOLEAN,
'--send-ip' => FILTER_VALIDATE_BOOLEAN,
'-n' => FILTER_VALIDATE_BOOLEAN,
'-R' => FILTER_VALIDATE_BOOLEAN,
'--dns-servers' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
// SCAN TECHNIQUES:
'-sS' => FILTER_VALIDATE_BOOLEAN,
'-sT' => FILTER_VALIDATE_BOOLEAN,
'-sA' => FILTER_VALIDATE_BOOLEAN,
'-sW' => FILTER_VALIDATE_BOOLEAN,
'-sM' => FILTER_VALIDATE_BOOLEAN,
'-sF' => FILTER_VALIDATE_BOOLEAN,
'-sN' => FILTER_VALIDATE_BOOLEAN,
'-sX' => FILTER_VALIDATE_BOOLEAN,
'-sU' => FILTER_VALIDATE_BOOLEAN,
'--scanflags' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^(URG|ACK|PSH|RST|SYN|FIN|,)+|[1-9]?[0-9]|[1-2][0-9][0-9]$/']],
'-sI' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-zA-Z\d:.-]+(:\d+)?$/']],
'-sO' => FILTER_VALIDATE_BOOLEAN,
'-b' => FILTER_VALIDATE_URL,
'--traceroute' => FILTER_VALIDATE_BOOLEAN,
'--reason' => FILTER_VALIDATE_BOOLEAN,
// PORT SPECIFICATION AND SCAN ORDER:
'-p' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
'-F' => FILTER_VALIDATE_BOOLEAN,
'-r' => FILTER_VALIDATE_BOOLEAN,
'--top-ports' => FILTER_VALIDATE_INT,
'--port-ratio' => ['filter' => FILTER_VALIDATE_FLOAT, 'options' => ['min_range' => 0, 'max_range' => 1]],
// SERVICE/VERSION DETECTION:
'-sV' => FILTER_VALIDATE_BOOLEAN,
'--version-light' => FILTER_VALIDATE_BOOLEAN,
'--version-intensity' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 9]],
'--version-all' => FILTER_VALIDATE_BOOLEAN,
'--version-trace' => FILTER_VALIDATE_BOOLEAN,
// SCRIPT SCAN:
'-sC' => FILTER_VALIDATE_BOOLEAN,
'--script' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-z][a-z0-9,\-\.\/]*$/']],
'--script-args' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^([a-zA-Z][a-zA-Z0-9\-_]*=[^"]+(,[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+)?)$/']],
// OS DETECTION:
'-O' => FILTER_VALIDATE_BOOLEAN,
'--osscan-limit' => FILTER_VALIDATE_BOOLEAN,
'--osscan-guess' => FILTER_VALIDATE_BOOLEAN,
'--max-os-tries' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
// TIMING AND PERFORMANCE:
'-T' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 5]],
'--min-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'--max-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'--min-parallelism' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'--max-parallelism' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'--min-rtt-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
'--max-rtt-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
'--initial-rtt-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
'--max-retries' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'--host-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
'--scan-delay' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
'--max-scan-delay' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
// FIREWALL/IDS EVASION AND SPOOFING:
'-f' => FILTER_VALIDATE_INT,
'--mtu' => FILTER_VALIDATE_INT,
'-D' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
'-S' => ['filter' => FILTER_VALIDATE_IP],
'-e' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-z\d]+$/']],
'-g' => FILTER_VALIDATE_INT,
'--source-port' => FILTER_VALIDATE_INT,
'--data-length' => FILTER_VALIDATE_INT,
'--ip-options' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^\"(R|T|U|L [\da-zA-Z-.: ]+|S [\da-zA-Z-.: ]+|\\\\x[\da-fA-F]{1,2}(\*[\d]+)?|\\\\[0-2]?[\d]{1,2}(\*[\d]+)?)\"$/']],
'--ttl' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 255]],
'--spoof-mac' => FILTER_VALIDATE_MAC,
'--badsum' => FILTER_VALIDATE_BOOLEAN,
// MISC:
// '6' => FILTER_VALIDATE_BOOLEAN,
'-A' => FILTER_VALIDATE_BOOLEAN,
'--send-eth' => FILTER_VALIDATE_BOOLEAN,
'--privileged' => FILTER_VALIDATE_BOOLEAN,
'-V' => FILTER_VALIDATE_BOOLEAN,
'--unprivileged' => FILTER_VALIDATE_BOOLEAN,
'-h' => FILTER_VALIDATE_BOOLEAN,
'--stylesheet' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
// lanScan
'name' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
'originalURL' => FILTER_VALIDATE_URL,
'refreshPeriod' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'sudo' => FILTER_VALIDATE_BOOLEAN,
], false) ?: $presets["default"];
}
$options["--datadir"] = $DATADIR;
$options["--script-args-file"] = $SCRIPTARGS;
/*echo "<!--";
var_dump($options);
echo "-->\n";*/
Executable → Regular
+34 -772
View File
@@ -1,784 +1,46 @@
<?php <!doctype html>
include_once 'config.php';
include_once 'filter_inputs.php';
?>
<!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head>
<head> <meta charset="utf-8">
<meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>lanScan</title> <title>lanScan</title>
<link rel="icon" href="favicon.ico" /> <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.3/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.css">
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.js"></script>
<link rel="stylesheet" type="text/css" <style>
href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" /> #logo {
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify"></script> margin: 0 -.4rem 0 0;
<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" /> .main.container {
<link href="style.css" rel="stylesheet" type="text/css" /> margin-top: 5em;
</head> }
</style>
<body> </head>
<nav class="ui inverted teal fixed menu"> <body>
<a class="ui teal button item" href="."> <header class="ui fixed centered blue inverted menu">
lan<?php include 'logo.svg'; ?>can <div class="header item">lan<img id="logo" src="logo.svg" alt="S"/>can</div>
</a> </header>
<div class="right menu"> <div class="ui main text container">
<div class="item"> <div class="ui link selection list">
<a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank">
<i class="question circle icon"></i>
</a>
</div>
</div>
</nav>
<main class="ui main container">
<?php if(isset($errorMessage)) { ?>
<div class="ui negative message">
<i class="close icon"></i>
<div class="header">Erreur</div>
<p><?=$errorMessage?></p>
</div>
<?php } ?>
<h1 class="header">Scanner un <?=$preset == "host"? "hôte" : "réseau" ?></h1>
<form id="newScanForm" class="ui form" method="get" action="scan.php">
<div class="field">
<label for="targetsInput" 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">Cibles</label>
<input id="targetsInput" type="text" name="targets" placeholder="Cibles"
pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $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']; ?> 10.0-255.0-255.1-254" />
</div>
<div class="ui styled fluid accordion field">
<div class="title"><i class="icon dropdown"></i>Spécification des cibles</div>
<div class="content">
<div class="field">
<label for="excludeInput" title="--exclude">Exclure les hôtes ou réseaux</label>
<input id="excludeInput" type="text" name="--exclude" placeholder="Hôte/réseau" list="targetsList"
pattern="[a-zA-Z0-9._\/,\-]*" value="<?= $options['--exclude'] ?? "" ?>">
</div>
<div class="field">
<label for="iRInput" title="-iR">Nombre de cibles au hasard</label>
<input id="iRInput" type="number" min="0" name="-iR" placeholder="Nombre"
value="<?= $options['-iR'] ?? "" ?>">
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Découverte des hôtes actifs</div>
<div class="content">
<div class="inline field">
<div class="ui toggle checkbox">
<input id="PnCheckbox" type="checkbox" name="-Pn" <?= $options['-Pn'] ?? false ? 'checked' : ''; ?> />
<label for="PnCheckbox" title="-Pn">Sauter cette étape (considérer tous les hôtes comme actifs)</label>
</div>
</div>
<div class="field">
<label for="PSInput" title="-PS">TCP SYN</label>
<input id="PSInput" type="text" name="-PS" placeholder="Ports" list="servicesList"
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-PS'] ?? "" ?>"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
</div>
<div class="field">
<label for="PAInput" title="-PA">TCP ACK</label>
<input id="PAInput" type="text" name="-PA" placeholder="Ports" list="servicesList"
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-PA'] ?? "" ?>"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
</div>
<div class="field">
<label for="PUInput" title="-PU">UDP</label>
<input id="PUInput" type="text" name="-PU" placeholder="Ports" list="servicesList"
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-PU'] ?? "" ?>"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
</div>
<div class="field">
<label>ICMP</label>
<div class="inline fields">
<div class="field">
<div class="ui toggle checkbox">
<input id="PECheckbox" type="checkbox" name="-PE" <?= $options['-PE'] ?? false ? 'checked' : ''; ?> />
<label for="PECheckbox" title="-PE">Echo request</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="PPCheckbox" type="checkbox" name="-PP" <?= $options['-PP'] ?? false ? 'checked' : ''; ?> />
<label for="PPCheckbox" title="-PP">Timestamp request</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="PMCheckbox" type="checkbox" name="-PM" <?= $options['-PM'] ?? false ? 'checked' : ''; ?> />
<label for="PMCheckbox" title="-PM">Mask request</label>
</div>
</div>
</div>
</div>
<div class="field">
<label for="POInput" title="-PO">Protocole IP (par type)</label>
<input id="POInput" type="text" name="-PO" placeholder="Protocole"
pattern="[0-9,\-]+" value="<?= $options['-PO'] ?? "" ?>"
title="[num de protocole]">
</div>
<div class="inline fields">
<div class="field">
<div class="ui toggle checkbox">
<input id="PRCheckbox" type="checkbox" name="-PR" <?= $options['-PR'] ?? false ? 'checked' : ''; ?> />
<label for="PRCheckbox" title="-PR">Ping ARP</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="sendIPCheckbox" type="checkbox" name="--send-ip" <?= $options['--send-ip'] ?? false ? 'checked' : ''; ?> />
<label for="sendIPCheckbox" title="--send-ip">Pas de scan ARP</label>
</div>
</div>
</div>
<div class="inline fields">
<div class="field">
<div class="ui toggle checkbox">
<input id="nCheckbox" type="checkbox" name="-n" <?= $options['-n'] ?? false ? 'checked' : ''; ?> />
<label for="nCheckbox" title="-n">Ne jamais résoudre les noms DNS</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="RCheckbox" type="checkbox" name="-R" <?= $options['-R'] ?? false ? 'checked' : ''; ?> />
<label for="nCheckbox" title="-R">Toujours résoudre les noms DNS<br />(par défault seuls les hôtes actifs sont résolus)</label>
</div>
</div>
</div>
<div class="field">
<label for="dnsServersInput" title="--dns-servers">Utiliser les serveurs DNS</label>
<input id="dnsServersInput" type="text" name="--dns-servers" placeholder="serveur"
pattern="[a-zA-Z0-9._,\-]*" value="<?= $options['--dns-servers'] ?? "" ?>"
title="serv1[,serv2],...">
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Techniques de scan de ports</div>
<div class="content">
<div class="field">
<div class="fields">
<div class="field">
<div class="ui toggle checkbox">
<input id="sSCheckbox" type="checkbox" name="-sS" <?= $options['-sS'] ?? false ? 'checked' : ''; ?> />
<label for="sSCheckbox" title="-sS">TCP SYN</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="sTCheckbox" type="checkbox" name="-sT" <?= $options['-sT'] ?? false ? 'checked' : ''; ?> />
<label for="sTCheckbox" title="-sT">TCP Connect()</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="sACheckbox" type="checkbox" name="-sA" <?= $options['-sA'] ?? false ? 'checked' : ''; ?> />
<label for="sACheckbox" title="-sA">TCP ACK</label>
</div>
</div>
</div>
<div class="fields">
<div class="field">
<div class="ui toggle checkbox">
<input id="sWCheckbox" type="checkbox" name="-sW" <?= $options['-sW'] ?? false ? 'checked' : ''; ?> />
<label for="sWCheckbox" title="-sW">Fenêtre TCP</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="sMCheckbox" type="checkbox" name="-sM" <?= $options['-sM'] ?? false ? 'checked' : ''; ?> />
<label for="sMCheckbox" title="-sM">Maimon</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="sNCheckbox" type="checkbox" name="-sN" <?= $options['-sN'] ?? false ? 'checked' : ''; ?> />
<label for="sNCheckbox" title="-sN">TCP Null</label>
</div>
</div>
</div>
<div class="fields">
<div class="field">
<div class="ui toggle checkbox">
<input id="sFCheckbox" type="checkbox" name="-sF" <?= $options['-sF'] ?? false ? 'checked' : ''; ?> />
<label for="sFCheckbox" title="-sF">TCP FIN</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="sXCheckbox" type="checkbox" name="-sX" <?= $options['-sX'] ?? false ? 'checked' : ''; ?> />
<label for="sXCheckbox" title="-sX">Sapin de Noël</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="sUCheckbox" type="checkbox" name="-sU" <?= $options['-sU'] ?? false ? 'checked' : ''; ?> />
<label for="sUCheckbox" title="-sU">UDP</label>
</div>
</div>
</div>
<div class="field">
<label for="scanflagsInput" title="--scanflags">Scan TCP personnalisé</label>
<input id="scanflagsInput" type="text" name="--scanflags" placeholder="Drapeaux TCP" list="flagsList"
pattern="(URG|ACK|PSH|RST|SYN|FIN|,)+|[1-9]?[0-9]|[1-2][0-9][0-9]" value="<?= $options['--scanflags'] ?? "" ?>"
title="Mélanger simplement les drapeaux URG, ACK, PSH, RST, SYN et FIN.">
</div>
<div class="field">
<label for="sIInput" title="-sI">Hôte zombie</label>
<input id="sIInput" type="text" name="-p" placeholder="zombie host[:probeport]"
pattern="[a-zA-Z0-9._\-]+(:[0-9]+)?" value="<?= $options['-sI'] ?? "" ?>"
title="zombie host[:probeport]">
</div>
<div class="field">
<label for="bInput" title="-b">Rebond FTP</label>
<input id="bInput" type="text" name="-p" placeholder="[<username>[:<password>]@]<server>[:<port>]"
pattern="([a-zA-Z0-9._\-]+(:.+)?@)?[a-zA-Z0-9._\-]+(:[0-9]+)?" value="<?= $options['-b'] ?? "" ?>"
title="[<username>[:<password>]@]<server>[:<port>]">
</div>
<div class="field">
<div class="ui toggle checkbox">
<input id="sUCheckbox" type="checkbox" name="-sU" <?= $options['-sU'] ?? false ? 'checked' : ''; ?> />
<label for="sUCheckbox" title="-sO">Scan des protocoles supportés par la couche IP</label>
</div>
</div>
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Spécifications des ports et ordre du scan</div>
<div class="content">
<div class="inline field">
<div class="ui toggle checkbox" title="-sP">
<input id="sPCheckbox" type="checkbox" name="-sP" <?= $options['-sP'] ?? false ? 'checked' : ''; ?> />
<label for="sPCheckbox">Sauter cette étape</label>
</div>
</div>
<div class="inline field">
<div class="ui toggle checkbox" title="-F">
<input id="FCheckbox" type="checkbox" name="-F" <?= $options['-F'] ?? false ? 'checked' : ''; ?>
onchange="pInput.disabled = FCheckbox.checked" />
<label for="FCheckbox">Scanner les ports connus</label>
</div>
</div>
<div class="field">
<label for="pInput" title="-p">Scanner les ports</label>
<input id="pInput" type="text" name="-p" placeholder="Ports" list="servicesList" <?= $options['-F'] ?? false ? 'disabled' : ''; ?>
pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-p'] ?? "" ?>"
title="Liste de ports ex: ssh,ftp,U:53,111,137,T:21-25,80,139,8080">
</div>
<div class="inline field">
<div class="ui toggle checkbox" title="-r">
<input id="rCheckbox" type="checkbox" name="-r" <?= $options['-r'] ?? false ? 'checked' : ''; ?> />
<label for="rCheckbox">Ne pas mélanger les ports</label>
</div>
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Détection de services et de versions</div>
<div class="content">
<div class="inline field">
<div class="ui toggle checkbox" title="-sV">
<input id="sVCheckbox" type="checkbox" name="-sV" <?= $options['-sV'] ?? false ? 'checked' : ''; ?> />
<label for="sVCheckbox">Détection de version</label>
</div>
</div>
<div class="inline field">
<div class="ui toggle checkbox">
<input id="allportsCheckbox" type="checkbox" name="--allports" <?= $options['--allports'] ?? false ? 'checked' : ''; ?> />
<label for="allportsCheckbox" title="--allports">N'exclure aucun port de la détection de version</label>
</div>
</div>
<div class="field">
<label for="versionIntensityInput" title="--version-intensity">Intensité des tests de version</label>
<input type="number" min="0" max="9" id="versionIntensityInput" name="--version-intensity" placeholder="0-9"
value="<?= $options["--version-intensity"] ?? "" ?>" title="2: léger, 9: tous, défaut: 7">
</div>
<div class="inline field">
<div class="ui toggle checkbox">
<input id="sRCheckbox" type="checkbox" name="-sR" <?= $options['-sR'] ?? false ? 'checked' : ''; ?> />
<label for="sRCheckbox" title="-sR">Scan RPC</label>
</div>
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Scripts</div>
<div class="content">
<div class="inline field">
<div class="ui toggle checkbox">
<input id="sCCheckbox" type="checkbox" name="-sC" <?= $options['-sC'] ?? false ? 'checked' : ''; ?> />
<label for="sCCheckbox" title="-sC">Scripts par défaut</label>
</div>
</div>
<div class="field">
<label for="scriptInput">Scripts</label>
<input id="scriptInput" type="text" name="--script" placeholder="Nom"
title="<catégories|répertoire|nom|all>" list="scripts" pattern="[a-z][a-z0-9\-\.\/]*"
value="<?= $options["--script"] ?? ""; ?>">
</div>
<div class="field">
<label for="scriptArgsInput" title="--script-args">Arguments des scripts</label>
<input id="scriptArgsInput" type="text" name="--script-args" placeholder="arg=valeur"
pattern='[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+(,[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+)?' value="<?= $options['--script-args'] ?? "" ?>"
title="<n1=v1,[n2=v2,...]>">
</div>
<div class="inline field">
<div class="ui toggle checkbox">
<input id="scriptTraceCheckbox" type="checkbox" name="--script-trace" <?= $options['--script-trace'] ?? false ? 'checked' : ''; ?> />
<label for="scriptTraceCheckbox" title="--script-trace">Montrer toutes les données envoyées ou recues</label>
</div>
</div>
<div class="inline field">
<div class="ui toggle checkbox">
<input id="scriptUpdateDBCheckbox" type="checkbox" name="--script-updatedb" <?= $options['--script-updatedb'] ?? false ? 'checked' : ''; ?> />
<label for="scriptUpdateDBCheckbox" title="--script-updatedb">Mettre à jour la base de données des scripts</label>
</div>
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Détection du système d'exploitation</div>
<div class="content">
<div class="inline field">
<div class="ui toggle checkbox">
<input id="OCheckbox" type="checkbox" name="-O" <?= $options['-O'] ?? false ? 'checked' : ''; ?> />
<label for="OCheckbox" title="-O">Détecter le système d'exploitation</label>
</div>
</div>
<div class="inline field">
<div class="ui toggle checkbox">
<input id="osscanLimitCheckbox" type="checkbox" name="--osscan-limit" <?= $options['--osscan-limit'] ?? false ? 'checked' : ''; ?> />
<label for="osscanLimitCheckbox" title="--osscan-limit">Seulement les cibles prometteuses</label>
</div>
</div>
<div class="inline field">
<div class="ui toggle checkbox">
<input id="osscanGuessCheckbox" type="checkbox" name="--osscan-guess" <?= $options['--osscan-guess'] ?? false ? 'checked' : ''; ?> />
<label for="osscanGuessCheckbox" title="--osscan-guess">Essayer de deviner</label>
</div>
</div>
<div class="field">
<label for="maxOSTriesInput" title="--max-os-tries">Nombre d'essais maximum</label>
<input type="number" min="0" id="maxOSTriesInput" name="--max-os-tries" placeholder="Nombre"
value="<?= $options["--max-os-tries"] ?? "" ?>">
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Temporisation et performances</div>
<div class="content">
<div class="field">
<label for="TSelect" title="--T">Intensité des tests de version</label>
<select id="TSelect" class="ui clearable dropdown" name="-T" value="<?= $options["-T"] ?? ""?>">
<option value="0"<?=($options["-T"]??"")==0?" selected":""?>>Paranoïaque</option>
<option value="1"<?=($options["-T"]??"")==1?" selected":""?>>Sournois</option>
<option value="2"<?=($options["-T"]??"")==2?" selected":""?>>Poli</option>
<option value="3"<?=($options["-T"]??"")==3?" selected":""?>>Normal</option>
<option value="4"<?=($options["-T"]??"")==4?" selected":""?>>Aggressif</option>
<option value="5"<?=($options["-T"]??"")==5?" selected":""?>>Dément</option>
</select>
</div>
<div class="field">
<label>Tailles des groupes d'hôtes à scanner en parallèle</label>
<div class="two fields">
<div class="field">
<label for="minHostgroupInput" title="--min-hostgroup">Minimum</label>
<input id="minHostgroupInput" type="number" min="0" placeholder="Nombre"
value="<?= $options["--min-hostgroup"] ?? "" ?>"
oninput="maxHostgroupInput.min = minHostgroupInput.value">
</div>
<div class="field">
<label for="maxHostgroupInput" title="--max-hostgroup">Maximum</label>
<input id="maxHostgroupInput" type="number" min="0" placeholder="Nombre"
value="<?= $options["--max-hostgroup"] ?? "" ?>"
oninput="minHostgroupInput.max = maxHostgroupInput.value">
</div>
</div>
</div>
<div class="field">
<label>Parallélisation des paquets de tests</label>
<div class="two fields">
<div class="field">
<label for="minParallelismInput" title="--min-parallelism">Minimum</label>
<input id="minParallelismInput" type="number" min="0" placeholder="Nombre"
value="<?= $options["--min-parallelism"] ?? "" ?>"
oninput="maxParallelismInput.min = minParallelismInput.value">
</div>
<div class="field">
<label for="maxParallelismInput" title="--max-parallelism">Maximum</label>
<input id="maxParallelismInput" type="number" min="0" placeholder="Nombre"
value="<?= $options["--max-parallelism"] ?? "" ?>"
oninput="minParallelismInput.max = maxParallelismInput.value">
</div>
</div>
</div>
<div class="field">
<label>Temps d'aller-retour des paquets de tests</label>
<div class="three fields">
<div class="field">
<label for="initialRTTNumber" title="--initial-rtt-timeout">Initial</label>
<div class="ui right labeled input">
<input type="number" min="0" id="initialRTTNumber" placeholder="Durée"
oninput="initialRTTHidden.value = initialRTTNumber.value? initialRTTNumber.value+initialRTTUnit.value: ''; maxRTTHidden.initial=initialRTTHidden.value"
<?= preg_match("/^\d+/", $options["--initial-rtt-timeout"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
<select id="initialRTTUnit" class="ui clearable dropdown label"
oninput="initialRTTHidden.value = initialRTTNumber.value? initialRTTNumber.value+initialRTTUnit.value: ''">
<option value="">ms</option>
<option value="s" <?=substr($options["--initial-rtt-timeout"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
<option value="m" <?=substr($options["--initial-rtt-timeout"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
<option value="h" <?=substr($options["--initial-rtt-timeout"]??"", -1)=="h"?"selected":"" ?>>heures</option>
</select>
</div>
<input id="initialRTTHidden" type="hidden" name="--initial-rtt-timeout"
value="<?= $options["--initial-rtt-timeout"] ?? "" ?>">
</div>
<div class="field">
<label for="minRTTNumber" title="--min-rtt-timeout">Minimum</label>
<div class="ui right labeled input">
<input type="number" min="0" id="minRTTNumber" placeholder="Durée"
oninput="minRTTHidden.value = minRTTNumber.value? minRTTNumber.value+minRTTUnit.value: ''; maxRTTHidden.min=minRTTHidden.value"
<?= preg_match("/^\d+/", $options["--min-rtt-timeout"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
<select id="minRTTUnit" class="ui clearable dropdown label"
oninput="minRTTHidden.value = minRTTNumber.value? minRTTNumber.value+minRTTUnit.value: ''">
<option value="">ms</option>
<option value="s" <?=substr($options["--min-rtt-timeout"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
<option value="m" <?=substr($options["--min-rtt-timeout"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
<option value="h" <?=substr($options["--min-rtt-timeout"]??"", -1)=="h"?"selected":"" ?>>heures</option>
</select>
</div>
<input id="minRTTHidden" type="hidden" name="--min-rtt-timeout"
value="<?= $options["--min-rtt-timeout"] ?? "" ?>">
</div>
<div class="field">
<label for="maxRTTNumber" title="--max-rtt-timeout">Maximum</label>
<div class="ui right labeled input">
<input type="number" min="0" id="maxRTTNumber" placeholder="Durée"
oninput="maxRTTHidden.value = maxRTTNumber.value? maxRTTNumber.value+maxRTTUnit.value: ''; minRTTHidden.max=maxRTTHidden.value"
<?= preg_match("/^\d+/", $options["--max-rtt-timeout"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
<select id="maxRTTUnit" class="ui clearable dropdown label"
oninput="maxRTTHidden.value = maxRTTNumber.value? maxRTTNumber.value+maxRTTUnit.value: ''">
<option value="">ms</option>
<option value="s" <?=substr($options["--max-rtt-timeout"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
<option value="m" <?=substr($options["--max-rtt-timeout"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
<option value="h" <?=substr($options["--max-rtt-timeout"]??"", -1)=="h"?"selected":"" ?>>heures</option>
</select>
</div>
<input id="maxRTTHidden" type="hidden" name="--max-rtt-timeout"
value="<?= $options["--max-rtt-timeout"] ?? "" ?>">
</div>
</div>
</div>
<div class="field">
<label for="maxRetriesInput" title="--max-retries">Nombre de retransmissions des paquets de tests des scans de ports</label>
<input type="number" min="0" id="maxRetriesInput" name="--max-retries" placeholder="Nombre"
value="<?= $options["--max-retries"] ?? "" ?>">
</div>
<div class="field">
<label for="hostTimoutInput" title="--host-timeout">Délai d'expiration du scan d'un hôte trop lent</label>
<div class="ui right labeled input">
<input type="number" min="0" id="hostTimoutNumber" placeholder="Durée"
oninput="hostTimoutHidden.value = hostTimoutNumber.value? hostTimoutNumber.value+hostTimoutUnit.value: ''"
<?= preg_match("/^\d+/", $options["--host-timeout"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
<select id="hostTimoutUnit" class="ui clearable dropdown label"
oninput="hostTimoutHidden.value = hostTimoutNumber.value? hostTimoutNumber.value+hostTimoutUnit.value: ''">
<option value="">ms</option>
<option value="s" <?=substr($options["--host-timeout"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
<option value="m" <?=substr($options["--host-timeout"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
<option value="h" <?=substr($options["--host-timeout"]??"", -1)=="h"?"selected":"" ?>>heures</option>
</select>
</div>
<input id="hostTimoutHidden" type="hidden" name="--host-timeout"
value="<?= $options["--host-timeout"] ?? "" ?>">
</div>
<div class="two fields">
<div class="field">
<label for="scanDelayNumber" title="--scan-delay">Délai entre les paquets de tests</label>
<div class="ui right labeled input">
<input type="number" min="0" id="scanDelayNumber" placeholder="Durée"
oninput="scanDelayHidden.value = scanDelayNumber.value? scanDelayNumber.value+scanDelayUnit.value: ''"
<?= preg_match("/^\d+/", $options["--scan-delay"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
<select id="scanDelayUnit" class="ui clearable dropdown label"
oninput="scanDelayHidden.value = scanDelayNumber.value? scanDelayNumber.value+scanDelayUnit.value: ''">
<option value="">ms</option>
<option value="s" <?=substr($options["--scan-delay"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
<option value="m" <?=substr($options["--scan-delay"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
<option value="h" <?=substr($options["--scan-delay"]??"", -1)=="h"?"selected":"" ?>>heures</option>
</select>
</div>
<input id="scanDelayHidden" type="hidden" name="--scan-delay"
value="<?= $options["--scan-delay"] ?? "" ?>">
</div>
<div class="field">
<label for="maxScanDelay" title="--max-scan-delay">Maximum</label>
<div class="ui right labeled input">
<input type="number" min="0" id="maxScanDelay" placeholder="Durée"
oninput="maxRTTHidden.value = maxScanDelay.value? maxScanDelay.value+maxRTTUnit.value: ''"
<?= preg_match("/^\d+/", $options["--max-scan-delay"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
<select id="maxRTTUnit" class="ui clearable dropdown label"
oninput="maxRTTHidden.value = maxScanDelay.value? maxScanDelay.value+maxRTTUnit.value: ''">
<option value="">ms</option>
<option value="s" <?=substr($options["--max-scan-delay"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
<option value="m" <?=substr($options["--max-scan-delay"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
<option value="h" <?=substr($options["--max-scan-delay"]??"", -1)=="h"?"selected":"" ?>>heures</option>
</select>
</div>
<input id="maxRTTHidden" type="hidden" name="--max-scan-delay"
value="<?= $options["--max-scan-delay"] ?? "" ?>">
</div>
</div>
<div class="inline field">
<div class="ui toggle checkbox">
<input id="defeatRSTRateLimitCheckbox" type="checkbox" name="--defeat-rst-ratelimit" <?= $options['--defeat-rst-ratelimit'] ?? false ? 'checked' : ''; ?> />
<label for="defeatRSTRateLimitCheckbox" title="--defeat-rst-ratelimit">Ignorer les limitations de paquets RST</label>
</div>
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Divers</div>
<div class="content">
<div class="field">
<label for="stylesheetSelect" title="--stylesheet">Feuille de style</label>
<select id="stylesheetSelect" class="ui dropdown" name="--stylesheet" value="<?= $options["--stylesheet"] ?? ""?>">
<?php <?php
foreach (scandir($TEMPLATESDIR) as $filename) { if (! function_exists('str_ends_with')) {
if (substr($filename, -4) === '.xsl') { function str_ends_with(string $haystack, string $needle): bool
$name = substr($filename, 0, -4); {
#$URL = rawurlencode($filename); $needle_len = strlen($needle);
if (isset($options["--stylesheet"]) && $name == $options["--stylesheet"]) { return ($needle_len === 0 || 0 === substr_compare($haystack, $needle, - $needle_len));
echo " <option value='$name' selected>$name</option>\n";
} else {
echo " <option value='$name'>$name</option>\n";
}
} }
} }
?>
</select>
</div>
<div class="field"> foreach (scandir("./site") as $file) {
<label for="originalSelect">Comparer avec un précédent scan</label> if (str_ends_with($file, ".xml")) {
<select id="originalSelect" class="ui clearable dropdown" name="original" value="<?= $options["original"] ?? "" ?>"> $site = str_replace(".xml", "", $file);
<option value="">Précédent scan</option> if (file_exists("scans/$site.xml")) {
<?php echo " <a href='site/$site.xml' class='item'>$site</a>\n";
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) === '.xml') {
$name = substr($filename, 0, -4);
#$URL = "$BASEDIR/$SCANSDIR/".rawurlencode($filename);
if (isset($options["original"]) && $name == $options["original"]) {
echo " <option value='$name' selected>$name</option>\n";
} else {
echo " <option value='$name'>$name</option>\n";
}
}
}
?>
</select>
</div>
<div class="field">
<label for="refreshPeriodInput">Rafraîchir toutes les</label>
<div class="ui right labeled input">
<input id="refreshPeriodInput" type="number" min="0" name="refreshPeriod" placeholder="Période"
value="<?= $options["refreshPeriod"] ?? "" ?>">
<div class="ui label">secondes</div>
</div>
</div>
<!--
<div class="inline field">
<div class="ui toggle checkbox">
<input id="sudoCheckbox" type="checkbox" name="sudo" <?= $options["sudo"] ?? false ? 'checked' : ''; ?>/>
<label for="sudoCheckbox" title="sudo">Exécuter en tant qu'administrateur</label>
</div>
</div>
-->
</div>
</div>
<div class="field">
<label for="nameInput">Enregistrer sous le nom</label>
<input id="nameInput" type="text" name="name" placeholder="Réseau local" pattern='[^&lt;&gt;:&quot;\\\/\|@?]+'
title="Caractères interdits : &lt;&gt;:&quot;\/|@?"
value="<?= $options["name"] ?? ""; ?>">
</div>
<button type="submit" class="ui teal submit button">Démarrer</button>
</form>
<h2 class="ui header">Scans enregistrés</h2>
<div class="ui link list">
<?php
if (file_exists($SCANSDIR)) {
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) == '.xml') {
$name = str_replace('!', '/', substr_replace($filename, '', -4));
echo "<a class='item' href='$SCANSDIR/".rawurlencode($filename)."'>$name</a>\n";
} }
} }
} }
?> ?>
</div> </div>
</main> </div>
</body>
<footer class="ui footer segment">
lanScan est basé sur <a href="https://nmap.org/" target="_blank">Nmap</a>
</footer>
<datalist id='targetsList'>
<option value="<?= $_SERVER['REMOTE_ADDR']; ?>/24"></option>
<option value="<?= $_SERVER['SERVER_NAME']; ?>"></option>
</datalist>
<datalist id='servicesList'>
<?php
$services = [];
foreach ([$DATADIR, $NMAPDIR] as $dir) {
echo "<!-- $nmap_services -->\n";
if (file_exists("$dir/nmap-services")) {
$nmap_services = file("$dir/nmap-services");
foreach ($nmap_services as $service) {
if (0 !== strpos($service, '#')) {
[$name, $port] = explode("\t", $service);
$services[$name] = explode("/", $port);
}
}
}
}
foreach ($services as $name => [$portid, $protocol]) {
echo " <option value='$name'></option>\n";
}
?>
</datalist>
<datalist id="flagsList">
<option value="URG"></option>
<option value="ACK"></option>
<option value="PSH"></option>
<option value="RST"></option>
<option value="SYN"></option>
<option value="FIN"></option>
</datalist>
<datalist id="scripts">
<!-- categories -->
<option value="auth"></option>
<option value="broadcast"></option>
<option value="brute"></option>
<option value="default"></option>
<option value="ddiscovery"></option>
<option value="dos"></option>
<option value="exploit"></option>
<option value="external"></option>
<option value="fuzzer"></option>
<option value="intrusive"></option>
<option value="malware"></option>
<option value="safe"></option>
<option value="version"></option>
<option value="vuln"></option>
<!-- names -->
<?php
foreach ([$DATADIR, $NMAPDIR] as $dir) {
foreach (scandir("$dir/scripts") as $filename) {
if (substr($filename, -4) === '.nse') {
$name = substr($filename, 0, -4);
echo " <option value='$name'></option>\n";
}
}
}
?>
</datalist>
<script>
class TagsInput extends Tagify {
constructor(input, options={}, delim = ",") {
if (!options.delimiters) options.delimiters = " |,"
if (!options.originalInputValueFormat) options.originalInputValueFormat = tags => tags.map(tag => tag.value).join(delim)
if (input.list) options.whitelist = Array.from(input.list.options).map(option => option.value)
super(input, options)
}
}
$(".ui.accordion").accordion()
$(".ui.clearable.dropdown").dropdown({
clearable: true
})
$(".ui:not(.clearable).dropdown").dropdown({
clearable: false
})
new TagsInput(targetsInput, {}, " ")
new TagsInput(excludeInput)
new TagsInput(PSInput)
new TagsInput(PAInput)
new TagsInput(PUInput)
new TagsInput(POInput)
var pTagsInput = new TagsInput(pInput)
FCheckbox.onchange = () => {
pInput.disabled = FCheckbox.checked
pTagsInput.setDisabled(FCheckbox.checked)
}
new TagsInput(dnsServersInput)
new TagsInput(scanflagsInput)
new TagsInput(scriptInput, {enforceWhitelist: true})
new TagsInput(scriptArgsInput, {delimiters: ','})
newScanForm.onsubmit = function(event) {
if (this.checkValidity()) {
newScanForm.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> </html>
-86
View File
@@ -1,86 +0,0 @@
<?php include_once "config.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" />
<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" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<nav class="ui inverted teal menu">
<a class="ui teal button item" href=".">
lan<?php include 'logo.svg'; ?>can
</a>
<form id="lanScanForm" class="right menu">
<input type="hidden" name="preset" value="lan"/>
<div class="ui category search item">
<div id="targetsInputDiv" class="ui icon input">
<input class="prompt" type="text" id="targetsInput" name="targets"
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.
Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254" />
<i class="satellite dish icon"></i>
</div>
<button id="hiddenButton" style="display: none;" type="submit" formmethod="get" formaction="scan.php"></button>
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="options.php" onclick="targetsInput.required=false">
<i class="settings icon"></i>
</button>
<a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank">
<i class="question circle icon"></i>
</a>
</div>
</form>
</nav>
<main class="ui main container">
<h1 class="ui header">Scans enregistrés</h1>
<div class="ui large relaxed card">
<div class="content">
<div class="ui divided link list">
<?php
if (!file_exists($SCANSDIR)) {
mkdir($SCANSDIR);
}
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) == '.xml') {
$name = str_replace('!', '/', substr_replace($filename, '', -4));
echo "<a class='item' href='".htmlentities("$SCANSDIR/$filename", ENT_QUOTES)."'>$name</a>\n";
}
}
?>
</div>
</div>
</div>
<script>
hiddenButton.onclick = (event) => {
if (lanScanForm.checkValidity()) {
targetsInputDiv.classList.add('loading')
$.toast({
title: 'Scan en cours...',
message: 'Merci de patienter',
class: 'info',
showIcon: 'satellite dish',
displayTime: 0,
closeIcon: true,
position: 'bottom right',
})
}
}
</script>
</main>
<footer class="ui fixed footer segment">
lanScan est basé sur <a href="https://nmap.org/" target="_blank">Nmap</a>
</footer>
</body>
</html>
Executable → Regular
+1 -1
View File
@@ -1,4 +1,4 @@
<svg class="logo" version="1.1" id="Layer_1" x="0px" y="0px" <svg class="logo" style="margin: 0 -8px 0 0; fill: white;" 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" viewBox="0 0 24 24" xml:space="preserve" width="40" height="40" xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"> xmlns:svg="http://www.w3.org/2000/svg">
<defs id="defs206" /> <defs id="defs206" />

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

+35
View File
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:output method="text" encoding="UTF-8" indent="yes" />
<xsl:param name="site"/>
<xsl:template match="lanScan">
<xsl:text>nmap -v -T4 -p </xsl:text>
<xsl:apply-templates select="//service[not(.=preceding::*)]" />
<xsl:text> --script nse/ --datadir nse/ --script-args-file script-args.ini -oX "</xsl:text>
<xsl:value-of select="@scanpath"/>
<xsl:text>.tmp" </xsl:text>
<xsl:apply-templates select="//host"/>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="service">
<xsl:value-of select="." />
<xsl:if test="position() != last()">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="host">
<xsl:value-of select="@address" />
<xsl:if test="position() != last()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
+21 -24
View File
@@ -1,29 +1,25 @@
local shortport = require "shortport" local shortport = require "shortport"
description = [[ description = [[
Return status, title and favicon URL of a webpage Get and return a page info
]] ]]
--- ---
-- @args http-get.path Path to get. Default /. -- @args http-get.path Path to get. Default /.
-- --
-- @usage nmap -phttp,https --script http-info.nse --script-args http-info.path=/ <host> -- @usage nmap -p80 --script http-info.nse --script-args http-info.path=/ <host>
-- --
-- @output -- @output
-- 80/tcp open http -- status: 200
-- | http-info: -- status-line: HTTP/1.1 200 OK\x0D
-- | status-line: HTTP/1.1 200 OK\x0D
-- |
-- | title: Go ahead and ScanMe!
-- | favicon: http://scanme.nmap.org:80/shared/images/tiny-eyeicon.png
-- |_ status: 200
--- ---
categories = {"discovery", "intrusive"} categories = {"discovery", "intrusive"}
author = "Adrien Malingrey" author = "Adrien Malingrey"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html" license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
portrule = shortport.http portrule = shortport.service({"http", "https", "ssl"})
local http = require "http" local http = require "http"
local stdnse = require "stdnse" local stdnse = require "stdnse"
@@ -32,49 +28,50 @@ action = function(host, port)
local scheme = "" local scheme = ""
local hostaddress = (host.name ~= '' and host.name) or host.ip local hostaddress = (host.name ~= '' and host.name) or host.ip
local path = "/" local path = "/"
local uri
local favicon_relative_uri = "/favicon.ico" local favicon_relative_uri = "/favicon.ico"
local favicon local favicon
stdnse.debug1("port", port.service)
if (port.service == "ssl") then if (port.service == "ssl") then
scheme = "https" scheme = "https"
else else
scheme = port.service scheme = port.service
end end
stdnse.debug1("scheme", scheme)
if(stdnse.get_script_args('http-get.path')) then if(stdnse.get_script_args('http-get.path')) then
path = stdnse.get_script_args('http-info.path') path = stdnse.get_script_args('http-info.path')
end end
stdnse.debug1("Try to download %s", path) uri = scheme.."://"..hostaddress..":"..port.number..path
local answer = http.get(hostaddress, port, path) stdnse.debug1("Try to download %s", uri)
local answer = http.get_url(uri, {})
local output = {status=answer.status, ["status-line"]=answer["status-line"]} local info = {status=answer.status, ["status-line"]=answer["status-line"]}
if (answer and answer.status == 200) then if (answer and answer.status == 200) then
stdnse.debug1("[SUCCESS] Load page %s", path) stdnse.debug1("[SUCCESS] Load page %s", uri)
-- Taken from http-title.nse by Diman Todorov -- Taken from http-title.nse by Diman Todorov
local title = string.match(answer.body, "<[Tt][Ii][Tt][Ll][Ee][^>]*>([^<]*)</[Tt][Ii][Tt][Ll][Ee]>") local title = string.match(answer.body, "<[Tt][Ii][Tt][Ll][Ee][^>]*>([^<]*)</[Tt][Ii][Tt][Ll][Ee]>")
if (title) then if (title) then
output.title = title info.title = title
end end
stdnse.debug1("[INFO] Try favicon %s", favicon_relative_uri) stdnse.debug1("[INFO] Try favicon %s", favicon_relative_uri)
favicon_relative_uri = parseIcon(answer.body) or favicon_relative_uri favicon_relative_uri = parseIcon(answer.body) or "favicon.ico"
else else
stdnse.debug1("[ERROR] Can't load page %s", path) stdnse.debug1("[ERROR] Can't load page %s", uri)
end end
favicon = http.get(hostaddress, port, favicon_relative_uri) favicon_absolute_uri = scheme.."://"..hostaddress..":"..port.number..favicon_relative_uri
favicon = http.get_url(favicon_absolute_uri, {})
if (favicon and favicon.status == 200) then if (favicon and favicon.status == 200) then
stdnse.debug1("[SUCCESS] Load favicon %s", favicon_relative_uri) stdnse.debug1("[SUCCESS] Load favicon %s", favicon_absolute_uri)
output.favicon = favicon_relative_uri info.favicon = favicon_absolute_uri
else else
stdnse.debug1("[ERROR] Can't load favicon %s", favicon_relative_uri) stdnse.debug1("[ERROR] Can't load favicon %s", favicon_absolute_uri)
end end
return output return info
end end
--- function taken from http_favicon.nse by Vlatko Kosturjak --- function taken from http_favicon.nse by Vlatko Kosturjak
+2
View File
@@ -0,0 +1,2 @@
smbuser =
smbpassword =
@@ -1,4 +1,7 @@
local shortport = require "shortport" local stdnse = require "stdnse"
local smb = require "smb"
local msrpc = require "msrpc"
local bin = require "bin"
description = [[ description = [[
Return free and total size in octets of each SMB shares Return free and total size in octets of each SMB shares
@@ -7,7 +10,7 @@ Return free and total size in octets of each SMB shares
--- ---
-- @args See the documentation for the smbauth library. -- @args See the documentation for the smbauth library.
-- --
-- @usage nmap -p137-139,445 --script smb-shares-size.nse --script-args-file smb-authentication.ini <host> -- @usage nmap -p445 --script smb-shares-size.nse <host>
-- --
-- @output -- @output
-- Host script results: -- Host script results:
@@ -22,13 +25,9 @@ categories = {"discovery", "intrusive"}
author = "Adrien Malingrey" author = "Adrien Malingrey"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html" license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
portrule = shortport.service({"microsoft-ds", "netbios-ssn", "smb"}) hostrule = function(host)
return smb.get_port(host) ~= nil
local stdnse = require "stdnse" end
local smb = require "smb"
local smb2 = require "smb2"
local msrpc = require "msrpc"
local bin = require "bin"
action = function(host) action = function(host)
local status, shares, extra local status, shares, extra
@@ -146,13 +145,9 @@ function send_transaction2(smbstate, sub_command, function_parameters, function_
-- Send the transaction request -- Send the transaction request
stdnse.debug2("SMB: Sending SMB_COM_TRANSACTION2") stdnse.debug2("SMB: Sending SMB_COM_TRANSACTION2")
local result, err = smb.smb_send(smbstate, header, parameters, data, overrides) local result, err = smb.smb_send(smbstate, header, parameters, data, overrides)
if(result == false) then
stdnse.debug1("SMB: Try SMBv2 connexion")
local result, err = smb2.smb2_send(smbstate, header, parameters, data, overrides)
if(result == false) then if(result == false) then
return false, err return false, err
end end
end
return true return true
end end
@@ -161,13 +156,9 @@ function receive_transaction2(smbstate)
-- Read the result -- Read the result
local status, header, parameters, data = smb.smb_read(smbstate) local status, header, parameters, data = smb.smb_read(smbstate)
if(status ~= true) then
stdnse.debug1("SMB: Try SMBv2 connexion")
local status, header, parameters, data = smb2.smb2_read(smbstate)
if(status ~= true) then if(status ~= true) then
return false, header return false, header
end end
end
-- Check if it worked -- Check if it worked
local pos, header1, header2, header3, header4, command, status, flags, flags2, pid_high, signature, unused, tid, pid, uid, mid = bin.unpack("<CCCCCICSSlSSSSS", header) local pos, header1, header2, header3, header4, command, status, flags, flags2, pid_high, signature, unused, tid, pid, uid, mid = bin.unpack("<CCCCCICSSlSSSSS", header)
+5 -14
View File
@@ -1,15 +1,6 @@
<?php <?php
header("Content-Disposition: attachment; filename=".str_replace(":", "_", $_GET["v"]).".rdp");
$host = filter_input(INPUT_GET, 'v', FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) ?: filter_input(INPUT_GET, 'v', FILTER_VALIDATE_IP); header("Content-Type: application/rdp");
if (!$host) { print "full address:s:${_GET[v]}\n";
exit(); exit();
} ?>
$port = filter_input(INPUT_GET, 'p', FILTER_VALIDATE_INT);
if ($port) {
$host = "$host:$port";
}
header("Content-Disposition: attachment; filename=$host.rdp");
header('Content-Type: application/rdp');
echo "full address:s:$host\n";
+212
View File
@@ -0,0 +1,212 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:variable name="scan" select="document(string(lanScan/@scanpath))/nmaprun"/>
<xsl:template match="lanScan">
<html lang="fr">
<head>
<title>lanScan - <xsl:value-of select="@site"/></title>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.3/dist/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.css"/>
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.js"></script>
<style>
#logo {
margin: 0 -.4rem 0 0;
}
.main.container {
margin-top: 5em;
}
.ui.mini.button {
padding: 1em;
}
.icon {
display: flex !important;
align-items: center;
}
.icon > img {
width: 16px;
height: 16px;
margin: auto;
}
.button.share-size {
--bg: #21ba45;
}
.item.share-size {
--bg: white;
}
.share-size {
--free-ratio: calc(var(--free) / var(--total));
--used-percent: calc(100% - 100%*var(--free-ratio));
--color: hsl(calc(120*var(--free-ratio)) 100% 50%);
background: linear-gradient(to right, var(--color) var(--used-percent), var(--bg) var(--used-percent), var(--bg)) !important;
}
</style>
<meta http-equiv="refresh" content="60"/>
</head>
<body>
<header class="ui fixed blue inverted menu">
<a href=".." class="header item">lan<img id="logo" src="../logo.svg" alt="S"/>can</a>
<div class="header center item"><xsl:value-of select="@site"/></div>
</header>
<div class="ui main container">
<xsl:choose>
<xsl:when test="$scan/runstats/finished/@errormsg">
<div class="ui negative icon message">
<i class="exclamation triangle icon"></i>
<div class="content">
<div class="header" style="text-transform: capitalize"><xsl:value-of select="$scan/runstats/finished/@exit"/></div>
<p><xsl:value-of select="$scan/runstats/finished/@errormsg"/></p>
</div>
</div>
</xsl:when>
<xsl:when test="$scan/runstats/finished/@summary">
<div class="ui icon message">
<i class="sitemap icon"></i>
<div class="content">
<div class="header" style="text-transform: capitalize"><xsl:value-of select="$scan/runstats/finished/@exit"/></div>
<p><xsl:value-of select="$scan/runstats/finished/@summary"/></p>
</div>
</div>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="hosts"/>
</div>
<script>
$('.ui.dropdown').dropdown()
</script>
</body>
</html>
</xsl:template>
<xsl:template match="hosts">
<h1 class="ui header"><xsl:value-of select="@name"/></h1>
<div class="ui doubling stackable four column compact grid">
<xsl:apply-templates select="host"/>
</div>
</xsl:template>
<xsl:template match="host">
<xsl:variable name="address" select="@address"/>
<xsl:variable name="scannedHost" select="$scan/host[hostnames/hostname/@name=$address or address/@addr=$address]"/>
<xsl:variable name="scannedHostAddress">
<xsl:choose>
<xsl:when test="$scannedHost/hostnames/hostname/@name">
<xsl:value-of select="$scannedHost/hostnames/hostname/@name"/>
</xsl:when>
<xsl:when test="$scannedHost/address/@addr">
<xsl:value-of select="$scannedHost/address/@addr"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$address"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
<xsl:when test="$scannedHost/hostnames/hostname/@name"><xsl:value-of select="substring-before($scannedHost/hostnames/hostname/@name, '.')"/></xsl:when>
</xsl:choose>
</xsl:variable>
<div class="column">
<xsl:variable name="status">
<xsl:choose>
<xsl:when test="$scannedHost/status/@state='up'">success</xsl:when>
<xsl:otherwise>error</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<div class="ui fluid mini left icon action input {$status}">
<xsl:choose>
<xsl:when test="$scannedHost/ports/port/script[@id='http-info']/elem[@key='favicon']">
<i class="icon"><img class="ui image" src="{$scannedHost/ports/port/script[@id='http-info']/elem[@key='favicon']}" alt=""/></i>
</xsl:when>
<xsl:otherwise>
<i class="server icon"></i>
</xsl:otherwise>
</xsl:choose>
<input type="text" readonly="" value="{$name}" placeholder="{$scannedHost/address/@addr}"
title="{@comment} {$scannedHost/hostnames/hostname/@name} ({$scannedHost/address/@addr}) "
onfocus="this.value='{$scannedHostAddress}'; this.select()" onblur="this.value='{$name}'"
/>
<xsl:apply-templates select="service">
<xsl:with-param name="scannedHost" select="$scannedHost"/>
<xsl:with-param name="scannedHostAddress" select="$scannedHostAddress"/>
</xsl:apply-templates>
</div>
</div>
</xsl:template>
<xsl:template match="service">
<xsl:param name="scannedHost"/>
<xsl:param name="scannedHostAddress"/>
<xsl:variable name="serviceName" select="."/>
<xsl:variable name="scannedPort" select="$scannedHost/ports/port[service/@name=$serviceName or @portid=$serviceName][1]"/>
<xsl:variable name="state">
<xsl:choose>
<xsl:when test="$scannedPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
<xsl:when test="$scannedPort/script[@id='http-info']/elem[@key='status']>=400">yellow</xsl:when>
<xsl:when test="$scannedPort/state/@state='filtered'">yellow</xsl:when>
<xsl:when test="$scannedPort/state/@state='open'">green</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="title">
<xsl:value-of select="$scannedPort/@portid"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="$scannedPort/@protocol"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$scannedPort/state/@state"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$scannedPort/service/@name"/>
<xsl:if test="$scannedPort/script[@id='http-info']"><xsl:text>
</xsl:text><xsl:value-of select="$scannedPort/script[@id='http-info']/elem[@key='status-line']"/>
<xsl:value-of select="$scannedPort/script[@id='http-info']/elem[@key='title']"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="($scannedPort/service/@name='microsoft-ds' or $scannedPort/service/@name='netbios-ssn' or $scannedPort/service/@name='smb') and $scannedHost/hostscript/script[@id='smb-shares-size']">
<div class="ui {$state} dropdown mini button share-size" title="{$title}" style="--free:{$scannedHost/hostscript/script[@id='smb-shares-size']/table/elem[@key='FreeSize']}; --total:{$scannedHost/hostscript/script[@id='smb-shares-size']/table/elem[@key='TotalSize']}">
<xsl:value-of select="$serviceName"/>
<i class="dropdown icon"></i>
<div class="menu">
<!-- xsl:apply-templates select="$scannedHost/hostscript/script[@id='smb-shares-size']/table[not(contains(@key, '$'))]" -->
<xsl:apply-templates select="$scannedHost/hostscript/script[@id='smb-shares-size']/table">
<xsl:with-param name="scannedHostAddress" select="$scannedHostAddress"/>
</xsl:apply-templates>
</div>
</div>
</xsl:when>
<xsl:when test="$scannedPort/service/@name='ms-wbt-server' or $scannedPort/service/@name='msrpc'">
<a class="ui {$state} mini button" href="../rdp.php?v={$scannedHostAddress}:{$scannedPort/@portid}" title="{$title}">
<xsl:value-of select="$serviceName"/>
</a>
</xsl:when>
<xsl:when test="$scannedPort/service/@name='ftp' or $scannedPort/service/@name='ssh' or $scannedPort/service/@name='http' or $scannedPort/service/@name='https'">
<a class="ui {$state} mini button" href="{$scannedPort/service/@name}://{$scannedHostAddress}:{$scannedPort/@portid}" target="_blank" title="{$title}">
<xsl:value-of select="$serviceName"/>
</a>
</xsl:when>
<xsl:otherwise>
<a class="ui disabled {$state} mini button" title="{$title}">
<xsl:value-of select="$serviceName"/>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="table">
<xsl:param name="scannedHostAddress"/>
<a class="item share-size" href="file://///{$scannedHostAddress}/{@key}" target="_blank" rel="noopener noreferrer" style="--free:{elem[@key='FreeSize']}; --total:{elem[@key='TotalSize']}">
<xsl:value-of select="@key"/>
</a>
</xsl:template>
</xsl:stylesheet>
Executable
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Usage: ./scan <config>" >&2
exit 1
fi
pushd "$(dirname -- "$0")" > /dev/null
site="$(basename ${1/.yaml/})"
php "to_XML.php" "configs/$site.yaml" > "site/$site.xml" \
&& eval $(xsltproc "nmap_cmd.xsl" "site/$site.xml") \
&& mv "scans/$site.xml.tmp" "scans/$site.xml"
popd > /dev/null
-48
View File
@@ -1,48 +0,0 @@
<?php
include_once 'config.php';
include_once 'filter_inputs.php';
$options["--stylesheet"] = "$BASEDIR/$TEMPLATESDIR/${options["--stylesheet"]}.xsl#";
if (isset($options["name"])) {
$options["--stylesheet"] .= "name=" . rawurlencode($options["name"]) . "&";
}
if (isset($options["original"])) {
$options["--stylesheet"] .= "original=" . rawurlencode($options["original"]) . "&";
}
if (isset($options["refreshPeriod"])) {
$options["--stylesheet"] .= "refreshPeriod={$options["refreshPeriod"]}&";
}
$args = "";
foreach ($options as $option => $value) {
if (substr($option, 0, 1) == '-') {
if (is_null($value)) {
http_response_code(400);
$errorMessage = "Valeur incorrecte pour le paramètre <var>$option</var> : " . filter_input(INPUT_GET, $option, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
include_once ".";
die();
} else if ($value) {
if ($value === true) {
$args .= " $option";
} else {
if (substr($option, 0, 2) == '--') $args .= " $option " . escapeshellarg($value);
else $args .= " $option" . escapeshellarg($value);
}
}
}
}
$command = "$NMAP $args -oX - $targets";
if (isset($options["name"])) {
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
$path = "$SCANSDIR/{$options["name"]}.xml";
$command .= " | tee '$path'";
}
header('Content-type: text/xml');
system($command, $retcode);
exit();
Executable
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
pushd "$(dirname -- $0)" > /dev/null
mkdir -p scans
mkdir -p site
for config in configs/*.yaml
do
site="$(basename ${config/.yaml/})"
echo "Scan $site"
./scan "$site"
done
popd > /dev/null
View File
-34
View File
@@ -1,34 +0,0 @@
# nmap-scripts
## http-info.nse
Return status, title and favicon URL of a webpage
```lua
@args http-get.path Path to get. Default /.
@usage nmap -phttp,https --script http-info.nse --script-args http-info.path=/ <host>
@output
80/tcp open http
| http-info:
| status-line: HTTP/1.1 200 OK\x0D
|
| title: Go ahead and ScanMe!
| favicon: http://scanme.nmap.org:80/shared/images/tiny-eyeicon.png
|_ status: 200
```
## smb-shares-size.nse
Return free and total size in octets of each SMB shares
```lua
@args See the documentation for the smbauth library.
@usage nmap -p137-139,445 --script smb-shares-size.nse --script-args-file smb-shares-size.ini <host>
@output
Host script results:
| smb-shares-size:
| data:
| FreeSize: 38495883264
| TotalSize: 500961574912
|_ IPC$: NT_STATUS_ACCESS_DENIED
```
-3
View File
@@ -1,3 +0,0 @@
<?php
print_r($_SERVER);
-106
View File
@@ -1,106 +0,0 @@
:root{
--nav-height: 3.6rem;
--footer-height: 3.6rem;
}
nav {
height: var(--nav-height);
}
main {
padding-top: var(--nav-height);
min-height: calc(100vh - var(--footer-height) - 1rem)
}
h1:first-child, h2:first-child, h3:first-child, h4:first-child, h5:first-child, .ui.header:first-child {
margin-top: 1rem;
}
svg {
margin: -0.3em -0.5em -0.5em -0.4em;
fill: currentColor;
}
.ui.footer.segment {
margin-bottom: 0;
}
.tagify {
width: 100%;
border-radius: 0.28571429rem;
--tags-focus-border-color: #85b7d9;
--placeholder-color: rgba(191, 191, 191, 0.87);
--placeholder-color-focus: rgba(115, 115, 115, 0.87);
}
.ui.table {
caption-side: bottom;
}
.ui.label {
margin: 0.14285714em;
}
.ui.label > .detail {
margin-left: 0.3em;
text-transform: capitalize;
}
.ui.form .fields > .field {
width: 100%;
}
.ui.ui.form .field .fields .field:not(:only-child) .ui.checkbox {
margin-top: 0;
}
.ui.dropdown.label {
min-width: auto;
}
.ui.dropdown.label > .remove.icon {
right: 2.3em;
}
.toast-container .ui.header {
text-transform: capitalize;
}
.share-size {
--free-ratio: calc(var(--free) / var(--total));
--used-percent: calc(100% - 100% * var(--free-ratio));
--color: hsl(calc(120 * var(--free-ratio)) 100% 50%);
background-image: linear-gradient(
to right,
var(--color) var(--used-percent),
transparent var(--used-percent),
transparent
) !important;
text-align: center !important;
}
.compact {
position: static !important;
overflow-x: auto;
}
.compact > input {
min-width: 10em;
padding-right: 0.1em;
}
.compact .ui.buttons .mini.button {
padding: 0.5em;
position: static;
}
.compact .ui.dropdown.button:not(.pointing):not(.floating).active {
border-radius: 0;
}
.compact .ui.dropdown .menu {
left: 0;
right: 0;
margin: -.7em .7em;
min-width: auto;
}
-186
View File
@@ -1,186 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:import href="lib/head.xsl"/>
<xsl:import href="lib/nav.xsl"/>
<xsl:import href="lib/service.xsl"/>
<xsl:import href="lib/toast.xsl"/>
<xsl:output method="html" encoding="UTF-8"/>
<xsl:output indent="yes"/>
<xsl:strip-space elements='*'/>
<xsl:param name="thisURL" select=""/>
<xsl:param name="originalURL" select=""/>
<xsl:param name="refreshPeriod" select="0"/>
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
<xsl:choose>
<xsl:when test="$thisURL"><xsl:value-of select="$thisURL"/></xsl:when>
<xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="nmaprun">
<xsl:variable name="targets" select="substring-after(@args, '.xml ')"/>
<html lang="fr">
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
<body>
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
<main class="ui wide container">
<div class="ui header container">
<h1 class="ui header"><xsl:value-of select="$targets"/></h1>
</div>
<div class="ui doubling stackable five column compact grid">
<div class="ui centered link cards">
<xsl:apply-templates select="host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]"/>
</div>
</div>
</main>
<footer class="ui footer segment">
lanScan est basé sur <a href="https://nmap.org/" target="_blank">Nmap</a>
</footer>
<script>
$('.ui.dropdown').dropdown()
function hostScanning(link) {
link.parentElement.parentElement.classList.add("loading")
$.toast({
title : 'Scan en cours...',
message : 'Merci de patienter',
class : 'info',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
}
</script>
<xsl:apply-templates select="runstats">
<xsl:with-param name="init" select="$init"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="host">
<xsl:variable name="addr" select="address/@addr"/>
<xsl:variable name="initHost" select="$init/host[address/@addr=$addr]"/>
<xsl:variable name="currentHost" select="$current/host[address/@addr=$addr]"/>
<xsl:variable name="hostAddress">
<xsl:choose>
<xsl:when test="hostnames/hostname/@name">
<xsl:value-of select="hostnames/hostname/@name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="address/@addr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<div>
<xsl:attribute name="class">
<xsl:text>ui card </xsl:text>
<xsl:choose>
<xsl:when test="$currentHost/status/@state='up'">green</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<div class="content">
<div class="header">
<xsl:choose>
<xsl:when test="$currentHost">
<div>
<xsl:attribute name="class">
<xsl:text>ui empty circular label </xsl:text>
<xsl:choose>
<xsl:when test="$currentHost/status/@state='up'">green</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</div>
</xsl:when>
<xsl:otherwise><div class="ui empty circular label red"></div></xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="hostnames/hostname/@name">
<xsl:value-of select="substring-before(hostnames/hostname/@name, '.')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="address/@addr"/>
</xsl:otherwise>
</xsl:choose>
</div>
<div class="meta">
<xsl:if test="substring-after(hostnames/hostname/@name, '.')">
<div>
<xsl:text>.</xsl:text>
<xsl:value-of select="substring-after(hostnames/hostname/@name, '.')"/>
</div>
</xsl:if>
<div><xsl:value-of select="address/@addr"/></div>
<xsl:if test="address[@addrtype='mac']/@vendor">
<div><xsl:value-of select="address[@addrtype='mac']/@vendor"/></div>
</xsl:if>
</div>
<div class="description">
<xsl:apply-templates select="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]" mode="service">
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:with-param name="class" select="'ui label'"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</div>
</div>
<div class="ui buttons">
<a class="ui icon labeled teal button" onclick="hostScanning(this)">
<xsl:attribute name="href">
<xsl:value-of select="$basedir"/>
<xsl:text>/scan.php?preset=host&amp;targets=</xsl:text>
<xsl:value-of select="$hostAddress"/>
</xsl:attribute>
<i class="satellite dish icon"></i>
<xsl:text> Services</xsl:text>
</a>
<a class="ui icon teal button ">
<xsl:attribute name="href">
<xsl:value-of select="$basedir"/>
<xsl:text>/?preset=host&amp;targets=</xsl:text>
<xsl:value-of select="$hostAddress"/>
</xsl:attribute>
<i class="settings icon"></i>
</a>
</div>
</div>
</xsl:template>
</xsl:stylesheet>
-200
View File
@@ -1,200 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:import href="lib/head.xsl"/>
<xsl:import href="lib/nav.xsl"/>
<xsl:import href="lib/service.xsl"/>
<xsl:import href="lib/toast.xsl"/>
<xsl:output method="html" encoding="UTF-8"/>
<xsl:output indent="yes"/>
<xsl:strip-space elements='*'/>
<xsl:param name="thisURL" select=""/>
<xsl:param name="originalURL" select=""/>
<xsl:param name="refreshPeriod" select="0"/>
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
<xsl:choose>
<xsl:when test="$thisURL"><xsl:value-of select="$thisURL"/></xsl:when>
<xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="nmaprun">
<xsl:variable name="targets" select="substring-after(@args, '.xml ')"/>
<html lang="fr">
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
<body>
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
<main class="ui wide container">
<h1 class="ui header"><xsl:value-of select="$targets"/></h1>
<div class="form">
<div class="ui doubling stackable four column compact grid">
<xsl:apply-templates select="host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]"/>
</div>
</div>
</main>
<footer class="ui footer segment">
lanScan est basé sur <a href="https://nmap.org/" target="_blank">Nmap</a>
</footer>
<script>
$('.ui.dropdown').dropdown()
</script>
<xsl:apply-templates select="runstats">
<xsl:with-param name="init" select="$init"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="host">
<xsl:variable name="addr" select="address/@addr"/>
<xsl:variable name="initHost" select="$init/host[address/@addr=$addr]"/>
<xsl:variable name="currentHost" select="$current/host[address/@addr=$addr]"/>
<xsl:variable name="hostAddress">
<xsl:choose>
<xsl:when test="hostnames/hostname/@name">
<xsl:value-of select="hostnames/hostname/@name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="address/@addr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<div class="column">
<div>
<xsl:attribute name="class">
<xsl:text>ui fluid mini compact input </xsl:text>
<xsl:if test="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]">
<xsl:text>action buttons </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="$currentHost/status/@state='up'">success</xsl:when>
<xsl:otherwise>error</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<input type="text" readonly="" value="{substring-before(hostnames/hostname/@name, '.')}" placeholder="{address/@addr}"
title="{$currentHost/hostnames/hostname/@name} ({address/@addr})"
onfocus="this.value='{hostnames/hostname/@name}'; this.select()" onblur="this.value='{substring-before(hostnames/hostname/@name, '.')}'"
/>
<xsl:apply-templates select="$initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')] | $currentHost/ports/port" mode="service">
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:with-param name="class" select="'ui mini button'"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</div>
</div>
</xsl:template>
<xsl:template match="port">
<xsl:param name="hostAddress"/>
<xsl:param name="initHost"/>
<xsl:param name="currentHost"/>
<xsl:variable name="portid" select="@portid"/>
<xsl:variable name="initPort" select="$initHost/ports/port[@portid=$portid]"/>
<xsl:variable name="currentPort" select="$currentHost/ports/port[@portid=$portid]"/>
<xsl:variable name="state">
<xsl:choose>
<xsl:when test="$currentHost/state/@state='open'">green</xsl:when>
<xsl:when test="$currentHost/state/@state='filtered'">yellow</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a target="_blank">
<xsl:attribute name="class">
<xsl:text>ui mini button </xsl:text>
<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']>=400">orange</xsl:when>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
<xsl:when test="$currentPort/state/@state='open'">green</xsl:when>
<xsl:when test="$currentPort/state/@state='filtered'">orange</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table"> dropdown share-size</xsl:if>
</xsl:attribute>
<xsl:if test="service/@name='ms-wbt-server'">
<xsl:attribute name="href">
<xsl:text>rdp.php?v=</xsl:text>
<xsl:value-of select="$hostAddress"/>
<xsl:text>&amp;p=</xsl:text>
<xsl:value-of select="@portid"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="title">
<xsl:value-of select="@portid"/>/<xsl:value-of select="@protocol"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="service/@name='unknown'">
<xsl:choose>
<xsl:when test="@protocol='tcp'">:</xsl:when>
<xsl:otherwise><xsl:value-of select="substring(@protocol, 1, 1)"/>:</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@portid"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="service/@name"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table">
<xsl:attribute name="style">
<xsl:for-each select="$currentHost/hostscript/script[@id='smb-shares-size']/table">
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending"/>
<xsl:if test="position()=1">
<xsl:text>--free: </xsl:text>
<xsl:value-of select="elem[@key='FreeSize']"/>
<xsl:text>; --total: </xsl:text>
<xsl:value-of select="elem[@key='TotalSize']"/>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
<i class="dropdown icon"></i>
<div class="menu">
<xsl:apply-templates select="$currentHost/hostscript/script[@id='smb-shares-size']/table">
<xsl:with-param name="hostAddress" select="$hostAddress"/>
</xsl:apply-templates>
</div>
</xsl:if>
</a>
</xsl:template>
<xsl:template match="table">
<xsl:param name="hostAddress"/>
<a class="item share-size" href="file://///{$hostAddress}/{@key}" target="_blank" rel="noopener noreferrer" style="--free: {elem[@key='FreeSize']}; --total: {elem[@key='TotalSize']}">
<xsl:value-of select="@key"/>
</a>
</xsl:template>
</xsl:stylesheet>
-203
View File
@@ -1,203 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:import href="lib/head.xsl"/>
<xsl:import href="lib/nav.xsl"/>
<xsl:import href="lib/service.xsl"/>
<xsl:import href="lib/toast.xsl"/>
<xsl:output method="html" encoding="UTF-8"/>
<xsl:output indent="yes"/>
<xsl:strip-space elements='*'/>
<xsl:param name="thisURL" select=""/>
<xsl:param name="originalURL" select=""/>
<xsl:param name="refreshPeriod" select="0"/>
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
<xsl:choose>
<xsl:when test="$thisURL"><xsl:value-of select="$thisURL"/></xsl:when>
<xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="nmaprun">
<xsl:variable name="targets" select="substring-after(@args, '.xml ')"/>
<html lang="fr">
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
<body>
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
<main class="ui main container">
<xsl:apply-templates select="host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]"/>
</main>
<footer class="ui footer segment">
lanScan est basé sur <a href="https://nmap.org/" target="_blank">Nmap</a>
</footer>
<script>
var table = $('#scanResultsTable').DataTable({
buttons : ['copy', 'excel', 'pdf'],
fixedHeader: true,
lengthMenu : [
[256, 512, 1024, 2048, -1],
[256, 512, 1024, 2048, "All"]
],
responsive: true,
colReorder: true,
buttons : ['copy', 'excel', 'pdf']
})
table.order([1, 'asc']).draw()
$('.ui.dropdown').dropdown()
</script>
<xsl:apply-templates select="runstats">
<xsl:with-param name="init" select="$init"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="host">
<xsl:variable name="addr" select="address/@addr"/>
<xsl:variable name="initHost" select="$init/host[address/@addr=$addr]"/>
<xsl:variable name="currentHost" select="$current/host[address/@addr=$addr]"/>
<xsl:variable name="hostAddress">
<xsl:choose>
<xsl:when test="hostnames/hostname/@name">
<xsl:value-of select="hostnames/hostname/@name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="address/@addr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<h1 class="ui header">
<xsl:choose>
<xsl:when test="hostnames/hostname/@name">
<xsl:value-of select="hostnames/hostname/@name"/>
<div class="sub header"><xsl:value-of select="address/@addr"/></div>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="address/@addr"/>
</xsl:otherwise>
</xsl:choose>
</h1>
<table id="scanResultsTable" style="width:100%" role="grid" class="ui sortable small table">
<thead>
<tr>
<th>Etat</th>
<th>Protocole</th>
<th>Port</th>
<th>Service</th>
<th>Produit</th>
<th>Version</th>
<th>Infos</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]">
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</tbody>
</table>
</xsl:template>
<xsl:template match="port">
<xsl:param name="hostAddress"/>
<xsl:param name="initHost"/>
<xsl:param name="currentHost"/>
<xsl:variable name="portid" select="@portid"/>
<xsl:variable name="initPort" select="$initHost/ports/port[@portid=$portid]"/>
<xsl:variable name="currentPort" select="$currentHost/ports/port[@portid=$portid]"/>
<tr>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">negative</xsl:when>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">warning</xsl:when>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">positive</xsl:when>
<xsl:when test="$currentPort/state/@state='open'">positive</xsl:when>
<xsl:when test="$currentPort/state/@state='filtered'">warning</xsl:when>
<xsl:otherwise>negative</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td>
<div>
<xsl:attribute name="class">
<xsl:text>ui mini circular label </xsl:text>
<xsl:choose>
<xsl:when test="$currentPort/state/@state='open'">green</xsl:when>
<xsl:when test="$currentPort/state/@state='filtered'">orange</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="$currentPort/state/@state"/>
</div>
</td>
<td style="text-transform: uppercase">
<xsl:value-of select="@protocol"/>
</td>
<td>
<xsl:value-of select="@portid"/>
</td>
<td>
<xsl:apply-templates select="." mode="service">
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:with-param name="class" select="'ui mini fluid button'"/>
</xsl:apply-templates>
</td>
<td>
<xsl:value-of select="service/@product"/>
</td>
<td>
<xsl:value-of select="service/@version"/>
</td>
<td>
<xsl:value-of select="service/@extrainfo"/>
</td>
</tr>
</xsl:template>
<xsl:template match="table">
<xsl:param name="hostAddress"/>
<a class="item share-size" href="file://///{$hostAddress}/{@key}" target="_blank" rel="noopener noreferrer" style="--free: {elem[@key='FreeSize']}; --total: {elem[@key='TotalSize']}">
<xsl:value-of select="@key"/>
</a>
</xsl:template>
</xsl:stylesheet>
-198
View File
@@ -1,198 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:import href="lib/head.xsl"/>
<xsl:import href="lib/nav.xsl"/>
<xsl:import href="lib/service.xsl"/>
<xsl:import href="lib/toast.xsl"/>
<xsl:output method="html" encoding="UTF-8"/>
<xsl:output indent="yes"/>
<xsl:strip-space elements='*'/>
<xsl:param name="thisURL" select=""/>
<xsl:param name="originalURL" select=""/>
<xsl:param name="refreshPeriod" select="0"/>
<xsl:param name="sudo" select="false()"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
<xsl:choose>
<xsl:when test="$thisURL"><xsl:value-of select="$thisURL"/></xsl:when>
<xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="nmaprun">
<xsl:variable name="targets" select="substring-after(@args, '-oX - ')"/>
<html lang="fr">
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
<body>
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
<main class="ui main container">
<h1 class="ui header"><xsl:value-of select="$targets"/></h1>
<table id="scanResultsTable" style="width:100%" role="grid" class="ui sortable small table">
<thead>
<tr>
<th>Etat</th>
<th>Adresse IP</th>
<th>Nom</th>
<th>Fabricant</th>
<th class="six wide">Services</th>
<th>Scanner les services</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]"/>
</tbody>
</table>
</main>
<footer class="ui footer segment">
lanScan est basé sur <a href="https://nmap.org/" target="_blank">Nmap</a>
</footer>
<script>
var table = $('#scanResultsTable').DataTable({
buttons : ['copy', 'excel', 'pdf'],
fixedHeader: true,
lengthMenu : [
[256, 512, 1024, 2048, -1],
[256, 512, 1024, 2048, "All"]
],
responsive: true,
colReorder: true,
buttons : ['copy', 'excel', 'pdf']
})
table.order([1, 'asc']).draw()
$('.ui.dropdown').dropdown()
function hostScanning(link) {
link.getElementsByTagName('i')[0].className = 'loading spinner icon'
$.toast({
title : 'Scan en cours...',
message : 'Merci de patienter',
class : 'info',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
}
</script>
<xsl:apply-templates select="runstats">
<xsl:with-param name="init" select="$init"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="host">
<xsl:variable name="addr" select="address/@addr"/>
<xsl:variable name="initHost" select="$init/host[address/@addr=$addr]"/>
<xsl:variable name="currentHost" select="$current/host[address/@addr=$addr]"/>
<xsl:variable name="hostAddress">
<xsl:choose>
<xsl:when test="hostnames/hostname/@name">
<xsl:value-of select="hostnames/hostname/@name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="address/@addr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="$currentHost/status/@state='up'">positive</xsl:when>
<xsl:otherwise>negative</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td>
<xsl:choose>
<xsl:when test="$currentHost">
<div>
<xsl:attribute name="class">
<xsl:text>ui mini circular label </xsl:text>
<xsl:choose>
<xsl:when test="$currentHost/status/@state='up'">green</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="$currentHost/status/@state"/>
</div>
</xsl:when>
<xsl:otherwise><div class="ui red circular label">down</div></xsl:otherwise>
</xsl:choose>
</td>
<td>
<xsl:value-of select="address/@addr"/>
</td>
<td>
<div><b><xsl:value-of select="substring-before(hostnames/hostname/@name, '.')"/></b></div>
<xsl:if test="substring-after(hostnames/hostname/@name, '.')">
<div>.<xsl:value-of select="substring-after(hostnames/hostname/@name, '.')"/></div>
</xsl:if>
</td>
<td>
<xsl:value-of select="address[@addrtype='mac']/@vendor"/>
</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:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:with-param name="class" select="'ui label'"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</td>
<td>
<div class="ui mini right labeled button">
<a class="ui mini icon teal button" onclick="hostScanning(this)">
<xsl:attribute name="href">
<xsl:value-of select="$basedir"/>
<xsl:text>/scan.php?preset=host&amp;targets=</xsl:text>
<xsl:value-of select="address/@addr"/>
</xsl:attribute>
<i class="satellite dish icon"></i>
<xsl:text> Services</xsl:text>
</a>
<a class="ui mini icon teal label">
<xsl:attribute name="href">
<xsl:value-of select="$basedir"/>
<xsl:text>/?preset=host&amp;targets=</xsl:text>
<xsl:value-of select="address/@addr"/>
</xsl:attribute>
<i class="settings icon"></i>
</a>
</div>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
-70
View File
@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:import href="parseCommand.xsl"/>
<xsl:template match="nmaprun" mode="head">
<xsl:param name="basedir"/>
<xsl:param name="targets"/>
<xsl:param name="nextComparison"/>
<xsl:param name="refreshPeriod"/>
<xsl:param name="sudo"/>
<head>
<meta charset="utf-8"/>
<xsl:if test="$refreshPeriod > 0">
<meta http-equiv="refresh">
<xsl:attribute name="content">
<xsl:value-of select="$refreshPeriod"/>
<xsl:text>;URL=</xsl:text>
<xsl:value-of select="$basedir"/>
<xsl:text>/scan.php?targets=</xsl:text>
<xsl:value-of select="$targets"/>
<xsl:text>&amp;</xsl:text>
<xsl:call-template name="parseCommand">
<xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/>
<xsl:with-param name="asURL" select="true()"/>
</xsl:call-template>
<xsl:text>originalURL=</xsl:text>
<xsl:value-of select="$nextComparison"/>
<xsl:text>&amp;refreshPeriod=</xsl:text>
<xsl:value-of select="$refreshPeriod"/>
<xsl:text>&amp;sudo=</xsl:text>
<xsl:value-of select="$sudo"/>
</xsl:attribute>
</meta>
</xsl:if>
<title>
<xsl:text>lanScan - </xsl:text>
<xsl:value-of select="$targets"/>
</title>
<link rel="icon" href="{$basedir}/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/se/jszip-3.10.1/dt-2.1.8/b-3.1.2/b-html5-3.1.2/b-print-3.1.2/cr-2.0.4/fc-5.0.3/fh-4.0.1/r-3.0.3/datatables.min.css" rel="stylesheet"/>
<link href="{$basedir}/style.css" rel="stylesheet" type="text/css"/>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
<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>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/v/se/jszip-3.10.1/dt-2.1.8/b-3.1.2/b-html5-3.1.2/b-print-3.1.2/cr-2.0.4/fc-5.0.3/fh-4.0.1/r-3.0.3/datatables.min.js"></script>
<script>
DataTable.ext.type.detect.unshift(function (d) {
return /[\d]+\.[\d]+\.[\d]+\.[\d]+/.test(d)
? 'ipv4-address'
: null;
});
DataTable.ext.type.order['ipv4-address-pre'] = function (ipAddress) {
[a, b, c, d] = ipAddress.split(".").map(Number)
return 16777216*a + 65536*b + 256*c + d;
};
</script>
</head>
</xsl:template>
</xsl:stylesheet>
-80
View File
@@ -1,80 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:import href="parseCommand.xsl"/>
<xsl:template match="nmaprun" mode="nav">
<xsl:param name="basedir"/>
<xsl:param name="targets"/>
<xsl:param name="nextComparison"/>
<xsl:param name="refreshPeriod"/>
<xsl:param name="sudo"/>
<nav class="ui inverted teal fixed menu">
<a class="ui teal button item" href="{$basedir}">
<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" xmlns:svg="http://www.w3.org/2000/svg"><defs id="defs206"/><g id="g998" transform="matrix(0,0.04687491,-0.04687491,0,24,2.2682373e-5)"><g id="g147"><g id="g145"><path d="m 322.065,92.046 c -46.24,0 -83.851,37.619 -83.851,83.857 v 168.712 c 0,25.224 -21.148,45.745 -46.372,45.745 -25.224,0 -46.372,-20.521 -46.372,-45.745 V 199.464 h -38.114 v 145.151 c 0,46.24 38.246,83.859 84.486,83.859 46.24,0 84.486,-37.619 84.486,-83.859 V 175.903 c 0,-25.223 20.514,-45.743 45.737,-45.743 25.223,0 45.737,20.521 45.737,45.743 v 134.092 h 38.114 V 175.903 c 0,-46.239 -37.611,-83.857 -83.851,-83.857 z" id="path143"/></g></g><g id="g153"><g id="g151"><path d="M 144.198,0 H 108.625 C 98.101,0 89.568,8.746 89.568,19.271 c 0,1.157 0.121,2.328 0.318,3.598 h 73.052 c 0.197,-1.27 0.318,-2.441 0.318,-3.598 C 163.256,8.746 154.723,0 144.198,0 Z" id="path149"/></g></g><g id="g159"><g id="g157"><path d="m 420.183,486.591 h -71.731 c -0.626,2.541 -0.978,4.077 -0.978,6.176 0,10.525 8.532,19.234 19.057,19.234 h 35.573 c 10.525,0 19.057,-8.709 19.057,-19.234 0,-2.098 -0.352,-3.635 -0.978,-6.176 z" id="path155"/></g></g><g id="g165"><g id="g163"><rect x="87.027" y="41.925999" width="80.040001" height="138.481" id="rect161"/></g></g><g id="g171"><g id="g169"><rect x="344.93301" y="329.052" width="80.040001" height="138.481" id="rect167"/></g></g><g id="g173"></g><g id="g175"></g><g id="g177"></g><g id="g179"></g><g id="g181"></g><g id="g183"></g><g id="g185"></g><g id="g187"></g><g id="g189"></g><g id="g191"></g><g id="g193"></g><g id="g195"></g><g id="g197"></g><g id="g199"></g><g id="g201"></g></g></svg>
<xsl:text>can</xsl:text>
</a>
<form id="lanScanForm" class="right menu">
<xsl:call-template name="parseCommand">
<xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/>
<xsl:with-param name="asURL" select="false()"/>
</xsl:call-template>
<div class="ui category search item">
<div id="targetsInputDiv" class="ui icon input">
<input class="prompt" type="text" id="targetsInput" name="targets" 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 10.0-255.0-255.1-254"/>
<i class="satellite dish icon"></i>
</div>
<input type="hidden" name="originalURL" value="{$nextComparison}"/>
<input type="hidden" name="refreshPeriod" value="{$refreshPeriod}"/>
<input type="hidden" name="sudo" value="{$sudo}"/>
<button id="hiddenButton" style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php"></button>
<button id="refreshButton" class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/scan.php">
<i class="sync icon"></i>
</button>
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/">
<i class="settings icon"></i>
</button>
<a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank">
<i class="question circle icon"></i>
</a>
</div>
</form>
</nav>
<script>
hiddenButton.onclick = function(event) {
if (lanScanForm.checkValidity()) {
targetsInputDiv.classList.add('loading')
$.toast({
title : 'Scan en cours...',
message : 'Merci de patienter',
class : 'info',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
}
}
refreshButton.onclick = function(event) {
refreshButton.getElementsByTagName('i')[0].className = 'loading spinner icon'
$.toast({
title : 'Scan en cours...',
message : 'Merci de patienter',
class : 'info',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
}
</script>
</xsl:template>
</xsl:stylesheet>
-105
View File
@@ -1,105 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:template name="parseCommand">
<xsl:param name="argList" select=""/>
<xsl:param name="asURL" select="false()"/>
<xsl:variable name="nextArgs" select="substring-after($argList, ' -')"/>
<xsl:variable name="argAndValue">
<xsl:choose>
<xsl:when test="$nextArgs">
<xsl:value-of select="substring-before($argList, ' -')"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$argList"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="starts-with($argAndValue, '-')">
<xsl:choose>
<xsl:when test="contains($argAndValue, ' ')">
<xsl:call-template name="input">
<xsl:with-param name="name" select="substring-before($argAndValue, ' ')"/>
<xsl:with-param name="value" select="substring-after($argAndValue, ' ')"/>
<xsl:with-param name="asURL" select="$asURL"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="input">
<xsl:with-param name="name" select="$argAndValue"/>
<xsl:with-param name="value" select="on"/>
<xsl:with-param name="asURL" select="$asURL"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="starts-with($argAndValue, 'P') or starts-with($argAndValue, 's') or starts-with($argAndValue, 'o')">
<xsl:call-template name="input">
<xsl:with-param name="name" select="substring($argAndValue, 1, 2)"/>
<xsl:with-param name="value" select="substring($argAndValue, 3)"/>
<xsl:with-param name="asURL" select="$asURL"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="input">
<xsl:with-param name="name" select="substring($argAndValue, 1, 1)"/>
<xsl:with-param name="value" select="substring($argAndValue, 2)"/>
<xsl:with-param name="asURL" select="$asURL"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$nextArgs">
<xsl:call-template name="parseCommand">
<xsl:with-param name="argList" select="$nextArgs"/>
<xsl:with-param name="asURL" select="$asURL"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="input">
<xsl:param name="name"/>
<xsl:param name="value" select=""/>
<xsl:param name="asURL" select="false()"/>
<xsl:variable name="valueWithoutQuotes">
<xsl:choose>
<xsl:when test="substring-after($value, '&quot;')">
<xsl:value-of select="substring-before(substring-after($value, '&quot;'), '&quot;')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$asURL">
<xsl:text>-</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>=</xsl:text>
<xsl:choose>
<xsl:when test="$valueWithoutQuotes"><xsl:value-of select="$valueWithoutQuotes"/></xsl:when>
<xsl:otherwise>on</xsl:otherwise>
</xsl:choose>
<xsl:text>&amp;</xsl:text>
</xsl:when>
<xsl:otherwise>
<input type="hidden" name="-{$name}">
<xsl:attribute name="value">
<xsl:choose>
<xsl:when test="$valueWithoutQuotes"><xsl:value-of select="$valueWithoutQuotes"/></xsl:when>
<xsl:otherwise>on</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</input>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
-102
View File
@@ -1,102 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:template match="port" mode="service">
<xsl:param name="hostAddress"/>
<xsl:param name="initHost"/>
<xsl:param name="currentHost"/>
<xsl:param name="class"/>
<xsl:variable name="portid" select="@portid"/>
<xsl:variable name="initPort" select="$initHost/ports/port[@portid=$portid]"/>
<xsl:variable name="currentPort" select="$currentHost/ports/port[@portid=$portid]"/>
<a target="_blank">
<xsl:attribute name="class">
<xsl:value-of select="$class"/>
<xsl:text> </xsl:text>
<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']>=400">orange</xsl:when>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
<xsl:when test="$currentPort/state/@state='open'">green</xsl:when>
<xsl:when test="$currentPort/state/@state='filtered'">orange</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$currentPort/script[@id='smb-shares-size']/table"> mini dropdown button share-size</xsl:when>
<xsl:otherwise> small</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">
<xsl:attribute name="style">
<xsl:for-each select="$currentPort/script[@id='smb-shares-size']/table">
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending"/>
<xsl:if test="position()=1">
<xsl:text>--free: </xsl:text>
<xsl:value-of select="elem[@key='FreeSize']"/>
<xsl:text>; --total: </xsl:text>
<xsl:value-of select="elem[@key='TotalSize']"/>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
</xsl:if>
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="service/@name='http' and service/@tunnel='ssl'">
<xsl:text>https</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="service/@name"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>://</xsl:text>
<xsl:value-of select="$hostAddress"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="@portid"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="service/@name='ms-wbt-server'">
<xsl:attribute name="href">
<xsl:text>rdp.php?v=</xsl:text>
<xsl:value-of select="$hostAddress"/>
<xsl:text>&amp;p=</xsl:text>
<xsl:value-of select="@portid"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="title">
<xsl:value-of select="@portid"/>/<xsl:value-of select="@protocol"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="service/@name='unknown'">
<xsl:choose>
<xsl:when test="@protocol='tcp'">:</xsl:when>
<xsl:otherwise><xsl:value-of select="substring(@protocol, 1, 1)"/>:</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@portid"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="service/@name"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">
<i class="dropdown icon"></i>
<div class="menu">
<xsl:apply-templates select="$currentPort/script[@id='smb-shares-size']/table">
<xsl:with-param name="hostAddress" select="$hostAddress"/>
</xsl:apply-templates>
</div>
</xsl:if>
</a>
</xsl:template>
<xsl:template match="table">
<xsl:param name="hostAddress"/>
<a class="item share-size" href="file://///{$hostAddress}/{@key}" target="_blank" rel="noopener noreferrer" style="--free: {elem[@key='FreeSize']}; --total: {elem[@key='TotalSize']}">
<xsl:value-of select="@key"/>
</a>
</xsl:template>
</xsl:stylesheet>
-44
View File
@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:template match="runstats">
<xsl:param name="init"/>
<script>
<xsl:if test="finished/@summary">
$.toast({
title : '<xsl:value-of select="finished/@exit"/>',
message : `<xsl:value-of select="finished/@summary"/>`,
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
<xsl:if test="finished/@errormsg">
$.toast({
title : '<xsl:value-of select="finished/@exit"/>',
message : `<xsl:value-of select="finished/@errormsg"/>`,
showIcon : 'exclamation triangle',
class : 'error',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
<xsl:if test="$init/runstats/finished">
$.toast({
message : 'Comparaison avec les résultats du <xsl:value-of select="$init/runstats/finished/@timestr"/>',
class : 'info',
showIcon : 'calendar',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
</script>
</xsl:template>
</xsl:stylesheet>
+47
View File
@@ -0,0 +1,47 @@
<?php
$file = $argv[1];
$site = basename($file, ".yaml");
$__DIR__ = __DIR__;
$conf = yaml_parse_file($file);
$xml = new DomDocument("1.0", "utf-8");
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
$xml->appendChild($xml->createProcessingInstruction("xml-stylesheet", "href='../results.xsl' type='text/xsl'"));
$root = $xml->appendChild($xml->createElement("lanScan"));
$root->setAttribute("scanpath", "./scans/$site.xml");
function appendArray($document, $node, $array) {
foreach ($array as $key => $value) {
if (is_array($value)) {
foreach ($value as $vkey => $vvalue) {
if (is_string($vkey)) {
if (is_array($vvalue)) {
$child = $document->createElement($vkey);
toXML($document, $child, $vvalue);
} else {
$child = $document->createElement($vkey, $vvalue);
}
$node->appendChild($child);
} else {
if (is_array($vvalue)) {
$child = $document->createElement($key);
appendArray($document, $child, $vvalue);
} else {
$child = $document->createElement($key, $vvalue);
}
$node->appendChild($child);
}
}
} else {
$node->setAttribute($key, $value);
}
}
}
appendArray($xml, $root, $conf);
print $xml->saveXML();
?>
+37
View File
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:output method="text" encoding="UTF-8" indent="yes" />
<xsl:param name="network"/>
<xsl:template match="nmaprun">
<xsl:text>---
site: Nom du site
hosts:
- name: Réseau </xsl:text><xsl:value-of select="$network"/><xsl:text>
host:
</xsl:text>
<xsl:apply-templates select="host"/>
</xsl:template>
<xsl:template match="host">
<xsl:text> - address: </xsl:text>
<xsl:choose>
<xsl:when test="hostnames/hostname/@name"><xsl:value-of select="hostnames/hostname/@name" /></xsl:when>
<xsl:otherwise> <xsl:value-of select="address/@addr" /></xsl:otherwise>
</xsl:choose>
service: [<xsl:apply-templates select="ports/port"/>]
</xsl:template>
<xsl:template match="port">
<xsl:value-of select="service/@name" />
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>