Compare commits

...

198 Commits
v1 ... master

Author SHA1 Message Date
62276f863f bottom left 2025-02-21 11:37:01 +01:00
894acdf996 msprc 2025-02-19 10:21:19 +01:00
4d4d8f1864 order 2025-02-14 11:28:59 +01:00
234cfbf860 Merge branch 'v4' 2025-02-13 16:00:40 +01:00
46552a75f6 clean URL query 2025-02-13 14:48:22 +01:00
db46df7f8f remove popups :| 2025-02-13 14:30:35 +01:00
5deb888ff0 first popup 2025-02-11 18:32:25 +01:00
7517c9f924 misc options 2025-02-11 18:18:49 +01:00
009b2b3c2f finished firewall options 2025-02-11 18:02:40 +01:00
849c922d89 format 2025-02-11 15:15:02 +01:00
36987428bc state in title 2025-02-10 18:35:32 +01:00
894d7f7d36 stylesheets 2025-02-10 18:07:42 +01:00
175cc9392f small changes 2025-02-10 11:35:09 +01:00
6d94778307 preset 2025-02-08 23:35:29 +01:00
ee532e1329 save theme 2025-02-07 08:35:38 +01:00
b59c617a8d toggle dark thme 2025-02-07 02:15:25 +01:00
cdf7e38604 datable options 2025-02-07 01:42:17 +01:00
e5e94288b7 datatable options 2025-02-07 01:25:58 +01:00
b5606b5ad0 data table export buttons 2025-02-07 00:52:50 +01:00
fa98fd7e58 error 405 2025-02-06 23:00:56 +01:00
d97c6cb7c2 WIP 2025-02-06 18:52:05 +01:00
215422cd61 little fixes 2025-02-06 16:56:46 +01:00
f0485f6abd style 2025-02-06 10:48:34 +01:00
e2239d3894 cant decode uri :( 2025-02-06 00:18:36 +01:00
b03c6a42ae small improvements 2025-02-05 22:57:50 +01:00
4e0a723ef0 rescan named scan 2025-02-05 21:09:14 +01:00
72396e5071 rescan named scan 2025-02-05 18:37:33 +01:00
566a5a4c67 custom scan 2025-02-05 15:31:32 +01:00
55f6be594a traceroute 2025-02-04 22:57:44 +01:00
c2268c4f00 options (WIP) 2025-02-04 18:03:20 +01:00
d0de27c4a2 share size script 2025-02-04 16:44:57 +01:00
6d4c579198 wallpaper 2025-02-04 16:19:25 +01:00
02687a7b2c script-args 2025-02-04 13:36:08 +01:00
ad63f0691b script-args 2025-02-04 13:35:46 +01:00
13f42cad36 undo URL 2025-02-04 10:05:12 +01:00
eeba9d613b fix scan select 2025-02-04 09:08:10 +01:00
dba34f39eb small changes 2025-02-04 03:44:37 +01:00
0e24595170 more infos 2025-02-04 03:29:44 +01:00
efed32d11d url 2025-02-04 03:18:53 +01:00
ae0abc39cf split nav 2025-02-04 03:13:55 +01:00
a981059c73 service link 2025-02-04 03:08:45 +01:00
c2d2a2455d slit head 2025-02-04 02:48:35 +01:00
dd16294e8d host scan 2025-02-04 02:42:17 +01:00
6f0cc6e9bd lan scan 2025-02-03 20:25:46 +01:00
b4016685a0 WIP 2025-02-03 18:22:49 +01:00
f39c328d06 WIP 2025-02-03 10:20:20 +01:00
cbbf09677e WIP 2025-01-31 17:57:55 +01:00
2b1fd671da init v4 2025-01-30 16:20:16 +01:00
b445d08ce1 outch 2025-01-27 18:47:38 +01:00
e2c1c6604e WIP 2025-01-24 17:38:33 +01:00
a593148c38 add --defeat-rst-ratelimit 2024-12-04 16:26:58 +01:00
d45b05941f putain de point virgule 2024-11-26 15:18:01 +01:00
e423273752 save if name only 2024-11-26 15:15:12 +01:00
0c72ceb620 system 2024-11-25 18:02:54 +01:00
dc8fa57c0f fix ' in message 2024-11-25 15:17:12 +01:00
53679e2098 fixed navbar 2024-11-25 11:25:40 +01:00
8cd0ba066f rrr 2024-10-23 19:39:19 +02:00
602c1fc7f3 rename script-arg-file 2024-10-23 19:39:00 +02:00
06eb33187b ignore script-args-file.ini 2024-10-23 19:19:28 +02:00
43d2df7850 script-args-file.ini 2024-10-23 19:18:59 +02:00
9d7f526080 use shortport.http 2024-10-23 19:10:56 +02:00
80dc329353 https 2024-10-23 19:02:13 +02:00
81652e25c9 ignore password 2024-10-23 15:48:28 +02:00
4e14da1860 script-arg-file.ini 2024-10-23 15:46:59 +02:00
8e5f010da0 rename saveAs to name 2024-10-23 15:17:03 +02:00
df4648e12a f*cking css 2024-10-23 14:02:05 +02:00
154d731e55 use service template 2024-10-22 23:24:08 +02:00
2ef0421078 unfixed menu 2024-10-22 17:57:11 +02:00
f2acc56ef7 smb-shares-size template 2024-10-22 17:55:31 +02:00
1d5bb5446d move script arg file 2024-10-22 16:38:01 +02:00
7790369ac1 return to bin.pack 2024-10-22 15:50:19 +02:00
bfb7788df0 rawurlencode on $thisURL 2024-10-22 02:09:59 +02:00
c174b3a142 fix renaming 2024-10-22 01:52:34 +02:00
1a0bb6abf5 clearable 2024-10-22 01:50:37 +02:00
c01cfb631b renaming 2024-10-22 01:26:34 +02:00
f1bb88abec rename compareWith to original 2024-10-22 01:07:08 +02:00
f2af893303 more options 2024-10-22 00:35:00 +02:00
8865da906d hostgroup 2024-10-21 23:56:32 +02:00
f05edd0fc7 RTTDuration 2024-10-21 22:59:52 +02:00
2eda5ca9c9 change options icon 2024-10-21 22:31:28 +02:00
68a98fb5a5 more options 2024-10-21 01:14:22 +02:00
7bddbd3e10 fix nav 2024-10-20 17:58:53 +02:00
0b59c94f52 export nav 2024-10-20 17:35:37 +02:00
bd8e988444 export head 2024-10-20 15:03:45 +02:00
cadcd37408 export toast 2024-10-20 13:49:04 +02:00
d8bc7d99fb update cards 2024-10-20 13:46:35 +02:00
458c04afa1 remove htmlentities 2024-10-20 13:44:55 +02:00
f001e1b61d fix url 2024-10-20 13:41:51 +02:00
db6643b8bb split service label 2024-10-20 12:43:51 +02:00
a7c67292ed --script-args 2024-10-20 12:33:50 +02:00
dfd89a5add remove quotes on value 2024-10-20 12:30:09 +02:00
c6b8005958 split command parsing 2024-10-20 12:22:24 +02:00
705904fbfa update scripts 2024-10-20 02:36:26 +02:00
af6dc0a76b portrule 2024-10-20 02:18:46 +02:00
321935e7a8 align 2024-10-20 02:18:38 +02:00
baef7123b8 option -T 2024-10-20 01:56:33 +02:00
f14062fda5 rename var 2024-10-20 01:32:54 +02:00
b55df2e880 not wide 2024-10-20 00:49:57 +02:00
5882baf8ae script filter 2024-10-20 00:49:52 +02:00
dba9e2e9b7 dont include known port on url 2024-10-20 00:29:41 +02:00
4928b346b3 default 2024-10-18 18:41:15 +02:00
0c736158aa merge index and options 2024-10-18 16:14:52 +02:00
17a628cc11 split domain suffix 2024-10-18 15:20:59 +02:00
b6900bc76a templates 2024-10-18 15:08:49 +02:00
c3ed9f9fc2 reorg 2024-10-18 14:47:02 +02:00
a773e8b8d9 datadir 2024-10-18 12:11:45 +02:00
54116d27d0 scripts 2024-10-18 02:04:55 +02:00
887e024f27 add http title 2024-10-18 01:31:04 +02:00
9f06bd0b66 add personnal scripts 2024-10-18 01:30:05 +02:00
63dbcb407f more options 2024-10-18 00:39:53 +02:00
e7b462c033 style 2024-10-17 20:09:26 +02:00
d39798ea4e title 2024-10-17 16:49:56 +02:00
88280ac41d update stylesheets 2024-10-17 15:56:32 +02:00
8c4dda99b5 add -sU 2024-10-17 14:52:20 +02:00
22de01a01b move nmap scripts to separate git projet nmap-scripts 2024-10-17 11:29:42 +02:00
1832864505 overflow 2024-10-17 09:00:12 +02:00
59d0695d1b no services 2024-10-17 08:45:25 +02:00
4b3634dc67 rename hostsTable 2024-10-17 08:41:50 +02:00
b3b9db4aa7 compact stylesheet 2024-10-17 03:27:22 +02:00
3b90e7f6cc move stylesheets to subfolder 2024-10-17 02:19:21 +02:00
290932a421 rename stylesheet 2024-10-17 00:48:26 +02:00
9683dd2283 fix options with - 2024-10-17 00:45:59 +02:00
df5c7e8497 layout 2024-10-16 23:44:47 +02:00
5e0985e7d6 undo footer 2024-10-16 23:41:46 +02:00
ff18e2352c footer 2024-10-16 23:38:20 +02:00
7aeb817c4c footer 2024-10-16 23:32:25 +02:00
7c4d32c83f cards stylesheet 2024-10-16 23:31:02 +02:00
4ccd659d63 fix no name 2024-10-16 22:13:48 +02:00
c2b40b5c71 fix no name 2024-10-16 22:11:04 +02:00
6fc85431af fix stylesheet value 2024-10-16 22:01:22 +02:00
18775fb8b1 rename host scan to services details 2024-10-16 21:50:44 +02:00
9f2826d522 inclure lanScan options in presets 2024-10-16 21:41:57 +02:00
653bb604f5 args name with "-" 2024-10-16 21:25:02 +02:00
6c33080785 presets 2024-10-16 20:55:43 +02:00
a1aeefee47 rename $inputs to $args 2024-10-16 20:15:54 +02:00
5e76b92b96 targets no longer required 2024-10-16 20:08:49 +02:00
ec917b4602 sudo in web options 2024-10-16 19:01:44 +02:00
260c8f073a config
Signed-off-by: Adrien MALINGREY <adrien@malingrey.fr>
2024-10-16 11:52:42 +02:00
570e8f2252 use sudo at will 2024-10-16 11:04:12 +02:00
cd6f64679b include error message 2024-10-16 10:43:11 +02:00
6422830783 more options 2024-10-15 23:19:22 +02:00
7ef62104f0 don't spin all form 2024-10-15 22:34:36 +02:00
386d0fc65d use sudo on need 2024-10-15 16:24:07 +02:00
9a525b6ffe install sudo 2024-10-15 08:35:50 +02:00
6a3589b988 README 2024-10-15 08:34:00 +02:00
2c771c0766 split some options 2024-10-15 08:29:01 +02:00
1befb0017c more options 2024-10-15 02:55:42 +02:00
95d509e1b1 merge right menu items 2024-10-15 01:38:58 +02:00
f8f1183fe7 refreshPeriod input 2024-10-14 23:37:57 +02:00
9cb008785c host options 2024-10-14 21:21:08 +02:00
2337fe1e60 little fixes 2024-10-14 15:40:50 +02:00
1f2ab88641 fix sudo 2024-10-14 14:43:55 +02:00
641f214899 basedir o logo 2024-10-14 12:48:32 +02:00
89a7613f9e encode url 2024-10-14 05:00:51 +02:00
fdf15e5a7d datatable import 2024-10-14 04:54:49 +02:00
47c0bbdb4c mac vendor 2024-10-14 04:41:18 +02:00
db216baf46 reorder options 2024-10-14 04:12:56 +02:00
cf5dcf24a7 small fixes 2024-10-14 03:36:07 +02:00
2f7eebdaf1 host scan stylesheet 2024-10-14 02:50:36 +02:00
ad79495608 saveAs and compareWith as URL 2024-10-14 00:49:19 +02:00
76e1832c28 use other stylesheets 2024-10-13 18:07:32 +02:00
f7629028f6 footer 2024-10-13 15:36:46 +02:00
f5a0cffc05 temp file 2024-10-13 15:04:58 +02:00
bcf6ddff0d default values 2024-10-13 14:20:20 +02:00
df6f5154e2 refresh to scan.php 2024-10-13 14:16:52 +02:00
efff220fe3 pass inputs with recursive template 2024-10-13 07:29:16 +02:00
cb0a4d94a5 dont serve stdout if ok 2024-10-13 07:29:00 +02:00
48113dc7cc fix names 2024-10-13 07:28:11 +02:00
b197af448a quote in name, params on index link 2024-10-13 04:37:49 +02:00
97a4c5801b lot of stuff 2024-10-12 19:10:50 +02:00
8a9b822cf6 fix 2024-10-10 18:08:42 +02:00
f413212db9 fix scan args 2024-10-10 18:07:44 +02:00
01f8ee3ea0 circular label on status 2024-10-10 09:03:27 +02:00
664bee1249 options 2024-10-10 02:10:06 +02:00
bcb63b3d0f remove - 2024-10-10 02:07:00 +02:00
3c9978569b toast 2024-10-10 02:05:32 +02:00
eae12a8e4e get query 2024-10-09 03:08:41 +02:00
ce4f8dda1a get default args 2024-10-09 03:08:20 +02:00
b3cffaed35 default args 2024-10-09 03:07:56 +02:00
a6ba7c4b23 oops 2024-10-09 01:46:44 +02:00
865a8efb62 filter inputs 2024-10-09 01:36:51 +02:00
3a594acb48 index list 2024-10-08 18:30:24 +02:00
b4f75a5984 more fields 2024-10-08 18:08:39 +02:00
4e9dd60477 input with checkbox 2024-10-08 12:21:55 +02:00
20e6b22d0d tag validation 2024-10-08 11:14:31 +02:00
3dd9e39f5c tag input 2024-10-08 05:26:09 +02:00
7062b94aaa scan options draft 2024-10-08 05:13:40 +02:00
d5dd51921c new scan menu 2024-10-07 20:42:16 +02:00
b02c89973c filename 2024-10-07 20:34:38 +02:00
0d56163339 filter input 2024-10-07 20:33:03 +02:00
6319d411c5 remove basedir 2024-10-07 16:28:29 +02:00
6dd728ce0d save only first scan 2024-10-07 12:09:12 +02:00
1d8457d020 faivonc 2024-10-07 10:27:34 +02:00
85fab8e41b variable rename 2024-10-07 03:38:29 +02:00
bef547fae0 true example 2024-10-07 03:38:10 +02:00
42e16d3ef8 index 2024-10-07 02:48:34 +02:00
f44e1d8267 second draft 2024-10-07 01:16:44 +02:00
34a4058ba4 first draft 2024-10-04 18:04:25 +02:00
29 changed files with 3229 additions and 29 deletions

30
.gitignore vendored
View File

@ -1,27 +1,3 @@
# ---> CakePHP
# CakePHP 3
/vendor/*
/config/app.php
/tmp/cache/models/*
!/tmp/cache/models/empty
/tmp/cache/persistent/*
!/tmp/cache/persistent/empty
/tmp/cache/views/*
!/tmp/cache/views/empty
/tmp/sessions/*
!/tmp/sessions/empty
/tmp/tests/*
!/tmp/tests/empty
/logs/*
!/logs/empty
# CakePHP 2
/app/tmp/*
/app/Config/core.php
/app/Config/database.php
/vendors/*
scans/
script-args.ini
test.php

View File

@ -1,3 +1,19 @@
# LanScan
# nmap-webui
A simple web interface for Nmap for network discovery and monitoring
Web UI for nmap
## Dependencies
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`.
```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
```

BIN
bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 KiB

BIN
bg2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
bg3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

28
config.php Normal file
View File

@ -0,0 +1,28 @@
<?php
$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";
$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";
$DATADIR = ".";
$SCRIPTARGSFILE = "script-args.ini";
$COMMONOPTIONS = [
"--datadir" => $DATADIR,
"--script-args-file" => $SCRIPTARGSFILE,
];
$PRESETS = [
"lanScan" => [
"-PS" => "microsoft-ds",
"-F" => true,
"-T" => 4,
"--script" => "http-info,smb-shares-size",
"--stylesheet" => "lanTable.xsl",
],
"host" => [
"-A" => true,
"-T" => 5,
"--script" => "http-info,smb-shares-size",
"--stylesheet" => "hostDetails.xsl",
],
];

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

145
index.php Normal file
View File

@ -0,0 +1,145 @@
<?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 {
background-image: url(bg.jpg);
background-size: cover;
}
body>.grid {
height: 100%;
}
h2.logo {
filter: drop-shadow(0 0 2px);
}
.ui.inverted.segment {
background: #1b1c1dc0;
backdrop-filter: blur(7px);
}
</style>
</head>
<body class="inverted">
<div class="ui middle aligned center aligned inverted grid">
<div class="column" style="max-width: 450px;">
<h2 class="ui inverted teal fluid image header logo">
lan<?php include 'logo.svg'; ?>can
</h2>
<?php if (isset($errorMessage)) { ?>
<div class="ui negative message">
<i class="close icon"></i>
<div class="header">Erreur</div>
<p><?= $errorMessage ?></p>
</div>
<?php } ?>
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
<div class="ui left aligned raised segment inverted">
<h2 class="ui header">Découvrir ou superviser un réseau</h2>
<div class="inverted field">
<div class="ui large input">
<input id="nameInput" type="text" name="target" placeholder="<?= $_SERVER['REMOTE_ADDR']; ?>/24"
list="targetList" pattern="[a-zA-Z0-9._\/ \-]+" required 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>
<input type="hidden" name="preset" value="lanScan" />
<div class="field">
<label for="nameInput">Enregistrer sous le nom (optionnel)</label>
<div class="ui small input">
<input id="nameInput" type="text" name="name" placeholder="Reseau local" pattern='[0-9a-zA-Z\-_\. ]+'
title="Caractères autorisés: a-z A-Z 0-9 - _ ." />
</div>
</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 class="ui divider"></div>
<a href="options.php">Options avancées</a>
</div>
</form>
<?php if (file_exists($SCANSDIR)) { ?>
<div class="ui left aligned raised segment inverted">
<div class="ui inverted accordion">
<div class="title"><i class="dropdown icon"></i></i>Scans enregistrés</div>
<div class="content">
<table class="ui very basic inverted compact table">
<tbody>
<?php
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) == '.xml') {
$name = str_replace('!', '/', substr_replace($filename, '', -4));
echo "<tr><td class='selectable'><a href='$SCANSDIR/" . rawurlencode($filename) . "'><i class='tasks icon'></i>$name</a></td><td class='collapsing'><a href='rescan.php?name=$name' class='ui mini labelled button' onclick='rescan(this)'><i class='sync icon'></i>Rescanner</a></td><td class='collapsing'><a href='rm.php?name=$name' class='ui mini negative icon button'><i class='trash icon'></i></a></td></td></tr>\n";
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<datalist id='targetList'>
<option value="<?= $_SERVER['REMOTE_ADDR']; ?>/24"></option>
<option value="<?= $_SERVER['SERVER_NAME']; ?>"></option>
</datalist>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
<script>
$('.ui.accordion').accordion()
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()
}
}
function rescan(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>
</body>
</html

115
index.php.bak Normal file
View File

@ -0,0 +1,115 @@
<?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 {
background-image: url(bg.jpg);
background-size: cover;
}
body>.grid {
height: 100%;
}
.logo {
margin-right: 0 !important;
}
</style>
</head>
<body class="inverted">
<div class="ui middle aligned center aligned inverted grid">
<div class="column" style="max-width: 450px;">
<h2 class="ui inverted teal fluid image header logo">
lan<?php include 'logo.svg'; ?>can
</h2>
<?php if (isset($errorMessage)) { ?>
<div class="ui negative message">
<i class="close icon"></i>
<div class="header">Erreur</div>
<p><?= $errorMessage ?></p>
</div>
<?php } ?>
<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 (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>
<a href="options.php">Options avancées</a>
</form>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/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

145
index2.php Normal file
View File

@ -0,0 +1,145 @@
<?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 {
background-image: url(bg.jpg);
background-size: cover;
}
body>.grid {
height: 100%;
}
h2.logo {
filter: drop-shadow(0 0 2px);
}
.ui.inverted.segment {
background: #1b1c1dc0;
backdrop-filter: blur(7px);
}
</style>
</head>
<body class="inverted">
<div class="ui middle aligned center aligned inverted grid">
<div class="column" style="max-width: 450px;">
<h2 class="ui inverted teal fluid image header logo">
lan<?php include 'logo.svg'; ?>can
</h2>
<?php if (isset($errorMessage)) { ?>
<div class="ui negative message">
<i class="close icon"></i>
<div class="header">Erreur</div>
<p><?= $errorMessage ?></p>
</div>
<?php } ?>
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
<div class="ui left aligned raised segment inverted">
<h2 class="ui header">Découvrir ou superviser un réseau</h2>
<div class="inverted field">
<div class="ui large input">
<input id="nameInput" type="text" name="target" placeholder="<?= $_SERVER['REMOTE_ADDR']; ?>/24"
list="targetList" pattern="[a-zA-Z0-9._\/ \-]+" required 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>
<input type="hidden" name="preset" value="lanScan" />
<div class="field">
<label for="nameInput">Enregistrer sous le nom (optionnel)</label>
<div class="ui small input">
<input id="nameInput" type="text" name="name" placeholder="Reseau local" pattern='[0-9a-zA-Z\-_\. ]+'
title="Caractères autorisés: a-z A-Z 0-9 - _ ." />
</div>
</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 class="ui divider"></div>
<a href="options.php">Options avancées</a>
</div>
</form>
<?php if (file_exists($SCANSDIR)) { ?>
<div class="ui left aligned raised segment inverted">
<div class="ui inverted accordion">
<div class="title"><i class="dropdown icon"></i></i>Scans enregistrés</div>
<div class="content">
<table class="ui very basic inverted compact table">
<tbody>
<?php
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) == '.xml') {
$name = str_replace('!', '/', substr_replace($filename, '', -4));
echo "<tr><td class='selectable'><a href='$SCANSDIR/" . rawurlencode($filename) . "'><i class='tasks icon'></i>$name</a></td><td class='collapsing'><a href='rescan.php?name=$name' class='ui mini labelled button' onclick='rescan(this)'><i class='sync icon'></i>Rescanner</a></td><td class='collapsing'><a href='rm.php?name=$name' class='ui mini negative icon button'><i class='trash icon'></i></a></td></td></tr>\n";
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<datalist id='targetList'>
<option value="<?= $_SERVER['REMOTE_ADDR']; ?>/24"></option>
<option value="<?= $_SERVER['SERVER_NAME']; ?>"></option>
</datalist>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
<script>
$('.ui.accordion').accordion()
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()
}
}
function rescan(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>
</body>
</html

53
logo.svg Executable file
View File

@ -0,0 +1,53 @@
<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" />
<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>

After

Width:  |  Height:  |  Size: 2.0 KiB

147
moi.xml Normal file
View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE nmaprun>
<?xml-stylesheet href="https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl?name=Chez moi&amp;" type="text/xsl"?>
<!-- Nmap 7.93 scan initiated Wed Feb 5 20:27:12 2025 as: nmap -PSmicrosoft-ds -F -T5 -&#45;datadir . -&#45;script http-info,smb-shares-size -&#45;script-args-file script-args.ini -&#45;stylesheet &quot;https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl?name=Chez moi&amp;&quot; -oX - 192.168.1.0/24 -->
<nmaprun scanner="nmap" args="nmap -PSmicrosoft-ds -F -T5 -&#45;datadir . -&#45;script http-info,smb-shares-size -&#45;script-args-file script-args.ini -&#45;stylesheet &quot;https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl?name=Chez moi&amp;&quot; -oX - 192.168.1.0/24" start="1738783632" startstr="Wed Feb 5 20:27:12 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="arp-response" reason_ttl="0"/>
<address addr="192.168.1.20" addrtype="ipv4"/>
<address addr="DA:08:9B:45:7C:FC" addrtype="mac"/>
<hostnames>
</hostnames>
</hosthint>
<hosthint><status state="up" reason="arp-response" reason_ttl="0"/>
<address addr="192.168.1.46" addrtype="ipv4"/>
<address addr="BE:80:98:8E:1D:16" addrtype="mac"/>
<hostnames>
</hostnames>
</hosthint>
<hosthint><status state="up" reason="arp-response" reason_ttl="0"/>
<address addr="192.168.1.69" addrtype="ipv4"/>
<address addr="28:DF:EB:55:22:A6" addrtype="mac" vendor="Intel Corporate"/>
<hostnames>
</hostnames>
</hosthint>
<hosthint><status state="up" reason="arp-response" reason_ttl="0"/>
<address addr="192.168.1.254" addrtype="ipv4"/>
<address addr="20:66:CF:18:E5:A2" addrtype="mac" vendor="Freebox SAS"/>
<hostnames>
</hostnames>
</hosthint>
<hosthint><status state="up" reason="arp-response" reason_ttl="0"/>
<address addr="192.168.1.98" addrtype="ipv4"/>
<address addr="E4:F0:42:AE:34:1E" addrtype="mac" vendor="Google"/>
<hostnames>
</hostnames>
</hosthint>
<host starttime="1738783635" endtime="1738783636"><status state="up" reason="arp-response" reason_ttl="0"/>
<address addr="192.168.1.20" addrtype="ipv4"/>
<address addr="DA:08:9B:45:7C:FC" addrtype="mac"/>
<hostnames>
</hostnames>
<ports><extraports state="closed" count="97">
<extrareasons reason="reset" count="97" proto="tcp" ports="7,9,13,21,23,25-26,37,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="64"/><service name="ssh" method="table" conf="3"/></port>
<port protocol="tcp" portid="53"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="domain" method="table" conf="3"/></port>
<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="http" method="table" conf="3"/><script id="http-info" output="&#xa; status-line: HTTP/1.1 200 OK&#xd;&#xa;&#xa; status: 200&#xa; title: Welcome page"><elem key="status-line">HTTP/1.1 200 OK&#xd;&#xa;</elem>
<elem key="status">200</elem>
<elem key="title">Welcome page</elem>
</script></port>
</ports>
<times srtt="186" rttvar="26" to="50000"/>
</host>
<host starttime="1738783635" endtime="1738783636"><status state="up" reason="arp-response" reason_ttl="0"/>
<address addr="192.168.1.46" addrtype="ipv4"/>
<address addr="BE:80:98:8E:1D:16" addrtype="mac"/>
<hostnames>
</hostnames>
<ports><extraports state="closed" count="100">
<extrareasons reason="reset" count="100" 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>
</ports>
<times srtt="10978" rttvar="8968" to="50000"/>
</host>
<host starttime="1738783635" endtime="1738783635"><status state="up" reason="arp-response" reason_ttl="0"/>
<address addr="192.168.1.69" addrtype="ipv4"/>
<address addr="28:DF:EB:55:22:A6" addrtype="mac" vendor="Intel Corporate"/>
<hostnames>
</hostnames>
<ports><extraports state="closed" count="100">
<extrareasons reason="reset" count="100" 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>
</ports>
<times srtt="4760" rttvar="809" to="50000"/>
</host>
<host starttime="1738783635" endtime="1738783636"><status state="up" reason="arp-response" reason_ttl="0"/>
<address addr="192.168.1.98" addrtype="ipv4"/>
<address addr="E4:F0:42:AE:34:1E" addrtype="mac" vendor="Google"/>
<hostnames>
</hostnames>
<ports><extraports state="closed" count="97">
<extrareasons reason="reset" count="97" 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,8080-8081,8888,9100,9999-10000,32768,49152-49157"/>
</extraports>
<port protocol="tcp" portid="8008"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="http" method="table" conf="3"/><script id="http-info" output="&#xa; status-line: HTTP/1.1 404 Not Found&#xd;&#xa;&#xa; status: 404"><elem key="status-line">HTTP/1.1 404 Not Found&#xd;&#xa;</elem>
<elem key="status">404</elem>
</script></port>
<port protocol="tcp" portid="8009"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="ajp13" method="table" conf="3"/></port>
<port protocol="tcp" portid="8443"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="https-alt" method="table" conf="3"/><script id="http-info" output="&#xa; status-line: HTTP/1.1 404 Not Found&#xd;&#xa;&#xa; status: 404"><elem key="status-line">HTTP/1.1 404 Not Found&#xd;&#xa;</elem>
<elem key="status">404</elem>
</script></port>
</ports>
<times srtt="5186" rttvar="720" to="50000"/>
</host>
<host starttime="1738783635" endtime="1738783636"><status state="up" reason="arp-response" reason_ttl="0"/>
<address addr="192.168.1.254" addrtype="ipv4"/>
<address addr="20:66:CF:18:E5:A2" addrtype="mac" vendor="Freebox SAS"/>
<hostnames>
<hostname name="mafreebox.freebox.fr" type="PTR"/>
</hostnames>
<ports><extraports state="closed" count="93">
<extrareasons reason="reset" count="93" proto="tcp" ports="7,9,13,22-23,25-26,37,79,81,88,106,110-111,113,119,135,139,143-144,179,199,389,427,444,465,513-515,543-544,548,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,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="21"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="ftp" method="table" conf="3"/></port>
<port protocol="tcp" portid="53"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="domain" method="table" conf="3"/></port>
<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="http" method="table" conf="3"/><script id="http-info" output="&#xa; status-line: HTTP/1.1 200 OK&#xd;&#xa;&#xa; status: 200&#xa; title: Freebox OS&#xa; favicon: /favicon.ico"><elem key="status-line">HTTP/1.1 200 OK&#xd;&#xa;</elem>
<elem key="status">200</elem>
<elem key="title">Freebox OS</elem>
<elem key="favicon">/favicon.ico</elem>
</script></port>
<port protocol="tcp" portid="443"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="https" method="table" conf="3"/><script id="http-info" output="&#xa; status-line: HTTP/1.1 200 OK&#xd;&#xa;&#xa; status: 200&#xa; title: Freebox OS&#xa; favicon: /favicon.ico"><elem key="status-line">HTTP/1.1 200 OK&#xd;&#xa;</elem>
<elem key="status">200</elem>
<elem key="title">Freebox OS</elem>
<elem key="favicon">/favicon.ico</elem>
</script></port>
<port protocol="tcp" portid="445"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="microsoft-ds" method="table" conf="3"/></port>
<port protocol="tcp" portid="554"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="rtsp" method="table" conf="3"/></port>
<port protocol="tcp" portid="5357"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="wsdapi" method="table" conf="3"/></port>
</ports>
<times srtt="98" rttvar="15" to="50000"/>
</host>
<host starttime="1738783636" endtime="1738783637"><status state="up" reason="localhost-response" reason_ttl="0"/>
<address addr="192.168.1.100" addrtype="ipv4"/>
<hostnames>
<hostname name="adrien.malingrey.fr" type="PTR"/>
</hostnames>
<ports><extraports state="closed" count="93">
<extrareasons reason="reset" count="93" proto="tcp" ports="7,9,13,21-23,26,37,79,81,88,106,110-111,113,119,135,139,144,179,199,389,427,444-445,465,513-515,543-544,548,554,631,646,873,990,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="25"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="smtp" method="table" conf="3"/></port>
<port protocol="tcp" portid="53"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="domain" method="table" conf="3"/></port>
<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="http" method="table" conf="3"/><script id="http-info" output="&#xa; status-line: HTTP/1.1 301 Moved Permanently&#xd;&#xa;&#xa; status: 301"><elem key="status-line">HTTP/1.1 301 Moved Permanently&#xd;&#xa;</elem>
<elem key="status">301</elem>
</script></port>
<port protocol="tcp" portid="143"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="imap" method="table" conf="3"/></port>
<port protocol="tcp" portid="443"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="https" method="table" conf="3"/><script id="http-info" output="&#xa; status-line: HTTP/1.1 302 Moved Temporarily&#xd;&#xa;&#xa; status: 302"><elem key="status-line">HTTP/1.1 302 Moved Temporarily&#xd;&#xa;</elem>
<elem key="status">302</elem>
</script></port>
<port protocol="tcp" portid="587"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="submission" method="table" conf="3"/></port>
<port protocol="tcp" portid="993"><state state="open" reason="syn-ack" reason_ttl="64"/><service name="imaps" method="table" conf="3"/></port>
</ports>
<times srtt="16" rttvar="3" to="50000"/>
</host>
<runstats><finished time="1738783637" timestr="Wed Feb 5 20:27:17 2025" summary="Nmap done at Wed Feb 5 20:27:17 2025; 256 IP addresses (6 hosts up) scanned in 4.98 seconds" elapsed="4.98" exit="success"/><hosts up="6" down="250" total="256"/>
</runstats>
</nmaprun>

830
options.php Executable file
View File

@ -0,0 +1,830 @@
<?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 class="inverted">
<nav class="ui inverted secondary menu">
<a href="." class="ui header button item logo">lan<?php include 'logo.svg'; ?>can</a>
<div class="right menu">
<div class="item">
<a class="ui icon button item" href="https://nmap.org/man/fr/index.html" target="_blank">
<i class="question circle icon"></i>
</a>
<button id="toggleThemeButton" type="button" class="ui icon link item" title="Thème clair/sombre"
onclick="toggleTheme()">
<i class="sun icon"></i>
</button>
</div>
</div>
</nav>
<main class="ui main text container">
<h1 class="ui inverted header">Scanner un réseau</h1>
<form id="newScanForm" class="ui inverted form" method="get" action="scan.php">
<div class="inverted field">
<label for="targetInput" 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="targetInput" name="target" type="text" placeholder="Cibles" spellcheck="false" required
pattern="[a-zA-Z0-9._\/ \-]+" list="targetList" 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 inverted field">
<div class="title"><i class="icon dropdown"></i>Spécification des cibles</div>
<div class="content">
<div class="inverted field">
<label for="excludeInput" title="--exclude">Exclure les hôtes ou réseaux</label>
<input id="excludeInput" name="--exclude" type="text" placeholder="Hôte/réseau" list="targetList"
pattern="[a-zA-Z0-9._\/,\-]*">
</div>
<div class="inverted field">
<label for="iRInput" title="-iR">Nombre de cibles au hasard</label>
<input id="iRInput" type="number" min="0" name="-iR" placeholder="Nombre">
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Découverte des hôtes actifs</div>
<div class="content">
<div class="inline inverted field">
<div class="ui toggle inverted checkbox">
<input id="PnCheckbox" name="-Pn" type="checkbox" />
<label for="PnCheckbox" title="-Pn">Sauter cette étape (considérer tous les hôtes comme actifs)</label>
</div>
</div>
<div class="inverted field">
<label for="PSInput" title="-PS">TCP SYN</label>
<input id="PSInput" name="-PS" type="text" placeholder="Ports" list="servicesList"
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-" />
</div>
<div class="inverted field">
<label for="PAInput" title="-PA">TCP ACK</label>
<input id="PAInput" name="-PA" type="text" placeholder="Ports" list="servicesList"
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
</div>
<div class="inverted field">
<label for="PUInput" title="-PU">UDP</label>
<input id="PUInput" name="-PU" type="text" placeholder="Ports" list="servicesList"
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*"
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
</div>
<div class="inverted field">
<label>ICMP</label>
<div class="inline inverted fields">
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="PECheckbox" name="-PE" type="checkbox" />
<label for="PECheckbox" title="-PE">Echo request</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="PPCheckbox" name="-PP" type="checkbox" />
<label for="PPCheckbox" title="-PP">Timestamp request</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="PMCheckbox" name="-PM" type="checkbox" />
<label for="PMCheckbox" title="-PM">Mask request</label>
</div>
</div>
</div>
</div>
<div class="inverted field">
<label for="POInput" title="-PO">Protocole IP (par type)</label>
<input id="POInput" name="-PO" type="text" placeholder="Protocole" pattern="[0-9,\-]+"
title="[num de protocole]">
</div>
<div class="inline inverted fields">
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="PRCheckbox" name="-PR" type="checkbox" />
<label for="PRCheckbox" title="-PR">Ping ARP</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sendIPCheckbox" name="--send-ip" type="checkbox" />
<label for="sendIPCheckbox" title="--send-ip">Pas de scan ARP</label>
</div>
</div>
</div>
<div class="inline inverted fields">
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="nCheckbox" name="-n" type="checkbox" />
<label for="nCheckbox" title="-n">Ne jamais résoudre les noms DNS</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="RCheckbox" name="-R" type="checkbox" />
<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="inverted field">
<label for="dnsServersInput" title="--dns-servers">Utiliser les serveurs DNS</label>
<input id="dnsServersInput" name="--dns-servers" type="text" placeholder="serveur"
pattern="[a-zA-Z0-9._,\-]*" title="serv1[,serv2],...">
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Techniques de scan de ports</div>
<div class="content">
<div class="inverted fields">
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sSCheckbox" name="-sS" type="checkbox" />
<label for="sSCheckbox" title="-sS">TCP SYN</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sTCheckbox" name="-sT" type="checkbox" />
<label for="sTCheckbox" title="-sT">TCP Connect()</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sACheckbox" name="-sA" type="checkbox" />
<label for="sACheckbox" title="-sA">TCP ACK</label>
</div>
</div>
</div>
<div class="inverted fields">
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sWCheckbox" name="-sW" type="checkbox" />
<label for="sWCheckbox" title="-sW">Fenêtre TCP</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sMCheckbox" name="-sM" type="checkbox" />
<label for="sMCheckbox" title="-sM">Maimon</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sNCheckbox" name="-sN" type="checkbox" />
<label for="sNCheckbox" title="-sN">TCP Null</label>
</div>
</div>
</div>
<div class="inverted fields">
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sFCheckbox" name="-sF" type="checkbox" />
<label for="sFCheckbox" title="-sF">TCP FIN</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sXCheckbox" name="-sX" type="checkbox" />
<label for="sXCheckbox" title="-sX">Sapin de Noël</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sUCheckbox" name="-sU" type="checkbox" />
<label for="sUCheckbox" title="-sU">UDP</label>
</div>
</div>
</div>
<div class="inverted field">
<label for="scanflagsInput" title="--scanflags">Scan TCP personnalisé</label>
<input id="scanflagsInput" name="--scanflags" type="text" placeholder="Drapeaux TCP" list="flagsList"
pattern="(URG|ACK|PSH|RST|SYN|FIN|,)+|[1-9]?[0-9]|[1-2][0-9][0-9]"
title="Mélanger simplement les drapeaux URG, ACK, PSH, RST, SYN et FIN.">
</div>
<div class="inverted field">
<label for="sIInput" title="-sI">Hôte zombie</label>
<input id="sIInput" name="-p" type="text" placeholder="zombie host[:probeport]"
pattern="[a-zA-Z0-9._\-]+(:[0-9]+)?" title="zombie host[:probeport]">
</div>
<div class="inverted field">
<label for="bInput" title="-b">Rebond FTP</label>
<input id="bInput" name="-p" type="text" placeholder="[<username>[:<password>]@]<server>[:<port>]"
pattern="([a-zA-Z0-9._\-]+(:.+)?@)?[a-zA-Z0-9._\-]+(:[0-9]+)?"
title="[<username>[:<password>]@]<server>[:<port>]">
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sUCheckbox" name="-sU" type="checkbox" />
<label for="sUCheckbox" title="-sO">Scan des protocoles supportés par la couche IP</label>
</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 inverted field">
<div class="ui toggle inverted checkbox" title="-sP">
<input id="sPCheckbox" name="-sP" type="checkbox" />
<label for="sPCheckbox">Sauter cette étape</label>
</div>
</div>
<div class="inline inverted field">
<div class="ui toggle inverted checkbox" title="-F">
<input id="FCheckbox" name="-F" type="checkbox" onchange="pInput.disabled = FCheckbox.checked" />
<label for="FCheckbox">Scanner les ports connus</label>
</div>
</div>
<div class="inverted field">
<label for="pInput" title="-p">Scanner les ports</label>
<input id="pInput" name="-p" type="text" placeholder="Ports" list="servicesList"
pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*"
title="Liste de ports ex: ssh,ftp,U:53,111,137,T:21-25,80,139,8080">
</div>
<div class="inline inverted field">
<div class="ui toggle inverted checkbox" title="-r">
<input id="rCheckbox" name="-r" type="checkbox" />
<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 inverted field">
<div class="ui toggle inverted checkbox" title="-sV">
<input id="sVCheckbox" name="-sV" type="checkbox" />
<label for="sVCheckbox">Détection de version</label>
</div>
</div>
<div class="inline inverted field">
<div class="ui toggle inverted checkbox">
<input id="allportsCheckbox" name="--allports" type="checkbox" />
<label for="allportsCheckbox" title="--allports">N'exclure aucun port de la détection de version</label>
</div>
</div>
<div class="inverted 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" title="2: léger, 9: tous, défaut: 7">
</div>
<div class="inline inverted field">
<div class="ui toggle inverted checkbox">
<input id="sRCheckbox" name="-sR" type="checkbox" />
<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 inverted field">
<div class="ui toggle inverted checkbox">
<input id="sCCheckbox" name="-sC" type="checkbox" />
<label for="sCCheckbox" title="-sC">Scripts par défaut</label>
</div>
</div>
<div class="inverted field">
<label for="scriptInput">Scripts</label>
<input id="scriptInput" name="--script" type="text" placeholder="Nom"
title="<catégories|répertoire|nom|all>" list="scripts" pattern="[a-z][a-z0-9\-\.\/]*">
</div>
<div class="inverted field">
<label for="scriptArgsInput" title="--script-args">Arguments des scripts</label>
<input id="scriptArgsInput" name="--script-args" type="text" placeholder="arg=valeur"
pattern='[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+(,[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+)?' title="<n1=v1,[n2=v2,...]>">
</div>
<div class="inline inverted field">
<div class="ui toggle inverted checkbox">
<input id="scriptTraceCheckbox" name="--script-trace" type="checkbox" />
<label for="scriptTraceCheckbox" title="--script-trace">Montrer toutes les données envoyées ou
recues</label>
</div>
</div>
<div class="inline inverted field">
<div class="ui toggle inverted checkbox">
<input id="scriptUpdateDBCheckbox" name="--script-updatedb" type="checkbox" />
<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 inverted field">
<div class="ui toggle inverted checkbox">
<input id="OCheckbox" name="-O" type="checkbox" />
<label for="OCheckbox" title="-O">Détecter le système d'exploitation</label>
</div>
</div>
<div class="inline inverted field">
<div class="ui toggle inverted checkbox">
<input id="osscanLimitCheckbox" name="--osscan-limit" type="checkbox" />
<label for="osscanLimitCheckbox" title="--osscan-limit">Seulement les cibles prometteuses</label>
</div>
</div>
<div class="inline inverted field">
<div class="ui toggle inverted checkbox">
<input id="osscanGuessCheckbox" name="--osscan-guess" type="checkbox" />
<label for="osscanGuessCheckbox" title="--osscan-guess">Essayer de deviner</label>
</div>
</div>
<div class="inverted 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">
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Temporisation et performances</div>
<div class="content">
<div class="inverted field">
<label for="TSelect" title="-T">Intensité des tests de version</label>
<select id="TSelect" class="ui clearable dropdown" name="-T">
<option value="">Normal</option>
<option value="0">Paranoïaque</option>
<option value="1">Sournois</option>
<option value="2">Poli</option>
<option value="4">Aggressif</option>
<option value="5">Dément</option>
</select>
</div>
<div class="inverted field">
<label>Tailles des groupes d'hôtes à scanner en parallèle</label>
<div class="two inverted fields">
<div class="inverted field">
<label for="minHostgroupInput" title="--min-hostgroup">Minimum</label>
<input id="minHostgroupInput" type="number" min="0" placeholder="Nombre"
oninput="maxHostgroupInput.min = minHostgroupInput.value">
</div>
<div class="inverted field">
<label for="maxHostgroupInput" title="--max-hostgroup">Maximum</label>
<input id="maxHostgroupInput" type="number" min="0" placeholder="Nombre"
oninput="minHostgroupInput.max = maxHostgroupInput.value">
</div>
</div>
</div>
<div class="inverted field">
<label>Parallélisation des paquets de tests</label>
<div class="two inverted fields">
<div class="inverted field">
<label for="minParallelismInput" title="--min-parallelism">Minimum</label>
<input id="minParallelismInput" type="number" min="0" placeholder="Nombre"
oninput="maxParallelismInput.min = minParallelismInput.value">
</div>
<div class="inverted field">
<label for="maxParallelismInput" title="--max-parallelism">Maximum</label>
<input id="maxParallelismInput" type="number" min="0" placeholder="Nombre"
oninput="minParallelismInput.max = maxParallelismInput.value">
</div>
</div>
</div>
<div class="inverted field">
<label>Temps d'aller-retour des paquets de tests</label>
<div class="three inverted fields">
<div class="inverted 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">
<select id="initialRTTUnit" class="ui clearable dropdown label"
oninput="initialRTTHidden.value = initialRTTNumber.value? initialRTTNumber.value+initialRTTUnit.value: ''">
<option value="">ms</option>
<option value="s">secondes</option>
<option value="m">minutes</option>
<option value="h">heures</option>
</select>
</div>
<input id="initialRTTHidden" name="--initial-rtt-timeout" type="hidden">
</div>
<div class="inverted 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">
<select id="minRTTUnit" class="ui clearable dropdown label"
oninput="minRTTHidden.value = minRTTNumber.value? minRTTNumber.value+minRTTUnit.value: ''">
<option value="">ms</option>
<option value="s">secondes</option>
<option value="m">minutes</option>
<option value="h">heures</option>
</select>
</div>
<input id="minRTTHidden" name="--min-rtt-timeout" type="hidden">
</div>
<div class="inverted 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">
<select id="maxRTTUnit" class="ui clearable dropdown label"
oninput="maxRTTHidden.value = maxRTTNumber.value? maxRTTNumber.value+maxRTTUnit.value: ''">
<option value="">ms</option>
<option value="s">secondes</option>
<option value="m">minutes</option>
<option value="h">heures</option>
</select>
</div>
<input id="maxRTTHidden" name="--max-rtt-timeout" type="hidden">
</div>
</div>
</div>
<div class="inverted 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">
</div>
<div class="inverted 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: ''">
<select id="hostTimoutUnit" class="ui clearable dropdown label"
oninput="hostTimoutHidden.value = hostTimoutNumber.value? hostTimoutNumber.value+hostTimoutUnit.value: ''">
<option value="">ms</option>
<option value="s">secondes</option>
<option value="m">minutes</option>
<option value="h">heures</option>
</select>
</div>
<input id="hostTimoutHidden" name="--host-timeout" type="hidden">
</div>
<div class="two inverted fields">
<div class="inverted 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: ''">
<select id="scanDelayUnit" class="ui clearable dropdown label"
oninput="scanDelayHidden.value = scanDelayNumber.value? scanDelayNumber.value+scanDelayUnit.value: ''">
<option value="">ms</option>
<option value="s">secondes</option>
<option value="m">minutes</option>
<option value="h">heures</option>
</select>
</div>
<input id="scanDelayHidden" name="--scan-delay" type="hidden">
</div>
<div class="inverted 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: ''">
<select id="maxRTTUnit" class="ui clearable dropdown label"
oninput="maxRTTHidden.value = maxScanDelay.value? maxScanDelay.value+maxRTTUnit.value: ''">
<option value="">ms</option>
<option value="s">secondes</option>
<option value="m">minutes</option>
<option value="h">heures</option>
</select>
</div>
<input id="maxRTTHidden" name="--max-scan-delay" type="hidden">
</div>
</div>
<div class="inline inverted field">
<div class="ui toggle inverted checkbox">
<input id="defeatRSTRateLimitCheckbox" name="--defeat-rst-ratelimit" type="checkbox" />
<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>Évitement de pare-feux/IDS et mystification</div>
<div class="content">
<div class="inline inverted fields">
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="fInput" name="-f" type="checkbox">
<label for="fInput" title="-f">Fragmentation des paquets</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="badsumInput" name="--badsum" type="checkbox">
<label for="badsumInput" title="--badsum">Sommes de contrôle erronnées</label>
</div>
</div>
</div>
<div class="two inverted fields">
<div class="inverted field">
<label for="mtuInput" title="--mtu">Taille des paquets</label>
<div class="ui right labeled input">
<input id="mtuInput" name="--mtu" type="number" min="0" placeholder="Multiple de 8">
<div class="ui basic label">bits</div>
</div>
</div>
<div class="inverted field">
<label for="dataLengthInput" title="--data-length">Longueur des données</label>
<div class="ui right labeled input">
<input id="dataLengthInput" name="--data-length" type="number" min="0" placeholder="Nombre">
<div class="ui basic label">bits</div>
</div>
</div>
</div>
<div class="inverted field">
<label for="DInput" title="-D">Leurre</label>
<input id="DInput" name="-D" type="text" pattern="[a-zA-Z0-9._,\-]*"
placeholder="decoy1[,decoy2][,ME],..." title="decoy1[,decoy2][,ME],...">
</div>
<div class="two inverted fields">
<div class="inverted field">
<label for="SInput" title="-S">Usurpation d'adresse IP</label>
<input id="SInput" name="-S" type="text" pattern="[0-9.]*" placeholder="Adresse IP">
</div>
<div class="inverted field">
<label for="SInput" title="-S">Usurpation d'adresse MAC</label>
<input id="SInput" name="-S" type="text"
pattern="[0-9a-fA-F]{2}[:\-][0-9a-fA-F]{2}[:\-][0-9a-fA-F]{2}[:\-][0-9a-fA-F]{2}[:\-][0-9a-fA-F]{2}[:\-][0-9a-fA-F]{2}"
title="Adresse MAC, préfix ou nom de constructeur"
placeholder=" Adresse MAC, préfix ou nom de constructeur">
</div>
</div>
<div class="two inverted fields">
<div class="inverted field">
<label for="gInput" title="-g">Port source</label>
<input id="gInput" name="-g" type="number" min="0" max="65535" placeholder="Port">
</div>
<div class="inverted field">
<label for="ttlInput" title="--ttl">Durée de vie (TTL)</label>
<input id="ttlInput" name="--ttl" type="number" min="0" max="255" placeholder="0-255">
</div>
</div>
<div class="inverted field">
<label for="ipOptionsInput" title="--ip-options">Envoyer des paquets avec les options IP suivantes</label>
<input id="ipOptionsInput" name="--ip-options" type="text"
pattern='(R|T|U|L [0-9a-zA-Z\-.: ]+|S [0-9a-zA-Z\-.: ]+|\x[0-9a-fA-F]{1,2}(\*[0-9]+)?|\[0-2]?[0-9]{1,2}(\*[0-9]+)?)'
placeholder="S|R [route]|L [route]|T|U ... >;" title="S|R [route]|L [route]|T|U ... >;">
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="randomizeHostsInput" name="--randomize-hosts" type="checkbox">
<label for="randomizeHostsInput" title="--randomize-hosts">Scanner les cibles dans un ordre
aléatoire</label>
</div>
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Options diverses</div>
<div class="content">
<div class="field">
<label for="stylesheetSelect" title="--stylesheet">Affichage des résultats</label>
<select id="stylesheetSelect" class="ui dropdown" name="--stylesheet" required>
<option value='lanTable.xsl' selected>Tableau du réseau</option>
<option value='hostDetails.xsl'>Détails de l'hôte</option>
</select>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="AInput" name="-A" type="checkbox">
<label for="AInput" title="-A">Scan agressif</label>
</div>
</div>
<div class="two inverted fields">
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sendEthInput" name="--send-eth" type="checkbox">
<label for="sendEthInput" title="--send-eth">Envoie des paquets en utilisant des trames Ethernet
brutes</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="sendIPInput" name="--send-ip" type="checkbox">
<label for="sendIPInput" title="--send-ip">Envoie des paquets en utilisant des paquets IP
bruts</label>
</div>
</div>
</div>
<div class="two inverted fields">
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="privilegedInput" name="--privileged" type="checkbox">
<label for="privilegedInput" title="--privileged">Mode privilégié</label>
</div>
</div>
<div class="inverted field">
<div class="ui toggle inverted checkbox">
<input id="unprivilegedInput" name="--unprivileged" type="checkbox">
<label for="unprivilegedInput" title="--unprivileged">Mode non privilégié</label>
</div>
</div>
</div>
</div>
</div>
<div class="field">
<label for="nameInput">Enregistrer sous le nom (optionnel)</label>
<div class="ui small input">
<input id="nameInput" name="name" type="text" placeholder="Reseau local" pattern='[0-9a-zA-Z\-_\. ]+'
title="Caractères autorisés: a-z A-Z 0-9 - _ ." />
</div>
</div>
<button type="submit" class="ui teal submit button">Démarrer</button>
</form>
</main>
<datalist id='targetList'>
<option value="<?= $_SERVER['REMOTE_ADDR']; ?>/24"></option>
<option value="<?= $_SERVER['SERVER_NAME']; ?>"></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";
}
}
}
?>
</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 src="script.js"></script>
<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(targetInput, {}, " ")
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: ','
})
new TagsInput(DInput)
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',
})
for (input of document.querySelectorAll("input[name]")) {
if (!input.value || (input.type == "checkbox" && !input.checked)) {
input.name = ""
}
}
return true
} else {
event.preventDefault()
this.reportValidity()
}
}
</script>
</body>
</html>

15
rdp.php Normal file
View File

@ -0,0 +1,15 @@
<?php
$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";

32
rescan.php Normal file
View File

@ -0,0 +1,32 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
include_once 'config.php';
$fileNameRegex = '/^[^<>:\/|?]+$/';
$name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex], "flags" => FILTER_NULL_ON_FAILURE]);
if (!$name) {
die("Paramètre manquant ou incorrect : name");
}
$path = "$SCANSDIR/$name.xml";
if (!file_exists($path)) {
die("Scan inconnu : $name");
}
$xml = simplexml_load_file($path);
$cmd = $xml["args"];
if (substr($cmd, 0, 5) != "nmap ") {
die("Erreur : $path n'est pas un fichier de scan nmap");
}
$cmd = $NMAP . substr($xml["args"], 4);
header('Content-type: text/xml');
system("$cmd", $retcode);
exit();

23
rm.php Normal file
View File

@ -0,0 +1,23 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
include_once 'config.php';
$fileNameRegex = '/^[0-9a-zA-Z-_. ]+$/';
$name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex], "flags" => FILTER_NULL_ON_FAILURE]);
if (!$name) {
die("Paramètre manquant ou incorrect : name");
}
$path = "$SCANSDIR/$name.xml";
if (!file_exists($path)) {
die("Scan inconnu : $name");
}
unlink($path);
header('Location: .');

162
scan.php Normal file
View File

@ -0,0 +1,162 @@
<?php
include_once 'config.php';
$fileNameRegex = '/^[\da-zA-Z-_. ]+$/';
$targetListRegex = '/^[\da-zA-Z-_. \/]+$/';
$target = filter_input(INPUT_GET, 'target', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
$name = filter_input(INPUT_GET, 'name', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex], "flags" => FILTER_NULL_ON_FAILURE]);
$preset = filter_input(INPUT_GET, "preset", FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if ($preset && isset($PRESETS[$preset])) {
$inputs = $PRESETS[$preset];
} else {
$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]?$/';
$inputs = 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,
'--send-ip' => FILTER_VALIDATE_BOOLEAN,
'--privileged' => FILTER_VALIDATE_BOOLEAN,
'--unprivileged' => FILTER_VALIDATE_BOOLEAN,
'--stylesheet' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
], false);
}
$inputs['--stylesheet'] = "$STYLESHEETSDIR/{$inputs['--stylesheet']}?";
if ($name) $inputs['--stylesheet'] .= "name=$name";
$options = "";
foreach (array_merge($COMMONOPTIONS, $inputs) 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 "index.php";
die();
} else if ($value) {
if ($value === true) {
$options .= " $option";
} else {
if (substr($option, 0, 2) == '--')
$options .= " $option " . escapeshellarg($value);
else
$options .= " $option" . escapeshellarg($value);
}
}
}
}
$cmd = "$NMAP$options -oX - $target";
if ($cmd) {
if ($name) {
if (!file_exists($SCANSDIR))
mkdir($SCANSDIR);
$path = "$SCANSDIR/$name.xml";
$cmd .= " | tee " . escapeshellarg($path);
}
header('Content-type: text/xml');
system("$cmd", $retcode);
if ($retcode) {
http_response_code(405);
die();
}
exit();
}
include_once "index.php";
die();

3
script-args.ini Normal file
View File

@ -0,0 +1,3 @@
smbdomain = AUTH
smbuser = application.drieat
smbpassword = d+iFiWn4!cAzdr3KopiM>EA

15
script.js Normal file
View File

@ -0,0 +1,15 @@
function toggleTheme() {
if (document.body.classList.contains('inverted')) {
$(".inverted").addClass("light").removeClass("inverted")
$("#toggleThemeButton i").addClass("moon").removeClass("sun")
localStorage.setItem("laScanTheme", "light")
} else {
$(".light").addClass("inverted").removeClass("light")
$("#toggleThemeButton i").addClass("sun").removeClass("moon")
localStorage.setItem("laScanTheme", "dark")
}
}
if (localStorage.getItem("laScanTheme") === "light") {
toggleTheme()
}

34
scripts/README.md Normal file
View File

@ -0,0 +1,34 @@
# 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
```

113
scripts/http-info.nse Normal file
View File

@ -0,0 +1,113 @@
local shortport = require "shortport"
description = [[
Return status, title and favicon URL of a webpage
]]
---
-- @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
---
categories = {"discovery", "intrusive"}
author = "Adrien Malingrey"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
portrule = shortport.http
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 favicon_relative_uri = "/favicon.ico"
local favicon
stdnse.debug1("port", port.service)
if (port.service == "ssl") then
scheme = "https"
else
scheme = port.service
end
stdnse.debug1("scheme", scheme)
if(stdnse.get_script_args('http-get.path')) then
path = stdnse.get_script_args('http-info.path')
end
stdnse.debug1("Try to download %s", path)
local answer = http.get(hostaddress, port, path)
local output = {status=answer.status, ["status-line"]=answer["status-line"]}
if (answer and answer.status == 200) then
stdnse.debug1("[SUCCESS] Load page %s", path)
-- 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
output.title = title
end
stdnse.debug1("[INFO] Try favicon %s", favicon_relative_uri)
favicon_relative_uri = parseIcon(answer.body) or favicon_relative_uri
else
stdnse.debug1("[ERROR] Can't load page %s", path)
end
favicon = http.get(hostaddress, port, favicon_relative_uri)
if (favicon and favicon.status == 200) then
stdnse.debug1("[SUCCESS] Load favicon %s", favicon_relative_uri)
output.favicon = favicon_relative_uri
else
stdnse.debug1("[ERROR] Can't load favicon %s", favicon_relative_uri)
end
return output
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

206
scripts/smb-shares-size.nse Normal file
View File

@ -0,0 +1,206 @@
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 -p137-139,445 --script smb-shares-size.nse --script-args-file smb-authentication.ini <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"})
local stdnse = require "stdnse"
local smb = require "smb"
local smb2 = require "smb2"
local msrpc = require "msrpc"
local bin = require "bin"
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

87
style.css Normal file
View File

@ -0,0 +1,87 @@
body.inverted {
background-color: #1b1c1d;
}
.ui.menu .header.item {
margin: 0;
}
.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;
}
.mini.share-size {
font-size: 0.64285714rem !important;
}
.ui.card .table {
overflow-x: auto;
}
.inverted tags {
background-color: white;
}

426
stylesheets/hostDetails.xsl Normal file
View File

@ -0,0 +1,426 @@
<?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/services.xsl" />
<xsl:import href="lib/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;'), '?')" />
<xsl:variable name="base" select="concat($stylesheetURL, '/../../')" />
<xsl:variable name="name" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'name='), '&quot;')" />
<xsl:template match="nmaprun">
<xsl:variable name="target" select="substring-after(@args, '-oX - ')" />
<xsl:variable name="current" select="." />
<xsl:variable name="init" select="document(concat($base, 'scans/', $name, '.xml'))/nmaprun" />
<html lang="fr">
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="base" select="$base" />
<xsl:with-param name="name" select="$name" />
<xsl:with-param name="target" select="$target" />
</xsl:apply-templates>
<body class="inverted">
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="target" select="$target" />
<xsl:with-param name="name" select="$name" />
</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>
<footer class="ui footer inverted segment"> Résultat de la commande :<br />
<code>
<xsl:value-of select="@args" />
</code>
</footer>
<script src="script.js"></script>
<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 class="ui header">
<div>
<xsl:attribute name="class">
<xsl:text>ui horizontal 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: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>
<abbr title="Confiance : {os/osmatch/@accuracy}%">
<xsl:value-of select="os/osmatch/@name" />
</abbr>
</td>
</xsl:if>
<xsl:if test="distance/@value">
<td>
<xsl:value-of select="distance/@value" />
<xsl:text> étape(s)</xsl:text>
</td>
</xsl:if>
<xsl:if test="uptime/@lastboot">
<td>
<xsl:value-of select="uptime/@lastboot" />
</td>
</xsl:if>
</tr>
</tbody>
</table>
<xsl:if test="hostscript/script">
<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>
</xsl:if>
<h2 class="ui header">Services</h2>
<div class="ui inverted two small cards">
<xsl:apply-templates select="$currentHost/ports/port[not(state/@state='closed')] | $initHost/ports/port[not(state/@state='closed')][not(@portid=$currentHost/ports/port/@portid)]">
<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:apply-templates select="trace" />
</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 card {$color}">
<div class="content">
<div class="header">
<div class="ui {$color} right floated label" title="{state/@state}">
<div class="detail" style="text-transform: uppercase">
<xsl:value-of select="@protocol" />
<xsl:text>:</xsl:text>
</div>
<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' or service/@name='msrpc'">
<a class="ui {$color} button" target="_blank">
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="service/@name='ms-wbt-server' or service/@name='msrpc'">
<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>
<xsl:text>Ouvrir</xsl:text>
</a>
</xsl:if>
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">
<div class="ui {$color} center aligned dropdown share-size button">
<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>
<i class="external alternate icon"></i>
<xsl:text>Ouvrir</xsl:text>
<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>
</div>
</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 compact 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 compact 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 compact inverted fixed definition table">
<tbody>
<xsl:apply-templates select="elem" />
</tbody>
</table>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="elem">
<tr>
<td style="width: min-content">
<xsl:value-of select="@key" />
</td>
<td>
<xsl:value-of select="." />
</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:template match="trace">
<h2 class="ui header">Traceroute</h2>
<table class="ui inverted table">
<thead>
<tr>
<th>Étape</th>
<th>Adresse</th>
<th>Temps</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="hop" />
</tbody>
</table>
</xsl:template>
<xsl:template match="hop">
<tr>
<td>
<xsl:value-of select="@ttl" />
</td>
<td>
<xsl:choose>
<xsl:when test="@host">
<xsl:value-of select="@host" />
<xsl:text> (</xsl:text>
<xsl:value-of select="@ipaddr" />
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@ipaddr" />
</xsl:otherwise>
</xsl:choose>
</td>
<td>
<xsl:value-of select="@rtt" />
<xsl:text> ms</xsl:text>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>

297
stylesheets/lanTable.xsl Normal file
View File

@ -0,0 +1,297 @@
<?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/toast.xsl" />
<xsl:output method="html" encoding="UTF-8" indent="yes" />
<xsl:strip-space elements='*' />
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')" />
<xsl:variable name="base" select="concat($stylesheetURL, '/../../')" />
<xsl:variable name="name" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'name='), '&quot;')" />
<xsl:template match="nmaprun">
<xsl:variable name="target" select="substring-after(@args, '-oX - ')" />
<xsl:variable name="current" select="." />
<xsl:variable name="init" select="document(concat($base, 'scans/', $name, '.xml'))/nmaprun" />
<html lang="fr">
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="base" select="$base" />
<xsl:with-param name="name" select="$name" />
<xsl:with-param name="target" select="$target" />
</xsl:apply-templates>
<body class="inverted">
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="target" select="$target" />
<xsl:with-param name="name" select="$name" />
</xsl:apply-templates>
<main class="ui main container inverted vertical segment">
<h1 class="ui header">
<xsl:choose>
<xsl:when test="$name">
<xsl:value-of select="$name" disable-output-escaping="yes" />
<div class="sub header">
<xsl:value-of select="$target" />
</div>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$target" />
</xsl:otherwise>
</xsl:choose>
</h1>
<table id="scanResultsTable" style="width:100%" role="grid" class="ui sortable small compact stuck striped table">
<thead>
<tr>
<th class="collapsing">État</th>
<th>Adresse IP</th>
<th>Nom</th>
<xsl:if test="host/address[@addrtype='mac']/@vendor">
<th>Constructeur</th>
</xsl:if>
<th class="six wide">Services</th>
<th class="collapsing" title="Scan intensif">
<i class="search plus icon"></i>
</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="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>
<footer class="ui footer inverted segment">Résultat de la commande :<br />
<code>
<xsl:value-of select="@args" />
</code>
</footer>
<script src="script.js"></script>
<script>
var table = $('#scanResultsTable').DataTable({
responsive: true,
colReorder: true,
fixedHeader: true,
lengthMenu : [256, 512, 1024, 2048, { label: 'Tout', value: -1 }],
language: {
lengthMenu: 'Afficher _MENU_ résultats'
},
layout: {
topStart: { search: {text: 'Filtrer', placeholder: 'Filtre'} },
topEnd: {
buttons: [
'copy',
'print',
{
extend: 'collection',
text: 'Export',
buttons: ['csv', 'excel', 'pdf']
},
],
},
bottomStart: 'pageLength',
bottomEnd: 'paging',
bottom2Start: 'info',
},
order: [[0, 'asc'], [1, 'asc']]
})
$('.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 mini circular label red">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:text>.</xsl:text>
<xsl:value-of select="substring-after(hostnames/hostname/@name, '.')" />
</xsl:if>
</td>
<xsl:if test="../host/address[@addrtype='mac']/@vendor">
<td>
<xsl:value-of select="address[@addrtype='mac']/@vendor" />
</td>
</xsl:if>
<td>
<xsl:apply-templates select="$currentHost/ports/port[not(state/@state='closed')] | $initHost/ports/port[not(state/@state='closed')][not(@portid=$currentHost/ports/port/@portid)]">
<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>
</td>
<td style="width: min-content">
<a class="ui mini icon teal icon button" target="_blank" title="Scan intensif">
<xsl:attribute name="href">
<xsl:text>scan.php?target=</xsl:text>
<xsl:value-of select="$hostAddress" />
<xsl:text>&amp;preset=host</xsl:text>
</xsl:attribute>
<i class="search plus icon"></i>
</a>
</td>
</tr>
</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]" />
<a target="_blank">
<xsl:attribute name="class">
<xsl:text>ui mini label </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' or service/@name='msrpc'">
<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:text>:</xsl:text><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:text>:</xsl:text>
</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>

59
stylesheets/lib/head.xsl Normal file
View File

@ -0,0 +1,59 @@
<?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="name" />
<xsl:param name="target" />
<head>
<meta charset="utf-8" />
<base href="{$base}" />
<meta http-equiv="refresh" content="300">
<xsl:attribute name="content">
<xsl:text>300</xsl:text>
<xsl:if test="$name">
<xsl:text>;URL=rescan.php?name=</xsl:text>
<xsl:value-of select="$name" />
</xsl:if>
</xsl:attribute>
</meta>
<title>
<xsl:choose>
<xsl:when test="$name">
<xsl:value-of select="$name" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$target" />
</xsl:otherwise>
</xsl:choose>
<xsl:text> - lanScan</xsl:text>
</title>
<link rel="icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.datatables.net/v/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>

115
stylesheets/lib/nav.xsl Normal file
View File

@ -0,0 +1,115 @@
<?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">
<xsl:param name="target" />
<xsl:param name="name" />
<nav class="ui inverted secondary menu">
<a href="." class="ui header 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>
<div class="right menu">
<div class="ui right aligned category search item">
<form id="scanForm" action="scan.php" method="get">
<div class="ui inverted icon input" id="targetInputDiv">
<input name="target" class="prompt" type="text" placeholder="Scanner un réseau" pattern="[a-zA-Z0-9._\/ \-]+" value="{$target}"
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="preset" value="lanScan" />
</form>
<a class="ui icon button item" href="options.php" title="Options avancées">
<i class="settings icon"></i>
</a>
<xsl:if test="$name">
<a class="ui icon button item" id="refreshLink" href="rescan.php?name={$name}" title="Actualiser">
<i class='sync icon'></i>
</a>
</xsl:if>
<button id="toggleThemeButton" type="button" class="ui icon link item" title="Thème clair/sombre" onclick="toggleTheme()">
<i class="sun icon"></i>
</button>
</div>
</div>
</nav>
<script>
scanForm.onsubmit = function(event) {
if (scanForm.checkValidity()) {
targetInputDiv.classList.add('loading')
$.toast({
title : 'Scan en cours...',
message : 'Merci de patienter',
class : 'info',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom left',
})
}
}
<xsl:if test="$name">
refreshLink.onclick = function(event) {
refreshLink.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 left',
})
}
</xsl:if>
</script>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,116 @@
<?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>

42
stylesheets/lib/toast.xsl Normal file
View File

@ -0,0 +1,42 @@
<?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="$init/runstats/finished and (finished/@timestr != $init/runstats/finished/@timestr)">
$.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 left',
})
</xsl:if>
<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 left',
})
</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 left',
})
</xsl:if>
</script>
</xsl:template>
</xsl:stylesheet>