164 Commits

Author SHA1 Message Date
adrien 13f42cad36 undo URL 2025-02-04 10:05:12 +01:00
adrien eeba9d613b fix scan select 2025-02-04 09:08:10 +01:00
adrien dba34f39eb small changes 2025-02-04 03:44:37 +01:00
adrien 0e24595170 more infos 2025-02-04 03:29:44 +01:00
adrien efed32d11d url 2025-02-04 03:18:53 +01:00
adrien ae0abc39cf split nav 2025-02-04 03:13:55 +01:00
adrien a981059c73 service link 2025-02-04 03:08:45 +01:00
adrien c2d2a2455d slit head 2025-02-04 02:48:35 +01:00
adrien dd16294e8d host scan 2025-02-04 02:42:17 +01:00
adrien 6f0cc6e9bd lan scan 2025-02-03 20:25:46 +01:00
adrien b4016685a0 WIP 2025-02-03 18:22:49 +01:00
adrien f39c328d06 WIP 2025-02-03 10:20:20 +01:00
adrien cbbf09677e WIP 2025-01-31 17:57:55 +01:00
adrien 2b1fd671da init v4 2025-01-30 16:20:16 +01:00
adrien b445d08ce1 outch 2025-01-27 18:47:38 +01:00
adrien e2c1c6604e WIP 2025-01-24 17:38:33 +01:00
adrien a593148c38 add --defeat-rst-ratelimit 2024-12-04 16:26:58 +01:00
adrien d45b05941f putain de point virgule 2024-11-26 15:18:01 +01:00
adrien e423273752 save if name only 2024-11-26 15:15:12 +01:00
adrien 0c72ceb620 system 2024-11-25 18:02:54 +01:00
adrien dc8fa57c0f fix ' in message 2024-11-25 15:17:12 +01:00
adrien 53679e2098 fixed navbar 2024-11-25 11:25:40 +01:00
adrien 8cd0ba066f rrr 2024-10-23 19:39:19 +02:00
adrien 602c1fc7f3 rename script-arg-file 2024-10-23 19:39:00 +02:00
adrien 06eb33187b ignore script-args-file.ini 2024-10-23 19:19:28 +02:00
adrien 43d2df7850 script-args-file.ini 2024-10-23 19:18:59 +02:00
adrien 9d7f526080 use shortport.http 2024-10-23 19:10:56 +02:00
adrien 80dc329353 https 2024-10-23 19:02:13 +02:00
adrien 81652e25c9 ignore password 2024-10-23 15:48:28 +02:00
adrien 4e14da1860 script-arg-file.ini 2024-10-23 15:46:59 +02:00
adrien 8e5f010da0 rename saveAs to name 2024-10-23 15:17:03 +02:00
adrien df4648e12a f*cking css 2024-10-23 14:02:05 +02:00
adrien 154d731e55 use service template 2024-10-22 23:24:08 +02:00
adrien 2ef0421078 unfixed menu 2024-10-22 17:57:11 +02:00
adrien f2acc56ef7 smb-shares-size template 2024-10-22 17:55:31 +02:00
adrien 1d5bb5446d move script arg file 2024-10-22 16:38:01 +02:00
adrien 7790369ac1 return to bin.pack 2024-10-22 15:50:19 +02:00
adrien bfb7788df0 rawurlencode on $thisURL 2024-10-22 02:09:59 +02:00
adrien c174b3a142 fix renaming 2024-10-22 01:52:34 +02:00
adrien 1a0bb6abf5 clearable 2024-10-22 01:50:37 +02:00
adrien c01cfb631b renaming 2024-10-22 01:26:34 +02:00
adrien f1bb88abec rename compareWith to original 2024-10-22 01:07:08 +02:00
adrien f2af893303 more options 2024-10-22 00:35:00 +02:00
adrien 8865da906d hostgroup 2024-10-21 23:56:32 +02:00
adrien f05edd0fc7 RTTDuration 2024-10-21 22:59:52 +02:00
adrien 2eda5ca9c9 change options icon 2024-10-21 22:31:28 +02:00
adrien 68a98fb5a5 more options 2024-10-21 01:14:22 +02:00
adrien 7bddbd3e10 fix nav 2024-10-20 17:58:53 +02:00
adrien 0b59c94f52 export nav 2024-10-20 17:35:37 +02:00
adrien bd8e988444 export head 2024-10-20 15:03:45 +02:00
adrien cadcd37408 export toast 2024-10-20 13:49:04 +02:00
adrien d8bc7d99fb update cards 2024-10-20 13:46:35 +02:00
adrien 458c04afa1 remove htmlentities 2024-10-20 13:44:55 +02:00
adrien f001e1b61d fix url 2024-10-20 13:41:51 +02:00
adrien db6643b8bb split service label 2024-10-20 12:43:51 +02:00
adrien a7c67292ed --script-args 2024-10-20 12:33:50 +02:00
adrien dfd89a5add remove quotes on value 2024-10-20 12:30:09 +02:00
adrien c6b8005958 split command parsing 2024-10-20 12:22:24 +02:00
adrien 705904fbfa update scripts 2024-10-20 02:36:26 +02:00
adrien af6dc0a76b portrule 2024-10-20 02:18:46 +02:00
adrien 321935e7a8 align 2024-10-20 02:18:38 +02:00
adrien baef7123b8 option -T 2024-10-20 01:56:33 +02:00
adrien f14062fda5 rename var 2024-10-20 01:32:54 +02:00
adrien b55df2e880 not wide 2024-10-20 00:49:57 +02:00
adrien 5882baf8ae script filter 2024-10-20 00:49:52 +02:00
adrien dba9e2e9b7 dont include known port on url 2024-10-20 00:29:41 +02:00
adrien 4928b346b3 default 2024-10-18 18:41:15 +02:00
adrien 0c736158aa merge index and options 2024-10-18 16:14:52 +02:00
adrien 17a628cc11 split domain suffix 2024-10-18 15:20:59 +02:00
adrien b6900bc76a templates 2024-10-18 15:08:49 +02:00
adrien c3ed9f9fc2 reorg 2024-10-18 14:47:02 +02:00
adrien a773e8b8d9 datadir 2024-10-18 12:11:45 +02:00
adrien 54116d27d0 scripts 2024-10-18 02:04:55 +02:00
adrien 887e024f27 add http title 2024-10-18 01:31:04 +02:00
adrien 9f06bd0b66 add personnal scripts 2024-10-18 01:30:05 +02:00
adrien 63dbcb407f more options 2024-10-18 00:39:53 +02:00
adrien e7b462c033 style 2024-10-17 20:09:26 +02:00
adrien d39798ea4e title 2024-10-17 16:49:56 +02:00
adrien 88280ac41d update stylesheets 2024-10-17 15:56:32 +02:00
adrien 8c4dda99b5 add -sU 2024-10-17 14:52:20 +02:00
adrien 22de01a01b move nmap scripts to separate git projet nmap-scripts 2024-10-17 11:29:42 +02:00
adrien 1832864505 overflow 2024-10-17 09:00:12 +02:00
adrien 59d0695d1b no services 2024-10-17 08:45:25 +02:00
adrien 4b3634dc67 rename hostsTable 2024-10-17 08:41:50 +02:00
adrien b3b9db4aa7 compact stylesheet 2024-10-17 03:27:22 +02:00
adrien 3b90e7f6cc move stylesheets to subfolder 2024-10-17 02:19:21 +02:00
adrien 290932a421 rename stylesheet 2024-10-17 00:48:26 +02:00
adrien 9683dd2283 fix options with - 2024-10-17 00:45:59 +02:00
adrien df5c7e8497 layout 2024-10-16 23:44:47 +02:00
adrien 5e0985e7d6 undo footer 2024-10-16 23:41:46 +02:00
adrien ff18e2352c footer 2024-10-16 23:38:20 +02:00
adrien 7aeb817c4c footer 2024-10-16 23:32:25 +02:00
adrien 7c4d32c83f cards stylesheet 2024-10-16 23:31:02 +02:00
adrien 4ccd659d63 fix no name 2024-10-16 22:13:48 +02:00
adrien c2b40b5c71 fix no name 2024-10-16 22:11:04 +02:00
adrien 6fc85431af fix stylesheet value 2024-10-16 22:01:22 +02:00
adrien 18775fb8b1 rename host scan to services details 2024-10-16 21:50:44 +02:00
adrien 9f2826d522 inclure lanScan options in presets 2024-10-16 21:41:57 +02:00
adrien 653bb604f5 args name with "-" 2024-10-16 21:25:02 +02:00
adrien 6c33080785 presets 2024-10-16 20:55:43 +02:00
adrien a1aeefee47 rename $inputs to $args 2024-10-16 20:15:54 +02:00
adrien 5e76b92b96 targets no longer required 2024-10-16 20:08:49 +02:00
adrien ec917b4602 sudo in web options 2024-10-16 19:01:44 +02:00
adrien 260c8f073a config
Signed-off-by: Adrien MALINGREY <adrien@malingrey.fr>
2024-10-16 11:52:42 +02:00
adrien 570e8f2252 use sudo at will 2024-10-16 11:04:12 +02:00
adrien cd6f64679b include error message 2024-10-16 10:43:11 +02:00
adrien 6422830783 more options 2024-10-15 23:19:22 +02:00
adrien 7ef62104f0 don't spin all form 2024-10-15 22:34:36 +02:00
adrien 386d0fc65d use sudo on need 2024-10-15 16:24:07 +02:00
adrien 9a525b6ffe install sudo 2024-10-15 08:35:50 +02:00
adrien 6a3589b988 README 2024-10-15 08:34:00 +02:00
adrien 2c771c0766 split some options 2024-10-15 08:29:01 +02:00
adrien 1befb0017c more options 2024-10-15 02:55:42 +02:00
adrien 95d509e1b1 merge right menu items 2024-10-15 01:38:58 +02:00
adrien f8f1183fe7 refreshPeriod input 2024-10-14 23:37:57 +02:00
adrien 9cb008785c host options 2024-10-14 21:21:08 +02:00
adrien 2337fe1e60 little fixes 2024-10-14 15:40:50 +02:00
adrien 1f2ab88641 fix sudo 2024-10-14 14:43:55 +02:00
adrien 641f214899 basedir o logo 2024-10-14 12:48:32 +02:00
adrien 89a7613f9e encode url 2024-10-14 05:00:51 +02:00
adrien fdf15e5a7d datatable import 2024-10-14 04:54:49 +02:00
adrien 47c0bbdb4c mac vendor 2024-10-14 04:41:18 +02:00
adrien db216baf46 reorder options 2024-10-14 04:12:56 +02:00
adrien cf5dcf24a7 small fixes 2024-10-14 03:36:07 +02:00
adrien 2f7eebdaf1 host scan stylesheet 2024-10-14 02:50:36 +02:00
adrien ad79495608 saveAs and compareWith as URL 2024-10-14 00:49:19 +02:00
adrien 76e1832c28 use other stylesheets 2024-10-13 18:07:32 +02:00
adrien f7629028f6 footer 2024-10-13 15:36:46 +02:00
adrien f5a0cffc05 temp file 2024-10-13 15:04:58 +02:00
adrien bcf6ddff0d default values 2024-10-13 14:20:20 +02:00
adrien df6f5154e2 refresh to scan.php 2024-10-13 14:16:52 +02:00
adrien efff220fe3 pass inputs with recursive template 2024-10-13 07:29:16 +02:00
adrien cb0a4d94a5 dont serve stdout if ok 2024-10-13 07:29:00 +02:00
adrien 48113dc7cc fix names 2024-10-13 07:28:11 +02:00
adrien b197af448a quote in name, params on index link 2024-10-13 04:37:49 +02:00
adrien 97a4c5801b lot of stuff 2024-10-12 19:10:50 +02:00
adrien 8a9b822cf6 fix 2024-10-10 18:08:42 +02:00
adrien f413212db9 fix scan args 2024-10-10 18:07:44 +02:00
adrien 01f8ee3ea0 circular label on status 2024-10-10 09:03:27 +02:00
adrien 664bee1249 options 2024-10-10 02:10:06 +02:00
adrien bcb63b3d0f remove - 2024-10-10 02:07:00 +02:00
adrien 3c9978569b toast 2024-10-10 02:05:32 +02:00
adrien eae12a8e4e get query 2024-10-09 03:08:41 +02:00
adrien ce4f8dda1a get default args 2024-10-09 03:08:20 +02:00
adrien b3cffaed35 default args 2024-10-09 03:07:56 +02:00
adrien a6ba7c4b23 oops 2024-10-09 01:46:44 +02:00
adrien 865a8efb62 filter inputs 2024-10-09 01:36:51 +02:00
adrien 3a594acb48 index list 2024-10-08 18:30:24 +02:00
adrien b4f75a5984 more fields 2024-10-08 18:08:39 +02:00
adrien 4e9dd60477 input with checkbox 2024-10-08 12:21:55 +02:00
adrien 20e6b22d0d tag validation 2024-10-08 11:14:31 +02:00
adrien 3dd9e39f5c tag input 2024-10-08 05:26:09 +02:00
adrien 7062b94aaa scan options draft 2024-10-08 05:13:40 +02:00
adrien d5dd51921c new scan menu 2024-10-07 20:42:16 +02:00
adrien b02c89973c filename 2024-10-07 20:34:38 +02:00
adrien 0d56163339 filter input 2024-10-07 20:33:03 +02:00
adrien 6319d411c5 remove basedir 2024-10-07 16:28:29 +02:00
adrien 6dd728ce0d save only first scan 2024-10-07 12:09:12 +02:00
adrien 1d8457d020 faivonc 2024-10-07 10:27:34 +02:00
adrien 85fab8e41b variable rename 2024-10-07 03:38:29 +02:00
adrien bef547fae0 true example 2024-10-07 03:38:10 +02:00
adrien 42e16d3ef8 index 2024-10-07 02:48:34 +02:00
adrien f44e1d8267 second draft 2024-10-07 01:16:44 +02:00
adrien 34a4058ba4 first draft 2024-10-04 18:04:25 +02:00
29 changed files with 2200 additions and 812 deletions
+2 -3
View File
@@ -1,4 +1,3 @@
nse/script-args.ini
configs/
scans/
site/
datadir/script-args.ini
test.php
-28
View File
@@ -1,28 +0,0 @@
# 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.sh <CIDR>`.
* Scanner avec le script `./scan_all.sh` (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]
```
+14 -22
View File
@@ -1,27 +1,19 @@
# lanScan
# nmap-webui
A simple web interface for Nmap for network discovery and monitoring
Scan hosts with `nmap` and display results in webpage.
## Dependencies
* Create a configuration yaml file in ./configs/ subdirectory (see example below).
It may be generated by scanning a network with `./discover.sh <CIDR>`.
* Scan with `./scan_all.sh` (use a cron task!).
* Open `.\index.php` in web browser to see results.
As most of the `nmap` features requires to be `root`, you will have to run this command to avoid the need to specify the password when the interface will invocate `nmap`.
## Example
```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]
```bash
# Authorize nmap to run as root without password
echo "$USER ALL = NOPASSWD: $(which nmap)" | sudo tee -a /etc/sudoers.d/nmap
```
Allow web server to save scans:
```bash
mkdir scans
chown www-data scans
chmod 750 scans
```
+8
View File
@@ -0,0 +1,8 @@
<?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";
$STYLESHEETSDIR = "stylesheets";
$lanScanCmd = "sudo nmap -PSmicrosoft-ds -F -T5 -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/lanScan.xsl";
$hostScanCmd = "sudo nmap -A -T5 -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/hostScan.xsl";
-25
View File
@@ -1,25 +0,0 @@
#!/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.yml"
php to_XML.php "configs/$site.yml" > "site/$site.xml"
popd > /dev/null
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

