Compare commits

...

8 Commits
v4 ... 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
1fbf09e666 Style stylesheet 2022-06-17 08:24:03 +02:00
f02a6a7afb Mise à jour de 'stylesheet.xsl' 2022-06-16 23:58:56 +02:00
fc0cde0e7e XSL stylesheet 2022-06-16 23:02:22 +02:00
f837c5d910 Initial commit 2021-09-29 14:40:34 +02:00
9 changed files with 506 additions and 219 deletions

11
LICENSE Normal file
View File

@ -0,0 +1,11 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -15,7 +15,7 @@ $PRESETS = [
"lanScan" => [
"-PS" => "microsoft-ds",
"-F" => true,
"-T" => 5,
"-T" => 4,
"--script" => "http-info,smb-shares-size",
"--stylesheet" => "lanTable.xsl",
],

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

View File

@ -112,7 +112,7 @@ if ($preset && isset($PRESETS[$preset])) {
], false);
}
$inputs['--stylesheet'] = "$BASEDIR/$STYLESHEETSDIR/{$inputs['--stylesheet']}?";
$inputs['--stylesheet'] = "$STYLESHEETSDIR/{$inputs['--stylesheet']}?";
if ($name) $inputs['--stylesheet'] .= "name=$name";
$options = "";

152
stylesheet.xsl Normal file
View File

@ -0,0 +1,152 @@
<?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="2.0">
<xsl:output method="html" encoding="UTF-8" />
<xsl:output indent="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="nmaprun">
<html lang="fr">
<head>
<meta charset="utf-8" />
<title><xsl:value-of select="./@args" /></title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
.btn {
margin: 2px;
padding: 2px 6px !important;
}
.badge {
margin: 0px;
padding: 2px 4px !important;
}
</style>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs5/jq-3.6.0/dt-1.12.1/b-2.2.3/b-html5-2.2.3/b-print-2.2.3/cr-1.5.6/fc-4.1.0/fh-3.2.3/r-2.3.0/rr-1.2.8/sc-2.0.6/datatables.min.css"/>
</head>
<body>
<table id="scanResults" class="table table-striped table-hover compact caption-top" style="width:100%">
<thead>
<tr>
<th>Adresse IP</th>
<th>Nom DNS</th>
<th>Services</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="host[status/@state='up']">
<tr>
<td>
<xsl:value-of select="address/@addr" />
</td>
<td>
<xsl:value-of select="hostnames/hostname/@name" />
</td>
<td>
<xsl:for-each select="ports/port[state/@state='open']">
<a target="_blank" style="text-transform:uppercase;" type="button" class="btn btn-success btn-sm">
<xsl:variable name="protocol">
<xsl:choose>
<xsl:when test="service/@name='http' or service/@name='https' or service/@name='http-alt' or @portid = 8006 or @portid = 9292 or @portid = 20618">
<xsl:choose>
<xsl:when test="service/@tunnel='ssl' or script[@id='ssl-cert'] or script[@id='ssl-date']">
<xsl:text>https://</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>http://</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="service/@name='ftp' or service/@name='ssh' or service/@name='telnet'">
<xsl:value-of select="service/@name" />
<xsl:text>://</xsl:text>
</xsl:when>
<xsl:when test="service/@name = 'microsoft-ds' or service/@name = 'netbios-ssn'">
<xsl:text>file://///</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$protocol != ''">
<xsl:attribute name="href">
<xsl:value-of select="$protocol" />
<xsl:choose>
<xsl:when test="count(../../hostnames/hostname) > 0">
<xsl:value-of select="../../hostnames/hostname/@name" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../../address/@addr" />
</xsl:otherwise>
</xsl:choose>
<xsl:text>:</xsl:text>
<xsl:value-of select="@portid"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">
btn btn-success btn-sm disabled
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="title">
<xsl:for-each select="service/@*">
<xsl:value-of select="concat(name(), ': ', ., ', ')"/>
</xsl:for-each>
</xsl:attribute>
<span class="badge bg-secondary rounded-pill"><xsl:value-of select="@portid"/></span>
<xsl:value-of select="service/@name" />
</a>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</tbody>
<caption>
<pre class="mb-0" style="white-space:pre-wrap; word-wrap:break-word;">
<xsl:value-of select="/nmaprun/@args" />
</pre>
<time>
<xsl:value-of select="/nmaprun/@startstr" />
</time> - <time>
<xsl:value-of select="/nmaprun/runstats/finished/@timestr" />
</time><br />
<small>
<xsl:value-of select="/nmaprun/@scanner" /> v
<xsl:value-of select="/nmaprun/@version" />
</small>
</caption>
</table>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous">
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs5/jq-3.6.0/dt-1.12.1/b-2.2.3/b-html5-2.2.3/b-print-2.2.3/cr-1.5.6/fc-4.1.0/fh-3.2.3/r-2.3.0/rr-1.2.8/sc-2.0.6/datatables.min.js"></script>
<script>
$(document).ready( function() {
$('#scanResults').DataTable({
fixedHeader: true,
lengthMenu: [
[256, 512, 1024, 2048, -1],
[256, 512, 1024, 2048, "All"]
],
scrollCollapse: true,
paging: false,
responsive: true,
});
} );
</script>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@ -249,11 +249,11 @@ $('.ui.dropdown').dropdown()
</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'">
<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'">
<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>

