Compare commits
164 Commits
v2
..
13f42cad36
| Author | SHA1 | Date | |
|---|---|---|---|
| 13f42cad36 | |||
| eeba9d613b | |||
| dba34f39eb | |||
| 0e24595170 | |||
| efed32d11d | |||
| ae0abc39cf | |||
| a981059c73 | |||
| c2d2a2455d | |||
| dd16294e8d | |||
| 6f0cc6e9bd | |||
| b4016685a0 | |||
| f39c328d06 | |||
| cbbf09677e | |||
| 2b1fd671da | |||
| b445d08ce1 | |||
| e2c1c6604e | |||
| a593148c38 | |||
| d45b05941f | |||
| e423273752 | |||
| 0c72ceb620 | |||
| dc8fa57c0f | |||
| 53679e2098 | |||
| 8cd0ba066f | |||
| 602c1fc7f3 | |||
| 06eb33187b | |||
| 43d2df7850 | |||
| 9d7f526080 | |||
| 80dc329353 | |||
| 81652e25c9 | |||
| 4e14da1860 | |||
| 8e5f010da0 | |||
| df4648e12a | |||
| 154d731e55 | |||
| 2ef0421078 | |||
| f2acc56ef7 | |||
| 1d5bb5446d | |||
| 7790369ac1 | |||
| bfb7788df0 | |||
| c174b3a142 | |||
| 1a0bb6abf5 | |||
| c01cfb631b | |||
| f1bb88abec | |||
| f2af893303 | |||
| 8865da906d | |||
| f05edd0fc7 | |||
| 2eda5ca9c9 | |||
| 68a98fb5a5 | |||
| 7bddbd3e10 | |||
| 0b59c94f52 | |||
| bd8e988444 | |||
| cadcd37408 | |||
| d8bc7d99fb | |||
| 458c04afa1 | |||
| f001e1b61d | |||
| db6643b8bb | |||
| a7c67292ed | |||
| dfd89a5add | |||
| c6b8005958 | |||
| 705904fbfa | |||
| af6dc0a76b | |||
| 321935e7a8 | |||
| baef7123b8 | |||
| f14062fda5 | |||
| b55df2e880 | |||
| 5882baf8ae | |||
| dba9e2e9b7 | |||
| 4928b346b3 | |||
| 0c736158aa | |||
| 17a628cc11 | |||
| b6900bc76a | |||
| c3ed9f9fc2 | |||
| a773e8b8d9 | |||
| 54116d27d0 | |||
| 887e024f27 | |||
| 9f06bd0b66 | |||
| 63dbcb407f | |||
| e7b462c033 | |||
| d39798ea4e | |||
| 88280ac41d | |||
| 8c4dda99b5 | |||
| 22de01a01b | |||
| 1832864505 | |||
| 59d0695d1b | |||
| 4b3634dc67 | |||
| b3b9db4aa7 | |||
| 3b90e7f6cc | |||
| 290932a421 | |||
| 9683dd2283 | |||
| df5c7e8497 | |||
| 5e0985e7d6 | |||
| ff18e2352c | |||
| 7aeb817c4c | |||
| 7c4d32c83f | |||
| 4ccd659d63 | |||
| c2b40b5c71 | |||
| 6fc85431af | |||
| 18775fb8b1 | |||
| 9f2826d522 | |||
| 653bb604f5 | |||
| 6c33080785 | |||
| a1aeefee47 | |||
| 5e76b92b96 | |||
| ec917b4602 | |||
| 260c8f073a | |||
| 570e8f2252 | |||
| cd6f64679b | |||
| 6422830783 | |||
| 7ef62104f0 | |||
| 386d0fc65d | |||
| 9a525b6ffe | |||
| 6a3589b988 | |||
| 2c771c0766 | |||
| 1befb0017c | |||
| 95d509e1b1 | |||
| f8f1183fe7 | |||
| 9cb008785c | |||
| 2337fe1e60 | |||
| 1f2ab88641 | |||
| 641f214899 | |||
| 89a7613f9e | |||
| fdf15e5a7d | |||
| 47c0bbdb4c | |||
| db216baf46 | |||
| cf5dcf24a7 | |||
| 2f7eebdaf1 | |||
| ad79495608 | |||
| 76e1832c28 | |||
| f7629028f6 | |||
| f5a0cffc05 | |||
| bcf6ddff0d | |||
| df6f5154e2 | |||
| efff220fe3 | |||
| cb0a4d94a5 | |||
| 48113dc7cc | |||
| b197af448a | |||
| 97a4c5801b | |||
| 8a9b822cf6 | |||
| f413212db9 | |||
| 01f8ee3ea0 | |||
| 664bee1249 | |||
| bcb63b3d0f | |||
| 3c9978569b | |||
| eae12a8e4e | |||
| ce4f8dda1a | |||
| b3cffaed35 | |||
| a6ba7c4b23 | |||
| 865a8efb62 | |||
| 3a594acb48 | |||
| b4f75a5984 | |||
| 4e9dd60477 | |||
| 20e6b22d0d | |||
| 3dd9e39f5c | |||
| 7062b94aaa | |||
| d5dd51921c | |||
| b02c89973c | |||
| 0d56163339 | |||
| 6319d411c5 | |||
| 6dd728ce0d | |||
| 1d8457d020 | |||
| 85fab8e41b | |||
| bef547fae0 | |||
| 42e16d3ef8 | |||
| f44e1d8267 | |||
| 34a4058ba4 |
+2
-3
@@ -1,4 +1,3 @@
|
||||
nse/script-args.ini
|
||||
configs/
|
||||
scans/
|
||||
site/
|
||||
datadir/script-args.ini
|
||||
test.php
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
# lanScan
|
||||
|
||||
Scanne des hôtes avec `nmap`
|
||||
et affiche le résultat dans une page web.
|
||||
|
||||
* Créer un fichier de configuration YAML dans un sous-dossier ./configs/ (voir l'exemple ci-dessous).
|
||||
Il peut être généré en scannant un réseau avec : `./discover.sh <CIDR>`.
|
||||
* Scanner avec le script `./scan_all.sh` (utiliser une tâche cron !).
|
||||
* Voir les résultats en ouvrant `.\index.php` dans le navigateur web.
|
||||
|
||||
## Exemple
|
||||
```yaml
|
||||
---
|
||||
site: Nom du site
|
||||
|
||||
hosts:
|
||||
- name: Nom du premier groupe
|
||||
host:
|
||||
- address: host1.local
|
||||
services: [ssh, http]
|
||||
- address: 192.168.1.100
|
||||
services: [ftp, https, 5432]
|
||||
- name: Nom du 2ème groupe
|
||||
host:
|
||||
- adress: host3.local
|
||||
services: [ssh, ftp, 8006]
|
||||
```
|
||||
|
||||
@@ -1,27 +1,19 @@
|
||||
# lanScan
|
||||
# nmap-webui
|
||||
A simple web interface for Nmap for network discovery and monitoring
|
||||
|
||||
Scan hosts with `nmap` and display results in webpage.
|
||||
## Dependencies
|
||||
|
||||
* Create a configuration yaml file in ./configs/ subdirectory (see example below).
|
||||
It may be generated by scanning a network with `./discover.sh <CIDR>`.
|
||||
* Scan with `./scan_all.sh` (use a cron task!).
|
||||
* Open `.\index.php` in web browser to see results.
|
||||
As most of the `nmap` features requires to be `root`, you will have to run this command to avoid the need to specify the password when the interface will invocate `nmap`.
|
||||
|
||||
## Example
|
||||
```yaml
|
||||
---
|
||||
site: Nom du site
|
||||
|
||||
hosts:
|
||||
- name: Nom du premier groupe
|
||||
host:
|
||||
- address: host1.local
|
||||
services: [ssh, http]
|
||||
- address: 192.168.1.100
|
||||
services: [ftp, https, 5432]
|
||||
- name: Nom du 2ème groupe
|
||||
host:
|
||||
- adress: host3.local
|
||||
services: [ssh, ftp, 8006]
|
||||
```bash
|
||||
# Authorize nmap to run as root without password
|
||||
echo "$USER ALL = NOPASSWD: $(which nmap)" | sudo tee -a /etc/sudoers.d/nmap
|
||||
```
|
||||
|
||||
Allow web server to save scans:
|
||||
|
||||
```bash
|
||||
mkdir scans
|
||||
chown www-data scans
|
||||
chmod 750 scans
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
$port = (($_SERVER['REQUEST_SCHEME'] == "http" && $_SERVER['SERVER_PORT'] == 80) || ($_SERVER['REQUEST_SCHEME'] == "https" && $_SERVER['SERVER_PORT'] == 443)) ? "" : ":{$_SERVER['SERVER_PORT']}";
|
||||
$BASEDIR = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}$port" . dirname($_SERVER['SCRIPT_NAME']);
|
||||
$SCANSDIR = "scans";
|
||||
$STYLESHEETSDIR = "stylesheets";
|
||||
|
||||
$lanScanCmd = "sudo nmap -PSmicrosoft-ds -F -T5 -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/lanScan.xsl";
|
||||
$hostScanCmd = "sudo nmap -A -T5 -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/hostScan.xsl";
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
###
|
||||
#
|
||||
# Scan un réseau avec nmap pour créer un fichier de configuration
|
||||
# Usage : ./discover <reseau> avec reseau en notation CIDR XXX.XXX.XXX.XXX/XX
|
||||
#
|
||||
###
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo -e "Usage : ./discover <CIDR>\navec <CIDR> l'adresse réseau en notation CIDR (XXX.XXX.XXX.XXX/XX)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd "$(dirname -- "$0")" > /dev/null
|
||||
network="$1"
|
||||
site="${network/\//_}"
|
||||
|
||||
mkdir -p "scans"
|
||||
nmap -F -oX "scans/$site.xml" $network
|
||||
mkdir -p "configs"
|
||||
xsltproc --stringparam network "$network" to_config.xsl "scans/$site.xml" > "configs/$site.yml"
|
||||
php to_XML.php "configs/$site.yml" > "site/$site.xml"
|
||||
|
||||
popd > /dev/null
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
@@ -0,0 +1,102 @@
|
||||
<?php include_once "config.php"; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>lanScan</title>
|
||||
<link rel="icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<style>
|
||||
body > .grid {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.logo {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="ui middle aligned center aligned grid inverted">
|
||||
<div class="column" style="max-width: 450px;">
|
||||
<h2 class="ui inverted teal fluid image header logo">
|
||||
lan<?php include 'logo.svg'; ?>can
|
||||
</h2>
|
||||
<form id="scanForm" class="ui large form initial inverted" action="." method="get">
|
||||
<div class="ui left aligned stacked segment inverted">
|
||||
<h4 class="ui header">Découvrir ou superviser un réseau</h4>
|
||||
<div class="inverted field">
|
||||
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
|
||||
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
|
||||
<?php
|
||||
if (file_exists($SCANSDIR)) {
|
||||
foreach (scandir($SCANSDIR) as $filename) {
|
||||
if (substr($filename, -4) === '.xml') {
|
||||
$name = substr($filename, 0, -4);
|
||||
$name = str_replace("!", "/", $name);
|
||||
echo " <option value='$name'>$name</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui error message"></div>
|
||||
<button type="submit" class="ui fluid large teal labeled icon submit button">
|
||||
<i class="satellite dish icon"></i>Scanner
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="ui inverted segment">
|
||||
<a href="options.php">Options avancées</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/semantic-ui/dist/semantic.min.js"></script>
|
||||
<script>
|
||||
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
|
||||
|
||||
$('#scanForm').form({
|
||||
fields: {
|
||||
lan: {
|
||||
identifier: 'lanSelect',
|
||||
rules: [{
|
||||
type: 'regExp',
|
||||
value: /[a-zA-Z0-9._\/ \-]+/,
|
||||
prompt: "Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.<br/>Exemples : <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
scanForm.onsubmit = function(event) {
|
||||
if (this.checkValidity()) {
|
||||
scanForm.classList.add("loading")
|
||||
$.toast({
|
||||
title : 'Scan en cours...',
|
||||
message : 'Merci de patienter',
|
||||
class : 'info',
|
||||
showIcon : 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
return true
|
||||
} else {
|
||||
event.preventDefault()
|
||||
this.reportValidity()
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html
|
||||
@@ -1,46 +1,102 @@
|
||||
<!doctype html>
|
||||
<?php include_once "config.php"; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta charset="utf-8" />
|
||||
<title>lanScan</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.3/dist/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.js"></script>
|
||||
<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>
|
||||
#logo {
|
||||
margin: 0 -.4rem 0 0;
|
||||
body > .grid {
|
||||
height: 100%;
|
||||
}
|
||||
.main.container {
|
||||
margin-top: 5em;
|
||||
|
||||
.logo {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="ui fixed centered blue inverted menu">
|
||||
<div class="header item">lan<img id="logo" src="logo.svg" alt="S"/>can</div>
|
||||
</header>
|
||||
<div class="ui main text container">
|
||||
<div class="ui link selection list">
|
||||
<?php
|
||||
if (! function_exists('str_ends_with')) {
|
||||
function str_ends_with(string $haystack, string $needle): bool
|
||||
{
|
||||
$needle_len = strlen($needle);
|
||||
return ($needle_len === 0 || 0 === substr_compare($haystack, $needle, - $needle_len));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (scandir("./site") as $file) {
|
||||
if (str_ends_with($file, ".xml")) {
|
||||
$site = str_replace(".xml", "", $file);
|
||||
if (file_exists("scans/$site.xml")) {
|
||||
echo " <a href='site/$site.xml' class='item'>$site</a>\n";
|
||||
<body>
|
||||
|
||||
<div class="ui middle aligned center aligned grid inverted">
|
||||
<div class="column" style="max-width: 450px;">
|
||||
<h2 class="ui inverted teal fluid image header logo">
|
||||
lan<?php include 'logo.svg'; ?>can
|
||||
</h2>
|
||||
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
|
||||
<div class="ui left aligned stacked segment inverted">
|
||||
<h4 class="ui header">Découvrir ou superviser un réseau</h4>
|
||||
<div class="inverted field">
|
||||
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
|
||||
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
|
||||
<?php
|
||||
if (file_exists($SCANSDIR)) {
|
||||
foreach (scandir($SCANSDIR) as $filename) {
|
||||
if (substr($filename, -4) === '.xml') {
|
||||
$name = substr($filename, 0, -4);
|
||||
$name = str_replace("!", "/", $name);
|
||||
echo " <option value='$name'>$name</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui error message"></div>
|
||||
<button type="submit" class="ui fluid large teal labeled icon submit button">
|
||||
<i class="satellite dish icon"></i>Scanner
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="ui inverted segment">
|
||||
<a href="options.php">Options avancées</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/semantic-ui/dist/semantic.min.js"></script>
|
||||
<script>
|
||||
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
|
||||
|
||||
$('#scanForm').form({
|
||||
fields: {
|
||||
lan: {
|
||||
identifier: 'lanSelect',
|
||||
rules: [{
|
||||
type: 'regExp',
|
||||
value: /[a-zA-Z0-9._\/ \-]+/,
|
||||
prompt: "Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.<br/>Exemples : <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
scanForm.onsubmit = function(event) {
|
||||
if (this.checkValidity()) {
|
||||
scanForm.classList.add("loading")
|
||||
$.toast({
|
||||
title : 'Scan en cours...',
|
||||
message : 'Merci de patienter',
|
||||
class : 'info',
|
||||
showIcon : 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
return true
|
||||
} else {
|
||||
event.preventDefault()
|
||||
this.reportValidity()
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html
|
||||
@@ -1,4 +1,4 @@
|
||||
<svg class="logo" style="margin: 0 -8px 0 0; fill: white;" version="1.1" id="Layer_1" x="0px" y="0px"
|
||||
<svg class="image logo" version="1.1" id="Layer_1" x="0px" y="0px"
|
||||
viewBox="0 0 24 24" xml:space="preserve" width="40" height="40" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs id="defs206" />
|
||||
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.0 KiB |
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
version="1.1">
|
||||
<xsl:output method="text" encoding="UTF-8" indent="yes" />
|
||||
|
||||
<xsl:param name="site"/>
|
||||
|
||||
<xsl:template match="lanScan">
|
||||
<xsl:text>nmap -v -T4 -Pn -p </xsl:text>
|
||||
<xsl:apply-templates select="//service[not(.=preceding::*)]" />
|
||||
<xsl:text> --script nse/ --datadir nse/ --script-args-file script-args.ini -oX "</xsl:text>
|
||||
<xsl:value-of select="@scanpath"/>
|
||||
<xsl:text>.tmp" </xsl:text>
|
||||
<xsl:apply-templates select="//host"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="service">
|
||||
<xsl:value-of select="." />
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="host">
|
||||
<xsl:value-of select="@address" />
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -1,109 +0,0 @@
|
||||
local shortport = require "shortport"
|
||||
|
||||
description = [[
|
||||
Get and return a page info
|
||||
]]
|
||||
|
||||
---
|
||||
-- @args http-get.path Path to get. Default /.
|
||||
--
|
||||
-- @usage nmap -p80 --script http-info.nse --script-args http-info.path=/ <host>
|
||||
--
|
||||
-- @output
|
||||
-- status: 200
|
||||
-- status-line: HTTP/1.1 200 OK\x0D
|
||||
---
|
||||
|
||||
categories = {"discovery", "intrusive"}
|
||||
author = "Adrien Malingrey"
|
||||
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
|
||||
|
||||
portrule = shortport.service({"http", "https", "ssl"})
|
||||
|
||||
local http = require "http"
|
||||
local stdnse = require "stdnse"
|
||||
|
||||
action = function(host, port)
|
||||
local scheme = ""
|
||||
local hostaddress = (host.name ~= '' and host.name) or host.ip
|
||||
local path = "/"
|
||||
local uri
|
||||
local favicon_relative_uri = "/favicon.ico"
|
||||
local favicon
|
||||
|
||||
if (port.service == "ssl") then
|
||||
scheme = "https"
|
||||
else
|
||||
scheme = port.service
|
||||
end
|
||||
|
||||
if(stdnse.get_script_args('http-get.path')) then
|
||||
path = stdnse.get_script_args('http-info.path')
|
||||
end
|
||||
|
||||
uri = scheme.."://"..hostaddress..":"..port.number..path
|
||||
stdnse.debug1("Try to download %s", uri)
|
||||
local answer = http.get_url(uri, {})
|
||||
|
||||
local info = {status=answer.status, ["status-line"]=answer["status-line"]}
|
||||
|
||||
if (answer and answer.status == 200) then
|
||||
stdnse.debug1("[SUCCESS] Load page %s", uri)
|
||||
-- Taken from http-title.nse by Diman Todorov
|
||||
local title = string.match(answer.body, "<[Tt][Ii][Tt][Ll][Ee][^>]*>([^<]*)</[Tt][Ii][Tt][Ll][Ee]>")
|
||||
if (title) then
|
||||
info.title = title
|
||||
end
|
||||
stdnse.debug1("[INFO] Try favicon %s", favicon_relative_uri)
|
||||
favicon_relative_uri = parseIcon(answer.body) or "favicon.ico"
|
||||
else
|
||||
stdnse.debug1("[ERROR] Can't load page %s", uri)
|
||||
end
|
||||
|
||||
favicon_absolute_uri = scheme.."://"..hostaddress..":"..port.number..favicon_relative_uri
|
||||
favicon = http.get_url(favicon_absolute_uri, {})
|
||||
|
||||
if (favicon and favicon.status == 200) then
|
||||
stdnse.debug1("[SUCCESS] Load favicon %s", favicon_absolute_uri)
|
||||
info.favicon = favicon_absolute_uri
|
||||
else
|
||||
stdnse.debug1("[ERROR] Can't load favicon %s", favicon_absolute_uri)
|
||||
end
|
||||
|
||||
return info
|
||||
end
|
||||
|
||||
--- function taken from http_favicon.nse by Vlatko Kosturjak
|
||||
|
||||
function parseIcon( body )
|
||||
local _, i, j
|
||||
local rel, href, word
|
||||
|
||||
-- Loop through link elements.
|
||||
i = 0
|
||||
while i do
|
||||
_, i = string.find(body, "<%s*[Ll][Ii][Nn][Kk]%s", i + 1)
|
||||
if not i then
|
||||
return nil
|
||||
end
|
||||
-- Loop through attributes.
|
||||
j = i
|
||||
while true do
|
||||
local name, quote, value
|
||||
_, j, name, quote, value = string.find(body, "^%s*(%w+)%s*=%s*([\"'])(.-)%2", j + 1)
|
||||
if not j then
|
||||
break
|
||||
end
|
||||
if string.lower(name) == "rel" then
|
||||
rel = value
|
||||
elseif string.lower(name) == "href" then
|
||||
href = value
|
||||
end
|
||||
end
|
||||
for word in string.gmatch(rel or "", "%S+") do
|
||||
if string.lower(word) == "icon" then
|
||||
return href
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
smbuser =
|
||||
smbpassword =
|
||||
@@ -1,206 +0,0 @@
|
||||
local stdnse = require "stdnse"
|
||||
local smb = require "smb"
|
||||
local smb2 = require "smb2"
|
||||
local msrpc = require "msrpc"
|
||||
local bin = require "bin"
|
||||
local shortport = require "shortport"
|
||||
|
||||
description = [[
|
||||
Return free and total size in octets of each SMB shares
|
||||
]]
|
||||
|
||||
---
|
||||
-- @args See the documentation for the smbauth library.
|
||||
--
|
||||
-- @usage nmap -p445 --script smb-shares-size.nse <host>
|
||||
--
|
||||
-- @output
|
||||
-- Host script results:
|
||||
-- | smb-shares-size:
|
||||
-- | data:
|
||||
-- | FreeSize: 38495883264
|
||||
-- | TotalSize: 500961574912
|
||||
-- |_ IPC$: NT_STATUS_ACCESS_DENIED
|
||||
---
|
||||
|
||||
categories = {"discovery", "intrusive"}
|
||||
author = "Adrien Malingrey"
|
||||
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
|
||||
|
||||
portrule = shortport.service({"microsoft-ds", "netbios-ssn", "smb"})
|
||||
|
||||
|
||||
action = function(host)
|
||||
local status, shares, extra
|
||||
local response = stdnse.output_table()
|
||||
|
||||
-- Try and do this the good way, make a MSRPC call to get the shares
|
||||
stdnse.debug1("SMB: Attempting to log into the system to enumerate shares")
|
||||
status, shares = msrpc.enum_shares(host)
|
||||
if(status == false) then
|
||||
return stdnse.format_output(false, string.format("Couldn't enumerate shares: %s", shares))
|
||||
end
|
||||
|
||||
-- Get more information on each share
|
||||
for i = 1, #shares, 1 do
|
||||
local share = shares[i]
|
||||
if (share ~= nil) then
|
||||
local status, result = get_share_info(host, share)
|
||||
if (status) then
|
||||
response[share] = result
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return response
|
||||
end
|
||||
|
||||
TRANS2_QUERY_FS_INFORMATION = 0x0003
|
||||
SMB_QUERY_FS_SIZE_INFO = 0x0103
|
||||
---Attempts to retrieve additional information about a share. Will fail unless we have
|
||||
-- administrative access.
|
||||
--
|
||||
--@param host The host object.
|
||||
--@return Status (true or false).
|
||||
--@return A table of information about the share (if status is true) or an an error string (if
|
||||
-- status is false).
|
||||
function get_share_info(host, share)
|
||||
local status, smbstate, err
|
||||
local hostaddress = (host.name ~= '' and host.name) or host.ip
|
||||
local path = "\\\\" .. hostaddress .. "\\" .. share
|
||||
|
||||
status, smbstate = smb.start(host)
|
||||
status, err = smb.negotiate_protocol(smbstate, {})
|
||||
status, err = smb.start_session(smbstate, {})
|
||||
status, err = smb.tree_connect(smbstate, path, {})
|
||||
|
||||
stdnse.debug1("SMB: Getting information for share: %s", path)
|
||||
|
||||
local status, err = send_transaction2(smbstate, TRANS2_QUERY_FS_INFORMATION, bin.pack("<S", SMB_QUERY_FS_SIZE_INFO))
|
||||
if ( not(status) ) then
|
||||
status, err = smb.stop(smbstate)
|
||||
return false, "Failed to send data to server: send_transaction2"
|
||||
end
|
||||
|
||||
local status, response = receive_transaction2(smbstate)
|
||||
if ( not(status) ) then
|
||||
status, err = smb.stop(smbstate)
|
||||
return false, response
|
||||
end
|
||||
|
||||
local pos, totalAllocationUnits, totalFreeAllocationUnits, sectorsPerAllocationUnit, bytesPerSector = bin.unpack("<LLII", response.data)
|
||||
|
||||
status, err = smb.stop(smbstate)
|
||||
|
||||
return true, {
|
||||
TotalSize = totalAllocationUnits * sectorsPerAllocationUnit * bytesPerSector,
|
||||
FreeSize = totalFreeAllocationUnits * sectorsPerAllocationUnit * bytesPerSector
|
||||
}
|
||||
end
|
||||
|
||||
-- Taken from smb lib
|
||||
|
||||
function send_transaction2(smbstate, sub_command, function_parameters, function_data, overrides)
|
||||
overrides = overrides or {}
|
||||
local header1, header2, header3, header4, command, status, flags, flags2, pid_high, signature, unused, pid, mid
|
||||
local header, parameters, data
|
||||
local parameter_offset = 0
|
||||
local parameter_size = 0
|
||||
local data_offset = 0
|
||||
local data_size = 0
|
||||
local total_word_count, total_data_count, reserved1, parameter_count, parameter_displacement, data_count, data_displacement, setup_count, reserved2
|
||||
local response = {}
|
||||
|
||||
-- Header is 0x20 bytes long (not counting NetBIOS header).
|
||||
header = smb.smb_encode_header(smbstate, smb.command_codes['SMB_COM_TRANSACTION2'], overrides) -- 0x32 = SMB_COM_TRANSACTION2
|
||||
|
||||
if(function_parameters) then
|
||||
parameter_offset = 0x44
|
||||
parameter_size = #function_parameters
|
||||
data_offset = #function_parameters + 33 + 32
|
||||
end
|
||||
|
||||
-- Parameters are 0x20 bytes long.
|
||||
parameters = bin.pack("<SSSSCCSISSSSSCCS",
|
||||
parameter_size, -- Total parameter count.
|
||||
data_size, -- Total data count.
|
||||
0x000a, -- Max parameter count.
|
||||
0x3984, -- Max data count.
|
||||
0x00, -- Max setup count.
|
||||
0x00, -- Reserved.
|
||||
0x0000, -- Flags (0x0000 = 2-way transaction, don't disconnect TIDs).
|
||||
0x00001388, -- Timeout (0x00000000 = return immediately).
|
||||
0x0000, -- Reserved.
|
||||
parameter_size, -- Parameter bytes.
|
||||
parameter_offset, -- Parameter offset.
|
||||
data_size, -- Data bytes.
|
||||
data_offset, -- Data offset.
|
||||
0x01, -- Setup Count
|
||||
0x00, -- Reserved
|
||||
sub_command -- Sub command
|
||||
)
|
||||
|
||||
local data = "\0\0\0" .. (function_parameters or '')
|
||||
.. (function_data or '')
|
||||
|
||||
-- Send the transaction request
|
||||
stdnse.debug2("SMB: Sending SMB_COM_TRANSACTION2")
|
||||
local result, err = smb.smb_send(smbstate, header, parameters, data, overrides)
|
||||
if(result == false) then
|
||||
stdnse.debug1("SMB: Try SMBv2 connexion")
|
||||
local result, err = smb2.smb2_send(smbstate, header, parameters, data, overrides)
|
||||
if(result == false) then
|
||||
return false, err
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function receive_transaction2(smbstate)
|
||||
|
||||
-- Read the result
|
||||
local status, header, parameters, data = smb.smb_read(smbstate)
|
||||
if(status ~= true) then
|
||||
stdnse.debug1("SMB: Try SMBv2 connexion")
|
||||
local status, header, parameters, data = smb2.smb2_read(smbstate)
|
||||
if(status ~= true) then
|
||||
return false, header
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if it worked
|
||||
local pos, header1, header2, header3, header4, command, status, flags, flags2, pid_high, signature, unused, tid, pid, uid, mid = bin.unpack("<CCCCCICSSlSSSSS", header)
|
||||
if(header1 == nil or mid == nil) then
|
||||
return false, "SMB: ERROR: Server returned less data than it was supposed to (one or more fields are missing); aborting [29]"
|
||||
end
|
||||
if(status ~= 0) then
|
||||
if(smb.status_names[status] == nil) then
|
||||
return false, string.format("Unknown SMB error: 0x%08x\n", status)
|
||||
else
|
||||
return false, smb.status_names[status]
|
||||
end
|
||||
end
|
||||
|
||||
-- Parse the parameters
|
||||
local pos, total_word_count, total_data_count, reserved1, parameter_count, parameter_offset, parameter_displacement, data_count, data_offset, data_displacement, setup_count, reserved2 = bin.unpack("<SSSSSSSSSCC", parameters)
|
||||
if(total_word_count == nil or reserved2 == nil) then
|
||||
return false, "SMB: ERROR: Server returned less data than it was supposed to (one or more fields are missing); aborting [30]"
|
||||
end
|
||||
|
||||
-- Convert the parameter/data offsets into something more useful (the offset into the data section)
|
||||
-- - 0x20 for the header, - 0x01 for the length.
|
||||
parameter_offset = parameter_offset - 0x20 - 0x01 - #parameters - 0x02;
|
||||
-- - 0x20 for the header, - 0x01 for parameter length, the parameter length, and - 0x02 for the data length.
|
||||
data_offset = data_offset - 0x20 - 0x01 - #parameters - 0x02;
|
||||
|
||||
-- I'm not sure I entirely understand why the '+1' is here, but I think it has to do with the string starting at '1' and not '0'.
|
||||
local function_parameters = string.sub(data, parameter_offset + 1, parameter_offset + parameter_count)
|
||||
local function_data = string.sub(data, data_offset + 1, data_offset + data_count)
|
||||
|
||||
local response = {}
|
||||
response['parameters'] = function_parameters
|
||||
response['data'] = function_data
|
||||
|
||||
return true, response
|
||||
end
|
||||
@@ -1,6 +1,15 @@
|
||||
<?php
|
||||
header("Content-Disposition: attachment; filename=".str_replace(":", "_", $_GET["v"]).".rdp");
|
||||
header("Content-Type: application/rdp");
|
||||
print "full address:s:${_GET[v]}\n";
|
||||
|
||||
$host = filter_input(INPUT_GET, 'v', FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) ?: filter_input(INPUT_GET, 'v', FILTER_VALIDATE_IP);
|
||||
if (!$host) {
|
||||
exit();
|
||||
?>
|
||||
}
|
||||
|
||||
$port = filter_input(INPUT_GET, 'p', FILTER_VALIDATE_INT);
|
||||
if ($port) {
|
||||
$host = "$host:$port";
|
||||
}
|
||||
|
||||
header("Content-Disposition: attachment; filename=$host.rdp");
|
||||
header('Content-Type: application/rdp');
|
||||
echo "full address:s:$host\n";
|
||||
|
||||
-222
@@ -1,222 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
version="1.1">
|
||||
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
|
||||
|
||||
<xsl:variable name="scan" select="document(string(lanScan/@scanpath))/nmaprun"/>
|
||||
|
||||
<xsl:template match="lanScan">
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<title><xsl:value-of select="@site"/> - lanScan</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.3/dist/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.css"/>
|
||||
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.js"></script>
|
||||
<style>
|
||||
#logo {
|
||||
margin: 0 -.4rem 0 0;
|
||||
}
|
||||
.main.container {
|
||||
margin-top: 5em;
|
||||
}
|
||||
.ui.mini.button {
|
||||
padding: 1em;
|
||||
}
|
||||
.icon {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
}
|
||||
.icon > img {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.share-size {
|
||||
--free-ratio: calc(var(--free) / var(--total));
|
||||
--used-percent: calc(100% - 100%*var(--free-ratio));
|
||||
--color: hsl(calc(120*var(--free-ratio)) 100% 50%);
|
||||
background-image: linear-gradient(to right, var(--color) var(--used-percent), transparent var(--used-percent), transparent) !important;
|
||||
}
|
||||
</style>
|
||||
<meta http-equiv="refresh" content="60"/>
|
||||
</head>
|
||||
<body>
|
||||
<header class="ui fixed blue inverted menu">
|
||||
<a href=".." class="header item">lan<img id="logo" src="../logo.svg" alt="S"/>can</a>
|
||||
<div class="header center item"><xsl:value-of select="@site"/></div>
|
||||
</header>
|
||||
<div class="ui main container">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scan/runstats/finished/@errormsg">
|
||||
<div class="ui negative icon message">
|
||||
<i class="exclamation triangle icon"></i>
|
||||
<div class="content">
|
||||
<div class="header" style="text-transform: capitalize"><xsl:value-of select="$scan/runstats/finished/@exit"/></div>
|
||||
<p><xsl:value-of select="$scan/runstats/finished/@errormsg"/></p>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:when test="$scan/runstats/finished/@summary">
|
||||
<div class="ui icon message">
|
||||
<i class="sitemap icon"></i>
|
||||
<div class="content">
|
||||
<div class="header" style="text-transform: capitalize"><xsl:value-of select="$scan/runstats/finished/@exit"/></div>
|
||||
<p><xsl:value-of select="$scan/runstats/finished/@summary"/></p>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:apply-templates select="group"/>
|
||||
</div>
|
||||
<script>
|
||||
$('.ui.dropdown').dropdown()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="group">
|
||||
<h1 class="ui header"><xsl:value-of select="@name"/></h1>
|
||||
<div class="ui doubling stackable five column compact grid">
|
||||
<xsl:apply-templates select="host"/>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="host">
|
||||
<xsl:variable name="address" select="@address"/>
|
||||
<xsl:variable name="scannedHost" select="$scan/host[hostnames/hostname/@name=$address or address/@addr=$address]"/>
|
||||
<xsl:variable name="scannedHostAddress">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scannedHost/hostnames/hostname/@name">
|
||||
<xsl:value-of select="$scannedHost/hostnames/hostname/@name"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$scannedHost/address/@addr">
|
||||
<xsl:value-of select="$scannedHost/address/@addr"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$address"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="name">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
|
||||
<xsl:when test="$scannedHost/hostnames/hostname/@name"><xsl:value-of select="substring-before($scannedHost/hostnames/hostname/@name, '.')"/></xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<div class="column">
|
||||
<xsl:variable name="status">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scannedHost/status/@state='up'">success</xsl:when>
|
||||
<xsl:otherwise>error</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<div class="ui fluid mini left icon action input {$status}">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scannedHost/ports/port/script[@id='http-info']/elem[@key='favicon']">
|
||||
<i class="icon"><img class="ui image" src="{$scannedHost/ports/port/script[@id='http-info']/elem[@key='favicon']}" alt=""/></i>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<i class="server icon"></i>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<input type="text" readonly="" value="{$name}" placeholder="{$scannedHost/address/@addr}"
|
||||
title="{@comment} {$scannedHost/hostnames/hostname/@name} ({$scannedHost/address/@addr}) "
|
||||
onfocus="this.value='{$scannedHostAddress}'; this.select()" onblur="this.value='{$name}'"
|
||||
/>
|
||||
<xsl:apply-templates select="service">
|
||||
<xsl:with-param name="scannedHost" select="$scannedHost"/>
|
||||
<xsl:with-param name="scannedHostAddress" select="$scannedHostAddress"/>
|
||||
</xsl:apply-templates>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="service">
|
||||
<xsl:param name="scannedHost"/>
|
||||
<xsl:param name="scannedHostAddress"/>
|
||||
<xsl:variable name="serviceName" select="."/>
|
||||
<xsl:variable name="scannedPort" select="$scannedHost/ports/port[service/@name=$serviceName or @portid=$serviceName][1]"/>
|
||||
<xsl:variable name="state">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scannedPort/state/@state='open'">green</xsl:when>
|
||||
<xsl:when test="$scannedPort/state/@state='filtered'">yellow</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="title">
|
||||
<xsl:value-of select="$scannedPort/@portid"/>
|
||||
<xsl:text>/</xsl:text>
|
||||
<xsl:value-of select="$scannedPort/@protocol"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$scannedPort/state/@state"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$scannedPort/service/@name"/>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scannedPort/script[@id='smb-shares-size']/table">
|
||||
<div class="ui {$state} dropdown mini button share-size" title="{$title}">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:for-each select="$scannedPort/script[@id='smb-shares-size']/table">
|
||||
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending"/>
|
||||
<xsl:if test="position()=1">
|
||||
<xsl:text>--free: </xsl:text>
|
||||
<xsl:value-of select="elem[@key='FreeSize']"/>
|
||||
<xsl:text>; --total: </xsl:text>
|
||||
<xsl:value-of select="elem[@key='TotalSize']"/>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="$serviceName"/>
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<xsl:apply-templates select="$scannedPort/script[@id='smb-shares-size']/table">
|
||||
<xsl:with-param name="scannedHostAddress" select="$scannedHostAddress"/>
|
||||
</xsl:apply-templates>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:when test="$scannedPort/service/@name='ms-wbt-server' or $scannedPort/service/@name='rdp'">
|
||||
<a class="ui {$state} mini button" href="../rdp.php?v={$scannedHostAddress}:{$scannedPort/@portid}" title="{$title}">
|
||||
<xsl:value-of select="$serviceName"/>
|
||||
</a>
|
||||
</xsl:when>
|
||||
<xsl:when test="$scannedPort/script[@id='http-info']">
|
||||
<xsl:variable name="status">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scannedPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
|
||||
<xsl:when test="$scannedPort/script[@id='http-info']/elem[@key='status']>=400">yellow</xsl:when>
|
||||
<xsl:when test="$scannedPort/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<a class="ui {$status} mini button" href="{$scannedPort/service/@name}://{$scannedHostAddress}:{$scannedPort/@portid}" target="_blank"
|
||||
title="{$scannedPort/script[@id='http-info']/elem[@key='title' or @key='status-line']}">
|
||||
<xsl:value-of select="$serviceName"/>
|
||||
</a>
|
||||
</xsl:when>
|
||||
<xsl:when test="$scannedPort/service/@name='ftp' or $scannedPort/service/@name='ssh' or $scannedPort/service/@name='http' or $scannedPort/service/@name='https'">
|
||||
<a class="ui {$state} mini button" href="{$scannedPort/service/@name}://{$scannedHostAddress}:{$scannedPort/@portid}" target="_blank" title="{$title}">
|
||||
<xsl:value-of select="$serviceName"/>
|
||||
</a>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<a class="ui disabled {$state} mini button" title="{$title}">
|
||||
<xsl:value-of select="$serviceName"/>
|
||||
</a>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="table">
|
||||
<xsl:param name="scannedHostAddress"/>
|
||||
<a class="item share-size" href="file://///{$scannedHostAddress}/{@key}" target="_blank" rel="noopener noreferrer" style="--free: {elem[@key='FreeSize']}; --total: {elem[@key='TotalSize']}">
|
||||
<xsl:value-of select="@key"/>
|
||||
</a>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
include_once 'config.php';
|
||||
|
||||
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||
if ($lan) {
|
||||
$cmd = "$lanScanCmd $lan";
|
||||
|
||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||
$filename = str_replace("/", "!", $lan);
|
||||
$path = "$SCANSDIR/$filename.xml";
|
||||
|
||||
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
||||
|
||||
header('Content-type: text/xml');
|
||||
system("$cmd", $retcode);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||
if ($host) {
|
||||
$cmd = "$hostScanCmd $host";
|
||||
|
||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||
$filename = str_replace("/", "!", $host);
|
||||
$path = "$SCANSDIR/$filename.xml";
|
||||
|
||||
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
||||
|
||||
header('Content-type: text/xml');
|
||||
system("$cmd", $retcode);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
include "index.php";
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: ./scan <config>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd "$(dirname -- "$0")" > /dev/null
|
||||
site="$(basename ${1/.yml/})"
|
||||
|
||||
php "to_XML.php" "configs/$site.yml" > "site/$site.xml" \
|
||||
&& eval $(xsltproc "nmap_cmd.xsl" "site/$site.xml") \
|
||||
&& mv "scans/$site.xml.tmp" "scans/$site.xml"
|
||||
|
||||
popd > /dev/null
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pushd "$(dirname -- $0)" > /dev/null
|
||||
|
||||
mkdir -p scans
|
||||
mkdir -p site
|
||||
|
||||
for config in configs/*.yml
|
||||
do
|
||||
site="$(basename ${config/.yml/})"
|
||||
echo "Scan $site"
|
||||
./scan.sh "$site"
|
||||
done
|
||||
|
||||
popd > /dev/null
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE nmaprun>
|
||||
<?xml-stylesheet href="https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl" type="text/xsl"?>
|
||||
<!-- Nmap 7.93 scan initiated Tue Feb 4 03:30:34 2025 as: nmap -PSmicrosoft-ds -F -T5 -oX - --stylesheet https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl scanme.nmap.org -->
|
||||
<nmaprun scanner="nmap" args="nmap -PSmicrosoft-ds -F -T5 -oX - --stylesheet https://adrien.malingrey.fr/dev/lanScan4/stylesheets/lanScan.xsl scanme.nmap.org" start="1738636234" startstr="Tue Feb 4 03:30:34 2025" version="7.93" xmloutputversion="1.05">
|
||||
<scaninfo type="syn" protocol="tcp" numservices="100" services="7,9,13,21-23,25-26,37,53,79-81,88,106,110-111,113,119,135,139,143-144,179,199,389,427,443-445,465,513-515,543-544,548,554,587,631,646,873,990,993,995,1025-1029,1110,1433,1720,1723,1755,1900,2000-2001,2049,2121,2717,3000,3128,3306,3389,3986,4899,5000,5009,5051,5060,5101,5190,5357,5432,5631,5666,5800,5900,6000-6001,6646,7070,8000,8008-8009,8080-8081,8443,8888,9100,9999-10000,32768,49152-49157"/>
|
||||
<verbose level="0"/>
|
||||
<debugging level="0"/>
|
||||
<hosthint><status state="up" reason="unknown-response" reason_ttl="0"/>
|
||||
<address addr="45.33.32.156" addrtype="ipv4"/>
|
||||
<hostnames>
|
||||
<hostname name="scanme.nmap.org" type="user"/>
|
||||
</hostnames>
|
||||
</hosthint>
|
||||
<host starttime="1738636234" endtime="1738636234"><status state="up" reason="reset" reason_ttl="48"/>
|
||||
<address addr="45.33.32.156" addrtype="ipv4"/>
|
||||
<hostnames>
|
||||
<hostname name="scanme.nmap.org" type="user"/>
|
||||
<hostname name="scanme.nmap.org" type="PTR"/>
|
||||
</hostnames>
|
||||
<ports><extraports state="closed" count="98">
|
||||
<extrareasons reason="reset" count="98" proto="tcp" ports="7,9,13,21,23,25-26,37,53,79,81,88,106,110-111,113,119,135,139,143-144,179,199,389,427,443-445,465,513-515,543-544,548,554,587,631,646,873,990,993,995,1025-1029,1110,1433,1720,1723,1755,1900,2000-2001,2049,2121,2717,3000,3128,3306,3389,3986,4899,5000,5009,5051,5060,5101,5190,5357,5432,5631,5666,5800,5900,6000-6001,6646,7070,8000,8008-8009,8080-8081,8443,8888,9100,9999-10000,32768,49152-49157"/>
|
||||
</extraports>
|
||||
<port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="48"/><service name="ssh" method="table" conf="3"/></port>
|
||||
<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="48"/><service name="http" method="table" conf="3"/></port>
|
||||
</ports>
|
||||
<times srtt="153298" rttvar="2254" to="162314"/>
|
||||
</host>
|
||||
<runstats><finished time="1738636234" timestr="Tue Feb 4 03:30:34 2025" summary="Nmap done at Tue Feb 4 03:30:34 2025; 1 IP address (1 host up) scanned in 1.05 seconds" elapsed="1.05" exit="success"/><hosts up="1" down="0" total="1"/>
|
||||
</runstats>
|
||||
</nmaprun>
|
||||
@@ -0,0 +1,76 @@
|
||||
body {
|
||||
background-color: #1b1c1d;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex !important;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.logo svg {
|
||||
width: 2.5em;
|
||||
height: 2.5em;
|
||||
fill: currentColor;
|
||||
margin: -0.4em !important;
|
||||
}
|
||||
|
||||
.tagify {
|
||||
width: 100%;
|
||||
border-radius: 0.28571429rem;
|
||||
--tags-focus-border-color: #85b7d9;
|
||||
--placeholder-color: rgba(191, 191, 191, 0.87);
|
||||
--placeholder-color-focus: rgba(115, 115, 115, 0.87);
|
||||
}
|
||||
|
||||
.ui.table {
|
||||
caption-side: bottom;
|
||||
}
|
||||
|
||||
.ui.label {
|
||||
margin: 0.14285714em;
|
||||
}
|
||||
|
||||
.ui.label > .detail {
|
||||
margin-left: 0.3em;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.ui.form .fields > .field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ui.ui.form .field .fields .field:not(:only-child) .ui.checkbox {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.ui.dropdown.label {
|
||||
min-width: auto;
|
||||
}
|
||||
|
||||
.ui.dropdown.label > .remove.icon {
|
||||
right: 2.3em;
|
||||
}
|
||||
|
||||
.toast-container .ui.header {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.share-size {
|
||||
--free-ratio: calc(var(--free) / var(--total));
|
||||
--used-percent: calc(100% - 100% * var(--free-ratio));
|
||||
--color: hsl(calc(120 * var(--free-ratio)) 100% 50%);
|
||||
background-image: linear-gradient(
|
||||
to right,
|
||||
var(--color) var(--used-percent),
|
||||
transparent var(--used-percent),
|
||||
transparent
|
||||
) !important;
|
||||
text-align: center !important;
|
||||
font-size: .64285714rem !important;
|
||||
}
|
||||
|
||||
.ui.card .table {
|
||||
overflow-x: auto;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.1">
|
||||
|
||||
<xsl:template match="nmaprun" mode="head">
|
||||
<xsl:param name="base" />
|
||||
<xsl:param name="targets" />
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="refresh" content="300" />
|
||||
<title>lanScan - <xsl:value-of select="$targets" />
|
||||
</title>
|
||||
<base href="{$base}" />
|
||||
<link rel="icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.datatables.net/v/se/jszip-3.10.1/dt-2.1.8/b-3.1.2/b-html5-3.1.2/b-print-3.1.2/cr-2.0.4/fc-5.0.3/fh-4.0.1/r-3.0.3/datatables.min.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.polyfills.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
|
||||
<script src="https://cdn.datatables.net/v/se/jszip-3.10.1/dt-2.1.8/b-3.1.2/b-html5-3.1.2/b-print-3.1.2/cr-2.0.4/fc-5.0.3/fh-4.0.1/r-3.0.3/datatables.min.js"></script>
|
||||
<script>
|
||||
DataTable.ext.type.detect.unshift(function (d) {
|
||||
return /[\d]+\.[\d]+\.[\d]+\.[\d]+/.test(d)
|
||||
? 'ipv4-address'
|
||||
: null;
|
||||
});
|
||||
|
||||
DataTable.ext.type.order['ipv4-address-pre'] = function (ipAddress) {
|
||||
[a, b, c, d] = ipAddress.split(".").map(Number)
|
||||
return 16777216*a + 65536*b + 256*c + d;
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,337 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.1">
|
||||
|
||||
<xsl:import href="head.xsl" />
|
||||
<xsl:import href="nav.xsl" />
|
||||
<xsl:import href="services.xsl" />
|
||||
<xsl:import href="toast.xsl" />
|
||||
|
||||
<xsl:output method="html" encoding="UTF-8" />
|
||||
<xsl:output indent="yes" />
|
||||
<xsl:strip-space elements='*' />
|
||||
|
||||
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'), '"')" />
|
||||
<xsl:variable name="base" select="concat($stylesheetURL, '/../../')" />
|
||||
|
||||
<xsl:template match="nmaprun">
|
||||
<xsl:variable name="targets" select="substring-after(@args, '.xsl ')" />
|
||||
<xsl:variable name="current" select="." />
|
||||
<xsl:variable name="init" select="document(concat($base, 'scans/', translate($targets,'/', '!'), '.xml'))/nmaprun" />
|
||||
|
||||
<html lang="fr">
|
||||
<xsl:apply-templates select="." mode="head">
|
||||
<xsl:with-param name="base" select="$base" />
|
||||
<xsl:with-param name="targets" select="$targets" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
<body>
|
||||
<xsl:apply-templates select="." mode="nav">
|
||||
</xsl:apply-templates>
|
||||
|
||||
<main class="ui main container inverted segment">
|
||||
<xsl:apply-templates select="$current/host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
|
||||
<xsl:with-param name="init" select="$init" />
|
||||
<xsl:with-param name="current" select="$current" />
|
||||
</xsl:apply-templates>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
$('.ui.tree.accordion').accordion()
|
||||
$('.ui.dropdown').dropdown()
|
||||
</script>
|
||||
<xsl:apply-templates select="runstats">
|
||||
<xsl:with-param name="init" select="$init" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="host">
|
||||
<xsl:param name="init" />
|
||||
<xsl:param name="current" />
|
||||
<xsl:variable name="addr" select="address/@addr" />
|
||||
<xsl:variable name="initHost" select="$init/host[address/@addr=$addr]" />
|
||||
<xsl:variable name="currentHost" select="$current/host[address/@addr=$addr]" />
|
||||
<xsl:variable name="hostAddress">
|
||||
<xsl:choose>
|
||||
<xsl:when test="hostnames/hostname/@name">
|
||||
<xsl:value-of select="hostnames/hostname/@name" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="address/@addr" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<h1>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>ui inverted header </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentHost/status/@state='up'">green</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="hostnames/hostname/@name">
|
||||
<xsl:value-of select="hostnames/hostname/@name" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="address/@addr" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</h1>
|
||||
|
||||
<table class="ui inverted table" style="width: max-content">
|
||||
<thead>
|
||||
<tr>
|
||||
<xsl:if test="address[@addrtype='ipv4']/@addr">
|
||||
<th>Adresse IPv4</th>
|
||||
</xsl:if>
|
||||
<xsl:if test="address[@addrtype='mac']/@addr">
|
||||
<th>Adresse MAC</th>
|
||||
</xsl:if>
|
||||
<xsl:if test="address/@vendor">
|
||||
<th>Constructeur</th>
|
||||
</xsl:if>
|
||||
<xsl:if test="os/osmatch/@name">
|
||||
<th>OS</th>
|
||||
</xsl:if>
|
||||
<xsl:if test="distance/@value">
|
||||
<th>Distance</th>
|
||||
</xsl:if>
|
||||
<xsl:if test="uptime/@lastboot">
|
||||
<th>Dernier redémarrage</th>
|
||||
</xsl:if>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<xsl:if test="address[@addrtype='ipv4']/@addr">
|
||||
<td>
|
||||
<xsl:value-of select="address[@addrtype='ipv4']/@addr" />
|
||||
</td>
|
||||
</xsl:if>
|
||||
<xsl:if test="address[@addrtype='mac']/@addr">
|
||||
<td>
|
||||
<xsl:value-of select="address[@addrtype='mac']/@addr" />
|
||||
</td>
|
||||
</xsl:if>
|
||||
<xsl:if test="address/@vendor">
|
||||
<td>
|
||||
<xsl:value-of select="address/@vendor" />
|
||||
</td>
|
||||
</xsl:if>
|
||||
<xsl:if test="os/osmatch/@name">
|
||||
<td>
|
||||
<xsl:value-of select="os/osmatch/@name" />
|
||||
</td>
|
||||
</xsl:if>
|
||||
<xsl:if test="distance/@value">
|
||||
<td>
|
||||
<xsl:value-of select="distance/@value" />
|
||||
<xsl:text> rebonds</xsl:text>
|
||||
</td>
|
||||
</xsl:if>
|
||||
<xsl:if test="uptime/@lastboot">
|
||||
<td>
|
||||
<xsl:value-of select="uptime/@lastboot" />
|
||||
</td>
|
||||
</xsl:if>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="ui inverted tree accordion">
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i>
|
||||
Informations supplémentaires
|
||||
</div>
|
||||
<div class="content">
|
||||
<xsl:apply-templates select="hostscript/script" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 class="ui header">Services</h2>
|
||||
|
||||
<div class="ui cards">
|
||||
<xsl:apply-templates select="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]">
|
||||
<xsl:with-param name="initHost" select="$initHost" />
|
||||
<xsl:with-param name="currentHost" select="$currentHost" />
|
||||
<xsl:with-param name="hostAddress" select="$hostAddress" />
|
||||
</xsl:apply-templates>
|
||||
</div>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="port">
|
||||
<xsl:param name="hostAddress" />
|
||||
<xsl:param name="initHost" />
|
||||
<xsl:param name="currentHost" />
|
||||
<xsl:variable name="portid" select="@portid" />
|
||||
<xsl:variable name="initPort" select="$initHost/ports/port[@portid=$portid]" />
|
||||
<xsl:variable name="currentPort" select="$currentHost/ports/port[@portid=$portid]" />
|
||||
<xsl:variable name="color">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">orange</xsl:when>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='open'">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='filtered'">orange</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<div class="ui inverted card {$color}">
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<div class="ui {$color} ribbon label" style="text-transform: uppercase">
|
||||
<xsl:value-of select="@protocol" />
|
||||
<xsl:text>:</xsl:text>
|
||||
<xsl:value-of select="@portid" />
|
||||
|
||||
</div>
|
||||
<xsl:value-of select="service/@name" />
|
||||
<xsl:if test="service/@tunnel">
|
||||
<span>
|
||||
<xsl:text>/</xsl:text>
|
||||
<xsl:value-of select="service/@tunnel" />
|
||||
</span>
|
||||
</xsl:if>
|
||||
</div>
|
||||
<div class="meta">
|
||||
<xsl:if test="service/@product">
|
||||
<span>
|
||||
<xsl:value-of select="service/@product" />
|
||||
</span>
|
||||
</xsl:if>
|
||||
<xsl:if test="service/@version">
|
||||
<span>
|
||||
<xsl:text>v</xsl:text>
|
||||
<xsl:value-of select="service/@version" />
|
||||
</span>
|
||||
</xsl:if>
|
||||
<xsl:if test="service/@extrainfo">
|
||||
<span>
|
||||
<xsl:value-of select="service/@extrainfo" />
|
||||
</span>
|
||||
</xsl:if>
|
||||
<div class="description">
|
||||
<xsl:if test="script">
|
||||
<div class="ui inverted tree accordion">
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i>
|
||||
Détails
|
||||
</div>
|
||||
<div class="content">
|
||||
<xsl:apply-templates select="script" />
|
||||
</div>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https' or service/@name='ms-wbt-server'">
|
||||
<a class="ui {$color} button">
|
||||
<xsl:attribute name="href" target="_blank">
|
||||
<xsl:choose>
|
||||
<xsl:when test="service/@name='ms-wbt-server'">
|
||||
<xsl:text>rdp.php?v=</xsl:text>
|
||||
<xsl:value-of select="$hostAddress" />
|
||||
<xsl:text>&p=</xsl:text>
|
||||
<xsl:value-of select="@portid" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="service/@name='http' and service/@tunnel='ssl'">
|
||||
<xsl:text>https</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="service/@name" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>://</xsl:text>
|
||||
<xsl:value-of select="$hostAddress" />
|
||||
<xsl:text>:</xsl:text>
|
||||
<xsl:value-of select="@portid" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<i class="external alternate icon"></i>
|
||||
Ouvrir
|
||||
</a>
|
||||
</xsl:if>
|
||||
</div>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="script">
|
||||
<div class="ui inverted accordion">
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i>
|
||||
<xsl:value-of select="@id" />
|
||||
</div>
|
||||
<div class="content">
|
||||
<xsl:choose>
|
||||
<xsl:when test="elem or table">
|
||||
<xsl:if test="elem">
|
||||
<table class="ui small inverted fixed definition table">
|
||||
<tbody>
|
||||
<xsl:apply-templates select="elem" />
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="table" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@output" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@key">
|
||||
<div class="ui inverted accordion">
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i>
|
||||
<xsl:value-of select="@key" />
|
||||
</div>
|
||||
<div class="content">
|
||||
<xsl:if test="elem">
|
||||
<table class="ui small inverted fixed definition table">
|
||||
<tbody>
|
||||
<xsl:apply-templates select="elem" />
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="table" />
|
||||
</div>
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:when test="elem">
|
||||
<table class="ui small inverted fixed definition table">
|
||||
<tbody>
|
||||
<xsl:apply-templates select="elem" />
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="elem">
|
||||
<tr>
|
||||
<td>
|
||||
<xsl:value-of select="@key" />
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="." />
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
version="1.1">
|
||||
|
||||
<xsl:import href="head.xsl" />
|
||||
<xsl:import href="nav.xsl" />
|
||||
<xsl:import href="services.xsl" />
|
||||
<xsl:import href="toast.xsl" />
|
||||
|
||||
<xsl:output method="html" encoding="UTF-8" />
|
||||
<xsl:output indent="yes" />
|
||||
<xsl:strip-space elements='*' />
|
||||
|
||||
<xsl:variable name="stylesheetURL"
|
||||
select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'), '"')" />
|
||||
<xsl:variable name="base" select="concat($stylesheetURL, '/../../')" />
|
||||
|
||||
<xsl:template match="nmaprun">
|
||||
<xsl:variable name="targets" select="substring-after(@args, '.xsl ')" />
|
||||
<xsl:variable
|
||||
name="current" select="." />
|
||||
<xsl:variable name="init"
|
||||
select="document(concat($base, 'scans/', translate($targets,'/', '!'), '.xml'))/nmaprun" />
|
||||
|
||||
<html
|
||||
lang="fr">
|
||||
<xsl:apply-templates select="." mode="head">
|
||||
<xsl:with-param name="base" select="$base" />
|
||||
<xsl:with-param name="targets" select="$targets" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
<body>
|
||||
<xsl:apply-templates select="." mode="nav">
|
||||
</xsl:apply-templates>
|
||||
|
||||
<main class="ui main container inverted segment">
|
||||
<h1>
|
||||
<xsl:value-of select="$targets" />
|
||||
</h1>
|
||||
|
||||
<table id="scanResultsTable" style="width:100%" role="grid"
|
||||
class="ui sortable small stuck striped table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: min-width">Etat</th>
|
||||
<th>Adresse IP</th>
|
||||
<th>Nom</th>
|
||||
<th>Constructeur</th>
|
||||
<th class="six wide">Services</th>
|
||||
<th style="width: min-width"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:apply-templates
|
||||
select="$current/host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
|
||||
<xsl:with-param name="init" select="$init" />
|
||||
<xsl:with-param name="current" select="$current" />
|
||||
</xsl:apply-templates>
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
var table = $('#scanResultsTable').DataTable({
|
||||
buttons : ['copy', 'excel', 'pdf'],
|
||||
fixedHeader: true,
|
||||
lengthMenu : [
|
||||
[256, 512, 1024, 2048, -1],
|
||||
[256, 512, 1024, 2048, "All"]
|
||||
],
|
||||
responsive: true,
|
||||
colReorder: true,
|
||||
buttons : ['copy', 'excel', 'pdf']
|
||||
})
|
||||
table.order([1, 'asc']).draw()
|
||||
|
||||
$('.ui.dropdown').dropdown()
|
||||
</script>
|
||||
<xsl:apply-templates select="runstats">
|
||||
<xsl:with-param name="init" select="$init" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="host">
|
||||
<xsl:param name="init" />
|
||||
<xsl:param name="current" />
|
||||
<xsl:variable name="addr"
|
||||
select="address/@addr" />
|
||||
<xsl:variable name="initHost"
|
||||
select="$init/host[address/@addr=$addr]" />
|
||||
<xsl:variable name="currentHost"
|
||||
select="$current/host[address/@addr=$addr]" />
|
||||
<xsl:variable name="hostAddress">
|
||||
<xsl:choose>
|
||||
<xsl:when test="hostnames/hostname/@name">
|
||||
<xsl:value-of select="hostnames/hostname/@name" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="address/@addr" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<tr>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentHost/status/@state='up'">positive</xsl:when>
|
||||
<xsl:otherwise>negative</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<td>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentHost">
|
||||
<div>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>ui mini circular label </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentHost/status/@state='up'">green</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="$currentHost/status/@state" />
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:otherwise><div class="ui red circular label">down</div></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="address/@addr" />
|
||||
</td>
|
||||
<td>
|
||||
<b>
|
||||
<xsl:value-of select="substring-before(hostnames/hostname/@name, '.')" />
|
||||
</b>
|
||||
<xsl:if test="substring-after(hostnames/hostname/@name, '.')">
|
||||
<wbr />.<xsl:value-of select="substring-after(hostnames/hostname/@name, '.')" />
|
||||
</xsl:if>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="address[@addrtype='mac']/@vendor" />
|
||||
</td>
|
||||
<td>
|
||||
<xsl:apply-templates
|
||||
select="$initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')] | $currentHost/ports/port"
|
||||
mode="service">
|
||||
<xsl:with-param name="initHost" select="$initHost" />
|
||||
<xsl:with-param name="currentHost" select="$currentHost" />
|
||||
<xsl:with-param name="hostAddress" select="$hostAddress" />
|
||||
<xsl:with-param name="class" select="'ui mini label'" />
|
||||
<xsl:sort select="number(@portid)" order="ascending" />
|
||||
</xsl:apply-templates>
|
||||
</td>
|
||||
<td>
|
||||
<a class="ui mini icon teal icon button" target="_blank">
|
||||
<xsl:attribute name="href">scan.php?host=<xsl:value-of select="$hostAddress" /></xsl:attribute>
|
||||
<i class="search plus icon"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
version="1.1">
|
||||
|
||||
<xsl:template match="nmaprun" mode="nav">
|
||||
<nav class="ui inverted secondary menu">
|
||||
<h3>
|
||||
<a href="." class="button item logo">lan<svg class="logo" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 24 24" xml:space="preserve" width="40" height="40"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs id="defs206"></defs>
|
||||
<g id="g998" transform="matrix(0,0.04687491,-0.04687491,0,24,2.2682373e-5)">
|
||||
<g id="g147">
|
||||
<g id="g145">
|
||||
<path d="m 322.065,92.046 c -46.24,0 -83.851,37.619 -83.851,83.857 v 168.712 c 0,25.224 -21.148,45.745 -46.372,45.745 -25.224,0 -46.372,-20.521 -46.372,-45.745 V 199.464 h -38.114 v 145.151 c 0,46.24 38.246,83.859 84.486,83.859 46.24,0 84.486,-37.619 84.486,-83.859 V 175.903 c 0,-25.223 20.514,-45.743 45.737,-45.743 25.223,0 45.737,20.521 45.737,45.743 v 134.092 h 38.114 V 175.903 c 0,-46.239 -37.611,-83.857 -83.851,-83.857 z" id="path143"></path>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g153">
|
||||
<g id="g151">
|
||||
<path d="M 144.198,0 H 108.625 C 98.101,0 89.568,8.746 89.568,19.271 c 0,1.157 0.121,2.328 0.318,3.598 h 73.052 c 0.197,-1.27 0.318,-2.441 0.318,-3.598 C 163.256,8.746 154.723,0 144.198,0 Z" id="path149"></path>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g159">
|
||||
<g id="g157">
|
||||
<path d="m 420.183,486.591 h -71.731 c -0.626,2.541 -0.978,4.077 -0.978,6.176 0,10.525 8.532,19.234 19.057,19.234 h 35.573 c 10.525,0 19.057,-8.709 19.057,-19.234 0,-2.098 -0.352,-3.635 -0.978,-6.176 z" id="path155"></path>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g165">
|
||||
<g id="g163">
|
||||
<rect x="87.027" y="41.925999" width="80.040001" height="138.481" id="rect161"></rect>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g171">
|
||||
<g id="g169">
|
||||
<rect x="344.93301" y="329.052" width="80.040001" height="138.481" id="rect167"></rect>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g173"></g>
|
||||
<g id="g175"></g>
|
||||
<g id="g177"></g>
|
||||
<g id="g179"></g>
|
||||
<g id="g181"></g>
|
||||
<g id="g183"></g>
|
||||
<g id="g185"></g>
|
||||
<g id="g187"></g>
|
||||
<g id="g189"></g>
|
||||
<g id="g191"></g>
|
||||
<g id="g193"></g>
|
||||
<g id="g195"></g>
|
||||
<g id="g197"></g>
|
||||
<g id="g199"></g>
|
||||
<g id="g201"></g>
|
||||
</g>
|
||||
</svg>
|
||||
can</a>
|
||||
</h3>
|
||||
</nav>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
version="1.1">
|
||||
|
||||
<xsl:template match="port" mode="service">
|
||||
<xsl:param name="hostAddress"/>
|
||||
<xsl:param name="initHost"/>
|
||||
<xsl:param name="currentHost"/>
|
||||
<xsl:param name="class"/>
|
||||
<xsl:variable name="portid" select="@portid"/>
|
||||
<xsl:variable name="initPort" select="$initHost/ports/port[@portid=$portid]"/>
|
||||
<xsl:variable name="currentPort" select="$currentHost/ports/port[@portid=$portid]"/>
|
||||
|
||||
<a target="_blank">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="$class"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">dropdown button share-size</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">orange</xsl:when>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='open'">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='filtered'">orange</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:for-each select="$currentPort/script[@id='smb-shares-size']/table">
|
||||
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending"/>
|
||||
<xsl:if test="position()=1">
|
||||
<xsl:text>--free: </xsl:text>
|
||||
<xsl:value-of select="elem[@key='FreeSize']"/>
|
||||
<xsl:text>; --total: </xsl:text>
|
||||
<xsl:value-of select="elem[@key='TotalSize']"/>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:choose>
|
||||
<xsl:when test="service/@name='http' and service/@tunnel='ssl'">
|
||||
<xsl:text>https</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="service/@name"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>://</xsl:text>
|
||||
<xsl:value-of select="$hostAddress"/>
|
||||
<xsl:text>:</xsl:text>
|
||||
<xsl:value-of select="@portid"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="service/@name='ms-wbt-server'">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>rdp.php?v=</xsl:text>
|
||||
<xsl:value-of select="$hostAddress"/>
|
||||
<xsl:text>&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>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
version="1.1">
|
||||
|
||||
<xsl:template match="runstats">
|
||||
<xsl:param name="init"/>
|
||||
<script>
|
||||
<xsl:if test="finished/@summary">
|
||||
$.toast({
|
||||
title : '<xsl:value-of select="finished/@exit"/>',
|
||||
message : `<xsl:value-of select="finished/@summary"/>`,
|
||||
showIcon : 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
</xsl:if>
|
||||
<xsl:if test="finished/@errormsg">
|
||||
$.toast({
|
||||
title : '<xsl:value-of select="finished/@exit"/>',
|
||||
message : `<xsl:value-of select="finished/@errormsg"/>`,
|
||||
showIcon : 'exclamation triangle',
|
||||
class : 'error',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
</xsl:if>
|
||||
<xsl:if test="$init/runstats/finished">
|
||||
$.toast({
|
||||
message : 'Comparaison avec les résultats du ' + new Date("<xsl:value-of select="$init/runstats/finished/@timestr"/>").toLocaleString(),
|
||||
class : 'info',
|
||||
showIcon : 'calendar',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
</xsl:if>
|
||||
</script>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
$file = $argv[1];
|
||||
$site = basename($file, ".yml");
|
||||
$__DIR__ = __DIR__;
|
||||
|
||||
$conf = yaml_parse_file($file);
|
||||
|
||||
$xml = new DomDocument("1.0", "utf-8");
|
||||
$xml->preserveWhiteSpace = false;
|
||||
$xml->formatOutput = true;
|
||||
$xml->appendChild($xml->createProcessingInstruction("xml-stylesheet", "href='../results.xsl' type='text/xsl'"));
|
||||
$root = $xml->appendChild($xml->createElement("lanScan"));
|
||||
$root->setAttribute("scanpath", "./scans/$site.xml");
|
||||
|
||||
function appendArray($document, $node, $array) {
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $vkey => $vvalue) {
|
||||
if (is_string($vkey)) {
|
||||
if (is_array($vvalue)) {
|
||||
$child = $document->createElement($vkey);
|
||||
toXML($document, $child, $vvalue);
|
||||
} else {
|
||||
$child = $document->createElement($vkey, $vvalue);
|
||||
}
|
||||
$node->appendChild($child);
|
||||
} else {
|
||||
if (is_array($vvalue)) {
|
||||
$child = $document->createElement($key);
|
||||
appendArray($document, $child, $vvalue);
|
||||
} else {
|
||||
$child = $document->createElement($key, $vvalue);
|
||||
}
|
||||
$node->appendChild($child);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$node->setAttribute($key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
appendArray($xml, $root, $conf);
|
||||
|
||||
print $xml->saveXML();
|
||||
?>
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
version="1.1">
|
||||
<xsl:output method="text" encoding="UTF-8" indent="yes" />
|
||||
|
||||
<xsl:param name="network"/>
|
||||
|
||||
<xsl:template match="nmaprun">
|
||||
<xsl:text>---
|
||||
site: Nom du site
|
||||
|
||||
group:
|
||||
- name: Réseau </xsl:text><xsl:value-of select="$network"/><xsl:text>
|
||||
host:
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="host"/>
|
||||
<xsl:text>...</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="host">
|
||||
<xsl:text> - address: </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="hostnames/hostname/@name"><xsl:value-of select="hostnames/hostname/@name" /></xsl:when>
|
||||
<xsl:otherwise> <xsl:value-of select="address/@addr" /></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
service: [<xsl:apply-templates select="ports/port"/>]
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="port">
|
||||
<xsl:value-of select="service/@name" />
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
Reference in New Issue
Block a user