+102
View File
@@ -0,0 +1,102 @@
<?php include_once "config.php"; ?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<title>lanScan</title>
<link rel="icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
<style>
body > .grid {
height: 100%;
}
.logo {
margin-right: 0 !important;
}
</style>
</head>
<body>
<div class="ui middle aligned center aligned grid inverted">
<div class="column" style="max-width: 450px;">
<h2 class="ui inverted teal fluid image header logo">
lan<?php include 'logo.svg'; ?>can
</h2>
<form id="scanForm" class="ui large form initial inverted" action="." method="get">
<div class="ui left aligned stacked segment inverted">
<h4 class="ui header">Découvrir ou superviser un réseau</h4>
<div class="inverted field">
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
<?php
if (file_exists($SCANSDIR)) {
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) === '.xml') {
$name = substr($filename, 0, -4);
$name = str_replace("!", "/", $name);
echo " <option value='$name'>$name</option>\n";
}
}
}
?>
</select>
</div>
<div class="ui error message"></div>
<button type="submit" class="ui fluid large teal labeled icon submit button">
<i class="satellite dish icon"></i>Scanner
</button>
</div>
</form>
<div class="ui inverted segment">
<a href="options.php">Options avancées</a>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui/dist/semantic.min.js"></script>
<script>
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
$('#scanForm').form({
fields: {
lan: {
identifier: 'lanSelect',
rules: [{
type: 'regExp',
value: /[a-zA-Z0-9._\/ \-]+/,
prompt: "Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.<br/>Exemples : <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"
}]
}
}
});
scanForm.onsubmit = function(event) {
if (this.checkValidity()) {
scanForm.classList.add("loading")
$.toast({
title : 'Scan en cours...',
message : 'Merci de patienter',
class : 'info',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
return true
} else {
event.preventDefault()
this.reportValidity()
}
}
</script>
</body>
</html
+95 -39
View File
@@ -1,46 +1,102 @@
<!doctype html>
<?php include_once "config.php"; ?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>lanScan</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;
}
</style>
</head>
<body>
<header class="ui fixed centered blue inverted menu">
<div class="header item">lan<img id="logo" src="logo.svg" alt="S"/>can</div>
</header>
<div class="ui main text container">
<div class="ui link selection list">
<head>
<meta charset="utf-8" />
<title>lanScan</title>
<link rel="icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
<style>
body > .grid {
height: 100%;
}
.logo {
margin-right: 0 !important;
}
</style>
</head>
<body>
<div class="ui middle aligned center aligned grid inverted">
<div class="column" style="max-width: 450px;">
<h2 class="ui inverted teal fluid image header logo">
lan<?php include 'logo.svg'; ?>can
</h2>
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
<div class="ui left aligned stacked segment inverted">
<h4 class="ui header">Découvrir ou superviser un réseau</h4>
<div class="inverted field">
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
<?php
if (! function_exists('str_ends_with')) {
function str_ends_with(string $haystack, string $needle): bool
{
$needle_len = strlen($needle);
return ($needle_len === 0 || 0 === substr_compare($haystack, $needle, - $needle_len));
if (file_exists($SCANSDIR)) {
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) === '.xml') {
$name = substr($filename, 0, -4);
$name = str_replace("!", "/", $name);
echo " <option value='$name'>$name</option>\n";
}
}
}
foreach (scandir("./site") as $file) {
if (str_ends_with($file, ".xml")) {
$site = str_replace(".xml", "", $file);
if (file_exists("scans/$site.xml")) {
echo " <a href='site/$site.xml' class='item'>$site</a>\n";
}
}
}
?>
</select>
</div>
<div class="ui error message"></div>
<button type="submit" class="ui fluid large teal labeled icon submit button">
<i class="satellite dish icon"></i>Scanner
</button>
</div>
</form>
<div class="ui inverted segment">
<a href="options.php">Options avancées</a>
</div>
</div>
</body>
</html>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui/dist/semantic.min.js"></script>
<script>
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
$('#scanForm').form({
fields: {
lan: {
identifier: 'lanSelect',
rules: [{
type: 'regExp',
value: /[a-zA-Z0-9._\/ \-]+/,
prompt: "Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.<br/>Exemples : <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"
}]
}
}
});
scanForm.onsubmit = function(event) {
if (this.checkValidity()) {
scanForm.classList.add("loading")
$.toast({
title : 'Scan en cours...',
message : 'Merci de patienter',
class : 'info',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
return true
} else {
event.preventDefault()
this.reportValidity()
}
}
</script>
</body>
</html
Regular → Executable
+1 -1
View File
@@ -1,4 +1,4 @@
<svg class="logo" style="margin: 0 -8px 0 0; fill: white;" version="1.1" id="Layer_1" x="0px" y="0px"
<svg class="image 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" />

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

-35
View File
@@ -1,35 +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:output method="text" encoding="UTF-8" indent="yes" />
<xsl:param name="site"/>
<xsl:template match="lanScan">
<xsl:text>nmap -v -T4 -Pn -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>
-109
View File
@@ -1,109 +0,0 @@
local shortport = require "shortport"
description = [[
Get and return a page info
]]
---
-- @args http-get.path Path to get. Default /.
--
-- @usage nmap -p80 --script http-info.nse --script-args http-info.path=/ <host>
--
-- @output
-- status: 200
-- status-line: HTTP/1.1 200 OK\x0D
---
categories = {"discovery", "intrusive"}
author = "Adrien Malingrey"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
portrule = shortport.service({"http", "https", "ssl"})
local http = require "http"
local stdnse = require "stdnse"
action = function(host, port)
local scheme = ""
local hostaddress = (host.name ~= '' and host.name) or host.ip
local path = "/"
local uri
local favicon_relative_uri = "/favicon.ico"
local favicon
if (port.service == "ssl") then
scheme = "https"
else
scheme = port.service
end
if(stdnse.get_script_args('http-get.path')) then
path = stdnse.get_script_args('http-info.path')
end
uri = scheme.."://"..hostaddress..":"..port.number..path
stdnse.debug1("Try to download %s", uri)
local answer = http.get_url(uri, {})
local info = {status=answer.status, ["status-line"]=answer["status-line"]}
if (answer and answer.status == 200) then
stdnse.debug1("[SUCCESS] Load page %s", uri)
-- Taken from http-title.nse by Diman Todorov
local title = string.match(answer.body, "<[Tt][Ii][Tt][Ll][Ee][^>]*>([^<]*)</[Tt][Ii][Tt][Ll][Ee]>")
if (title) then
info.title = title
end
stdnse.debug1("[INFO] Try favicon %s", favicon_relative_uri)
favicon_relative_uri = parseIcon(answer.body) or "favicon.ico"
else
stdnse.debug1("[ERROR] Can't load page %s", uri)
end
favicon_absolute_uri = scheme.."://"..hostaddress..":"..port.number..favicon_relative_uri
favicon = http.get_url(favicon_absolute_uri, {})
if (favicon and favicon.status == 200) then
stdnse.debug1("[SUCCESS] Load favicon %s", favicon_absolute_uri)
info.favicon = favicon_absolute_uri
else
stdnse.debug1("[ERROR] Can't load favicon %s", favicon_absolute_uri)
end
return info
end
--- function taken from http_favicon.nse by Vlatko Kosturjak
function parseIcon( body )
local _, i, j
local rel, href, word
-- Loop through link elements.
i = 0
while i do
_, i = string.find(body, "<%s*[Ll][Ii][Nn][Kk]%s", i + 1)
if not i then
return nil
end
-- Loop through attributes.
j = i
while true do
local name, quote, value
_, j, name, quote, value = string.find(body, "^%s*(%w+)%s*=%s*([\"'])(.-)%2", j + 1)
if not j then
break
end
if string.lower(name) == "rel" then
rel = value
elseif string.lower(name) == "href" then
href = value
end
end
for word in string.gmatch(rel or "", "%S+") do
if string.lower(word) == "icon" then
return href
end
end
end
end
-2
View File
@@ -1,2 +0,0 @@
smbuser =
smbpassword =
-206
View File
@@ -1,206 +0,0 @@
local stdnse = require "stdnse"
local smb = require "smb"
local smb2 = require "smb2"
local msrpc = require "msrpc"
local bin = require "bin"
local shortport = require "shortport"
description = [[
Return free and total size in octets of each SMB shares
]]
---
-- @args See the documentation for the smbauth library.
--
-- @usage nmap -p445 --script smb-shares-size.nse <host>
--
-- @output
-- Host script results:
-- | smb-shares-size:
-- | data:
-- | FreeSize: 38495883264
-- | TotalSize: 500961574912
-- |_ IPC$: NT_STATUS_ACCESS_DENIED
---
categories = {"discovery", "intrusive"}
author = "Adrien Malingrey"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
portrule = shortport.service({"microsoft-ds", "netbios-ssn", "smb"})
action = function(host)
local status, shares, extra
local response = stdnse.output_table()
-- Try and do this the good way, make a MSRPC call to get the shares
stdnse.debug1("SMB: Attempting to log into the system to enumerate shares")
status, shares = msrpc.enum_shares(host)
if(status == false) then
return stdnse.format_output(false, string.format("Couldn't enumerate shares: %s", shares))
end
-- Get more information on each share
for i = 1, #shares, 1 do
local share = shares[i]
if (share ~= nil) then
local status, result = get_share_info(host, share)
if (status) then
response[share] = result
end
end
end
return response
end
TRANS2_QUERY_FS_INFORMATION = 0x0003
SMB_QUERY_FS_SIZE_INFO = 0x0103
---Attempts to retrieve additional information about a share. Will fail unless we have
-- administrative access.
--
--@param host The host object.
--@return Status (true or false).
--@return A table of information about the share (if status is true) or an an error string (if
-- status is false).
function get_share_info(host, share)
local status, smbstate, err
local hostaddress = (host.name ~= '' and host.name) or host.ip
local path = "\\\\" .. hostaddress .. "\\" .. share
status, smbstate = smb.start(host)
status, err = smb.negotiate_protocol(smbstate, {})
status, err = smb.start_session(smbstate, {})
status, err = smb.tree_connect(smbstate, path, {})
stdnse.debug1("SMB: Getting information for share: %s", path)
local status, err = send_transaction2(smbstate, TRANS2_QUERY_FS_INFORMATION, bin.pack("<S", SMB_QUERY_FS_SIZE_INFO))
if ( not(status) ) then
status, err = smb.stop(smbstate)
return false, "Failed to send data to server: send_transaction2"
end
local status, response = receive_transaction2(smbstate)
if ( not(status) ) then
status, err = smb.stop(smbstate)
return false, response
end
local pos, totalAllocationUnits, totalFreeAllocationUnits, sectorsPerAllocationUnit, bytesPerSector = bin.unpack("<LLII", response.data)
status, err = smb.stop(smbstate)
return true, {
TotalSize = totalAllocationUnits * sectorsPerAllocationUnit * bytesPerSector,
FreeSize = totalFreeAllocationUnits * sectorsPerAllocationUnit * bytesPerSector
}
end
-- Taken from smb lib
function send_transaction2(smbstate, sub_command, function_parameters, function_data, overrides)
overrides = overrides or {}
local header1, header2, header3, header4, command, status, flags, flags2, pid_high, signature, unused, pid, mid
local header, parameters, data
local parameter_offset = 0
local parameter_size = 0
local data_offset = 0
local data_size = 0
local total_word_count, total_data_count, reserved1, parameter_count, parameter_displacement, data_count, data_displacement, setup_count, reserved2
local response = {}
-- Header is 0x20 bytes long (not counting NetBIOS header).
header = smb.smb_encode_header(smbstate, smb.command_codes['SMB_COM_TRANSACTION2'], overrides) -- 0x32 = SMB_COM_TRANSACTION2
if(function_parameters) then
parameter_offset = 0x44
parameter_size = #function_parameters
data_offset = #function_parameters + 33 + 32
end
-- Parameters are 0x20 bytes long.
parameters = bin.pack("<SSSSCCSISSSSSCCS",
parameter_size, -- Total parameter count.
data_size, -- Total data count.
0x000a, -- Max parameter count.
0x3984, -- Max data count.
0x00, -- Max setup count.
0x00, -- Reserved.
0x0000, -- Flags (0x0000 = 2-way transaction, don't disconnect TIDs).
0x00001388, -- Timeout (0x00000000 = return immediately).
0x0000, -- Reserved.
parameter_size, -- Parameter bytes.
parameter_offset, -- Parameter offset.
data_size, -- Data bytes.
data_offset, -- Data offset.
0x01, -- Setup Count
0x00, -- Reserved
sub_command -- Sub command
)
local data = "\0\0\0" .. (function_parameters or '')
.. (function_data or '')
-- Send the transaction request
stdnse.debug2("SMB: Sending SMB_COM_TRANSACTION2")
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
return false, err
end
end
return true
end
function receive_transaction2(smbstate)
-- Read the result
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
return false, header
end
end
-- 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)
if(header1 == nil or mid == nil) then
return false, "SMB: ERROR: Server returned less data than it was supposed to (one or more fields are missing); aborting [29]"
end
if(status ~= 0) then
if(smb.status_names[status] == nil) then
return false, string.format("Unknown SMB error: 0x%08x\n", status)
else
return false, smb.status_names[status]
end
end
-- Parse the parameters
local pos, total_word_count, total_data_count, reserved1, parameter_count, parameter_offset, parameter_displacement, data_count, data_offset, data_displacement, setup_count, reserved2 = bin.unpack("<SSSSSSSSSCC", parameters)
if(total_word_count == nil or reserved2 == nil) then
return false, "SMB: ERROR: Server returned less data than it was supposed to (one or more fields are missing); aborting [30]"
end
-- Convert the parameter/data offsets into something more useful (the offset into the data section)
-- - 0x20 for the header, - 0x01 for the length.
parameter_offset = parameter_offset - 0x20 - 0x01 - #parameters - 0x02;
-- - 0x20 for the header, - 0x01 for parameter length, the parameter length, and - 0x02 for the data length.
data_offset = data_offset - 0x20 - 0x01 - #parameters - 0x02;
-- I'm not sure I entirely understand why the '+1' is here, but I think it has to do with the string starting at '1' and not '0'.
local function_parameters = string.sub(data, parameter_offset + 1, parameter_offset + parameter_count)
local function_data = string.sub(data, data_offset + 1, data_offset + data_count)
local response = {}
response['parameters'] = function_parameters
response['data'] = function_data
return true, response
end
+14 -5
View File
@@ -1,6 +1,15 @@
<?php
header("Content-Disposition: attachment; filename=".str_replace(":", "_", $_GET["v"]).".rdp");
header("Content-Type: application/rdp");
print "full address:s:${_GET[v]}\n";
exit();
?>
$host = filter_input(INPUT_GET, 'v', FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) ?: filter_input(INPUT_GET, 'v', FILTER_VALIDATE_IP);
if (!$host) {
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";
-222
View File
@@ -1,222 +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: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><xsl:value-of select="@site"/> - lanScan</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;
}
.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;
}
</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="group"/>
</div>
<script>
$('.ui.dropdown').dropdown()
</script>
</body>
</html>
</xsl:template>
<xsl:template match="group">
<h1 class="ui header"><xsl:value-of select="@name"/></h1>
<div class="ui doubling stackable five 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/state/@state='open'">green</xsl:when>
<xsl:when test="$scannedPort/state/@state='filtered'">yellow</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:variable>
<xsl:choose>
<xsl:when test="$scannedPort/script[@id='smb-shares-size']/table">
<div class="ui {$state} dropdown mini button share-size" title="{$title}">
<xsl:attribute name="style">
<xsl:for-each select="$scannedPort/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:value-of select="$serviceName"/>
<i class="dropdown icon"></i>
<div class="menu">
<xsl:apply-templates select="$scannedPort/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='rdp'">
<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/script[@id='http-info']">
<xsl:variable name="status">
<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/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a class="ui {$status} mini button" href="{$scannedPort/service/@name}://{$scannedHostAddress}:{$scannedPort/@portid}" target="_blank"
title="{$scannedPort/script[@id='http-info']/elem[@key='title' or @key='status-line']}">
<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>
+37
View File
@@ -0,0 +1,37 @@
<?php
include_once 'config.php';
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
if ($lan) {
$cmd = "$lanScanCmd $lan";
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
$filename = str_replace("/", "!", $lan);
$path = "$SCANSDIR/$filename.xml";
if (!file_exists($path)) $cmd .= " | tee '$path'";
header('Content-type: text/xml');
system("$cmd", $retcode);
exit();
}
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
if ($host) {
$cmd = "$hostScanCmd $host";
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
$filename = str_replace("/", "!", $host);
$path = "$SCANSDIR/$filename.xml";
if (!file_exists($path)) $cmd .= " | tee '$path'";
header('Content-type: text/xml');
system("$cmd", $retcode);
exit();
}
include "index.php";
-15
View File
@@ -1,15 +0,0 @@
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Usage: ./scan <config>" >&2
exit 1
fi
pushd "$(dirname -- "$0")" > /dev/null
site="$(basename ${1/.yml/})"
php "to_XML.php" "configs/$site.yml" > "site/$site.xml" \
&& eval $(xsltproc "nmap_cmd.xsl" "site/$site.xml") \
&& mv "scans/$site.xml.tmp" "scans/$site.xml"
popd > /dev/null
-15
View File
@@ -1,15 +0,0 @@
#!/usr/bin/env bash
pushd "$(dirname -- $0)" > /dev/null
mkdir -p scans
mkdir -p site
for config in configs/*.yml
do
site="$(basename ${config/.yml/})"
echo "Scan $site"
./scan.sh "$site"
done
popd > /dev/null
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE nmaprun>
<?xml-stylesheet href="https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl" type="text/xsl"?>
<!-- Nmap 7.93 scan initiated Tue Feb 4 03:30:34 2025 as: nmap -PSmicrosoft-ds -F -T5 -oX - -&#45;stylesheet https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl scanme.nmap.org -->
<nmaprun scanner="nmap" args="nmap -PSmicrosoft-ds -F -T5 -oX - -&#45;stylesheet https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl scanme.nmap.org" start="1738636234" startstr="Tue Feb 4 03:30:34 2025" version="7.93" xmloutputversion="1.05">
<scaninfo type="syn" protocol="tcp" numservices="100" services="7,9,13,21-23,25-26,37,53,79-81,88,106,110-111,113,119,135,139,143-144,179,199,389,427,443-445,465,513-515,543-544,548,554,587,631,646,873,990,993,995,1025-1029,1110,1433,1720,1723,1755,1900,2000-2001,2049,2121,2717,3000,3128,3306,3389,3986,4899,5000,5009,5051,5060,5101,5190,5357,5432,5631,5666,5800,5900,6000-6001,6646,7070,8000,8008-8009,8080-8081,8443,8888,9100,9999-10000,32768,49152-49157"/>
<verbose level="0"/>
<debugging level="0"/>
<hosthint><status state="up" reason="unknown-response" reason_ttl="0"/>
<address addr="45.33.32.156" addrtype="ipv4"/>
<hostnames>
<hostname name="scanme.nmap.org" type="user"/>
</hostnames>
</hosthint>
<host starttime="1738636234" endtime="1738636234"><status state="up" reason="reset" reason_ttl="48"/>
<address addr="45.33.32.156" addrtype="ipv4"/>
<hostnames>
<hostname name="scanme.nmap.org" type="user"/>
<hostname name="scanme.nmap.org" type="PTR"/>
</hostnames>
<ports><extraports state="closed" count="98">
<extrareasons reason="reset" count="98" proto="tcp" ports="7,9,13,21,23,25-26,37,53,79,81,88,106,110-111,113,119,135,139,143-144,179,199,389,427,443-445,465,513-515,543-544,548,554,587,631,646,873,990,993,995,1025-1029,1110,1433,1720,1723,1755,1900,2000-2001,2049,2121,2717,3000,3128,3306,3389,3986,4899,5000,5009,5051,5060,5101,5190,5357,5432,5631,5666,5800,5900,6000-6001,6646,7070,8000,8008-8009,8080-8081,8443,8888,9100,9999-10000,32768,49152-49157"/>
</extraports>
<port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="48"/><service name="ssh" method="table" conf="3"/></port>
<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="48"/><service name="http" method="table" conf="3"/></port>
</ports>
<times srtt="153298" rttvar="2254" to="162314"/>
</host>
<runstats><finished time="1738636234" timestr="Tue Feb 4 03:30:34 2025" summary="Nmap done at Tue Feb 4 03:30:34 2025; 1 IP address (1 host up) scanned in 1.05 seconds" elapsed="1.05" exit="success"/><hosts up="1" down="0" total="1"/>
</runstats>
</nmaprun>
+76
View File
@@ -0,0 +1,76 @@
body {
background-color: #1b1c1d;
}
.logo {
display: flex !important;
justify-content: center;
align-items: center;
width: fit-content;
}
.logo svg {
width: 2.5em;
height: 2.5em;
fill: currentColor;
margin: -0.4em !important;
}
.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;
font-size: .64285714rem !important;
}
.ui.card .table {
overflow-x: auto;
}
+41
View File
@@ -0,0 +1,41 @@
<?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="nmaprun" mode="head">
<xsl:param name="base" />
<xsl:param name="targets" />
<head>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="300" />
<title>lanScan - <xsl:value-of select="$targets" />
</title>
<base href="{$base}" />
<link rel="icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.datatables.net/v/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 rel="stylesheet" type="text/css" href="style.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>
+337
View File
@@ -0,0 +1,337 @@
<?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="head.xsl" />
<xsl:import href="nav.xsl" />
<xsl:import href="services.xsl" />
<xsl:import href="toast.xsl" />
<xsl:output method="html" encoding="UTF-8" />
<xsl:output indent="yes" />
<xsl:strip-space elements='*' />
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '&quot;')" />
<xsl:variable name="base" select="concat($stylesheetURL, '/../../')" />
<xsl:template match="nmaprun">
<xsl:variable name="targets" select="substring-after(@args, '.xsl ')" />
<xsl:variable name="current" select="." />
<xsl:variable name="init" select="document(concat($base, 'scans/', translate($targets,'/', '!'), '.xml'))/nmaprun" />
<html lang="fr">
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="base" select="$base" />
<xsl:with-param name="targets" select="$targets" />
</xsl:apply-templates>
<body>
<xsl:apply-templates select="." mode="nav">
</xsl:apply-templates>
<main class="ui main container inverted segment">
<xsl:apply-templates select="$current/host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
<xsl:with-param name="init" select="$init" />
<xsl:with-param name="current" select="$current" />
</xsl:apply-templates>
</main>
<script>
$('.ui.tree.accordion').accordion()
$('.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:param name="init" />
<xsl:param name="current" />
<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>
<xsl:attribute name="class">
<xsl:text>ui inverted header </xsl:text>
<xsl:choose>
<xsl:when test="$currentHost/status/@state='up'">green</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<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>
</h1>
<table class="ui inverted table" style="width: max-content">
<thead>
<tr>
<xsl:if test="address[@addrtype='ipv4']/@addr">
<th>Adresse IPv4</th>
</xsl:if>
<xsl:if test="address[@addrtype='mac']/@addr">
<th>Adresse MAC</th>
</xsl:if>
<xsl:if test="address/@vendor">
<th>Constructeur</th>
</xsl:if>
<xsl:if test="os/osmatch/@name">
<th>OS</th>
</xsl:if>
<xsl:if test="distance/@value">
<th>Distance</th>
</xsl:if>
<xsl:if test="uptime/@lastboot">
<th>Dernier redémarrage</th>
</xsl:if>
</tr>
</thead>
<tbody>
<tr>
<xsl:if test="address[@addrtype='ipv4']/@addr">
<td>
<xsl:value-of select="address[@addrtype='ipv4']/@addr" />
</td>
</xsl:if>
<xsl:if test="address[@addrtype='mac']/@addr">
<td>
<xsl:value-of select="address[@addrtype='mac']/@addr" />
</td>
</xsl:if>
<xsl:if test="address/@vendor">
<td>
<xsl:value-of select="address/@vendor" />
</td>
</xsl:if>
<xsl:if test="os/osmatch/@name">
<td>
<xsl:value-of select="os/osmatch/@name" />
</td>
</xsl:if>
<xsl:if test="distance/@value">
<td>
<xsl:value-of select="distance/@value" />
<xsl:text> rebonds</xsl:text>
</td>
</xsl:if>
<xsl:if test="uptime/@lastboot">
<td>
<xsl:value-of select="uptime/@lastboot" />
</td>
</xsl:if>
</tr>
</tbody>
</table>
<div class="ui inverted tree accordion">
<div class="title">
<i class="dropdown icon"></i>
Informations supplémentaires
</div>
<div class="content">
<xsl:apply-templates select="hostscript/script" />
</div>
</div>
<h2 class="ui header">Services</h2>
<div class="ui cards">
<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:apply-templates>
</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="color">
<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:variable>
<div class="ui inverted card {$color}">
<div class="content">
<div class="header">
<div class="ui {$color} ribbon label" style="text-transform: uppercase">
<xsl:value-of select="@protocol" />
<xsl:text>:</xsl:text>
<xsl:value-of select="@portid" />
</div>
<xsl:value-of select="service/@name" />
<xsl:if test="service/@tunnel">
<span>
<xsl:text>/</xsl:text>
<xsl:value-of select="service/@tunnel" />
</span>
</xsl:if>
</div>
<div class="meta">
<xsl:if test="service/@product">
<span>
<xsl:value-of select="service/@product" />
</span>
</xsl:if>
<xsl:if test="service/@version">
<span>
<xsl:text>v</xsl:text>
<xsl:value-of select="service/@version" />
</span>
</xsl:if>
<xsl:if test="service/@extrainfo">
<span>
<xsl:value-of select="service/@extrainfo" />
</span>
</xsl:if>
<div class="description">
<xsl:if test="script">
<div class="ui inverted tree accordion">
<div class="title">
<i class="dropdown icon"></i>
Détails
</div>
<div class="content">
<xsl:apply-templates select="script" />
</div>
</div>
</xsl:if>
</div>
</div>
</div>
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https' or service/@name='ms-wbt-server'">
<a class="ui {$color} button">
<xsl:attribute name="href" target="_blank">
<xsl:choose>
<xsl:when test="service/@name='ms-wbt-server'">
<xsl:text>rdp.php?v=</xsl:text>
<xsl:value-of select="$hostAddress" />
<xsl:text>&amp;p=</xsl:text>
<xsl:value-of select="@portid" />
</xsl:when>
<xsl:otherwise>
<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:otherwise>
</xsl:choose>
</xsl:attribute>
<i class="external alternate icon"></i>
Ouvrir
</a>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="script">
<div class="ui inverted accordion">
<div class="title">
<i class="dropdown icon"></i>
<xsl:value-of select="@id" />
</div>
<div class="content">
<xsl:choose>
<xsl:when test="elem or table">
<xsl:if test="elem">
<table class="ui small inverted fixed definition table">
<tbody>
<xsl:apply-templates select="elem" />
</tbody>
</table>
</xsl:if>
<xsl:apply-templates select="table" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@output" />
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</xsl:template>
<xsl:template match="table">
<xsl:choose>
<xsl:when test="@key">
<div class="ui inverted accordion">
<div class="title">
<i class="dropdown icon"></i>
<xsl:value-of select="@key" />
</div>
<div class="content">
<xsl:if test="elem">
<table class="ui small inverted fixed definition table">
<tbody>
<xsl:apply-templates select="elem" />
</tbody>
</table>
</xsl:if>
<xsl:apply-templates select="table" />
</div>
</div>
</xsl:when>
<xsl:when test="elem">
<table class="ui small inverted fixed definition table">
<tbody>
<xsl:apply-templates select="elem" />
</tbody>
</table>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="elem">
<tr>
<td>
<xsl:value-of select="@key" />
</td>
<td>
<xsl:value-of select="." />
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
+167
View File
@@ -0,0 +1,167 @@
<?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="head.xsl" />
<xsl:import href="nav.xsl" />
<xsl:import href="services.xsl" />
<xsl:import href="toast.xsl" />
<xsl:output method="html" encoding="UTF-8" />
<xsl:output indent="yes" />
<xsl:strip-space elements='*' />
<xsl:variable name="stylesheetURL"
select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '&quot;')" />
<xsl:variable name="base" select="concat($stylesheetURL, '/../../')" />
<xsl:template match="nmaprun">
<xsl:variable name="targets" select="substring-after(@args, '.xsl ')" />
<xsl:variable
name="current" select="." />
<xsl:variable name="init"
select="document(concat($base, 'scans/', translate($targets,'/', '!'), '.xml'))/nmaprun" />
<html
lang="fr">
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="base" select="$base" />
<xsl:with-param name="targets" select="$targets" />
</xsl:apply-templates>
<body>
<xsl:apply-templates select="." mode="nav">
</xsl:apply-templates>
<main class="ui main container inverted segment">
<h1>
<xsl:value-of select="$targets" />
</h1>
<table id="scanResultsTable" style="width:100%" role="grid"
class="ui sortable small stuck striped table">
<thead>
<tr>
<th style="width: min-width">Etat</th>
<th>Adresse IP</th>
<th>Nom</th>
<th>Constructeur</th>
<th class="six wide">Services</th>
<th style="width: min-width"></th>
</tr>
</thead>
<tbody>
<xsl:apply-templates
select="$current/host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
<xsl:with-param name="init" select="$init" />
<xsl:with-param name="current" select="$current" />
</xsl:apply-templates>
</tbody>
</table>
</main>
<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:param name="init" />
<xsl:param name="current" />
<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>
<b>
<xsl:value-of select="substring-before(hostnames/hostname/@name, '.')" />
</b>
<xsl:if test="substring-after(hostnames/hostname/@name, '.')">
<wbr />.<xsl:value-of select="substring-after(hostnames/hostname/@name, '.')" />
</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 mini label'" />
<xsl:sort select="number(@portid)" order="ascending" />
</xsl:apply-templates>
</td>
<td>
<a class="ui mini icon teal icon button" target="_blank">
<xsl:attribute name="href">scan.php?host=<xsl:value-of select="$hostAddress" /></xsl:attribute>
<i class="search plus icon"></i>
</a>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
+61
View File
@@ -0,0 +1,61 @@
<?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="nmaprun" mode="nav">
<nav class="ui inverted secondary menu">
<h3>
<a href="." class="button item logo">lan<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"></defs>
<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"></path>
</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"></path>
</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"></path>
</g>
</g>
<g id="g165">
<g id="g163">
<rect x="87.027" y="41.925999" width="80.040001" height="138.481" id="rect161"></rect>
</g>
</g>
<g id="g171">
<g id="g169">
<rect x="344.93301" y="329.052" width="80.040001" height="138.481" id="rect167"></rect>
</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>
can</a>
</h3>
</nav>
</xsl:template>
</xsl:stylesheet>
+1071
View File
File diff suppressed because it is too large Load Diff
+99
View File
@@ -0,0 +1,99 @@
<?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:if test="$currentPort/script[@id='smb-shares-size']/table">dropdown button share-size</xsl:if>
<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: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="@protocol" />:<xsl:value-of select="@portid"/>
</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
@@ -0,0 +1,44 @@
<?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 ' + new Date("<xsl:value-of select="$init/runstats/finished/@timestr"/>").toLocaleString(),
class : 'info',
showIcon : 'calendar',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
</script>
</xsl:template>
</xsl:stylesheet>
-47
View File
@@ -1,47 +0,0 @@
<?php
$file = $argv[1];
$site = basename($file, ".yml");
$__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();
?>
-38
View File
@@ -1,38 +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:output method="text" encoding="UTF-8" indent="yes" />
<xsl:param name="network"/>
<xsl:template match="nmaprun">
<xsl:text>---
site: Nom du site
group:
- name: Réseau </xsl:text><xsl:value-of select="$network"/><xsl:text>
host:
</xsl:text>
<xsl:apply-templates select="host"/>
<xsl:text>...</xsl:text>
</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>