View File

@ -9,18 +9,14 @@
<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="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: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" />
<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">
@ -51,25 +47,23 @@
</xsl:choose>
</h1>
<table id="scanResultsTable" style="width:100%" role="grid"
class="ui sortable small compact stuck striped table">
<table id="scanResultsTable" style="width:100%" role="grid" class="ui sortable small compact stuck striped table">
<thead>
<tr>
<th style="width: min-content">État</th>
<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 style="width: min-content" title="Scan intensif">
<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: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>
@ -78,13 +72,13 @@
</main>
<footer class="ui footer inverted segment">Résultat de la commande :<br />
<code>
<xsl:value-of select="@args" />
</code>
</footer>
<code>
<xsl:value-of select="@args" />
</code>
</footer>
<script src="script.js"></script>
<script>
<script src="script.js"></script>
<script>
var table = $('#scanResultsTable').DataTable({
responsive: true,
colReorder: true,
@ -110,207 +104,194 @@ var table = $('#scanResultsTable').DataTable({
bottomEnd: 'paging',
bottom2Start: 'info',
},
order: [[0, 'asc'], [1, 'asc']]
})
table.order([1, 'asc']).draw()
$('.ui.dropdown').dropdown()
</script>
<xsl:apply-templates select="runstats">
<xsl:with-param name="init" select="$init" />
</xsl:apply-templates>
</script>
<xsl:apply-templates select="runstats">
<xsl:with-param name="init" select="$init" />
</xsl:apply-templates>
</body>
</body>
</html>
</xsl:template>
</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: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="hostnames/hostname/@name">
<xsl:value-of select="hostnames/hostname/@name" />
<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>
<xsl:value-of select="address/@addr" />
<div class="ui mini circular label red">down</div>
</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>
<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="$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 test="service/@name='http' and service/@tunnel='ssl'">
<xsl:text>https</xsl:text>
</xsl:when>
<xsl:otherwise>
<div class="ui mini circular label red">down</div>
<xsl:value-of select="service/@name" />
</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: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: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: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: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>

View File

@ -92,7 +92,7 @@ scanForm.onsubmit = function(event) {
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
position : 'bottom left',
})
}
}
@ -106,7 +106,7 @@ refreshLink.onclick = function(event) {
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
position : 'bottom left',
})
}
</xsl:if>

View File

@ -1,13 +1,11 @@
<?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: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">
<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',
@ -26,8 +24,8 @@ $.toast({
closeIcon : true,
position : 'bottom left',
})
</xsl:if>
<xsl:if test="finished/@errormsg">
</xsl:if>
<xsl:if test="finished/@errormsg">
$.toast({
title : '<xsl:value-of select="finished/@exit"/>',
message : `<xsl:value-of select="finished/@errormsg"/>`,
@ -37,8 +35,8 @@ $.toast({
closeIcon : true,
position : 'bottom left',
})
</xsl:if>
</script>
</xsl:template>
</xsl:if>
</script>
</xsl:template>
</xsl:stylesheet>