little fixes

This commit is contained in:
2025-02-06 16:56:46 +01:00
parent f0485f6abd
commit 215422cd61
11 changed files with 154 additions and 1186 deletions

View File

@ -2,23 +2,27 @@
<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:import href="lib/head.xsl" />
<xsl:import href="lib/nav.xsl" />
<xsl:import href="lib/services.xsl" />
<xsl:import href="lib/toast.xsl" />
<xsl:output method="html" encoding="UTF-8" />
<xsl:output indent="yes" />
<xsl:strip-space elements='*' />
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')" />
<xsl:variable name="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="targets" 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">
@ -29,10 +33,12 @@
<body>
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="name" select="$name" />
</xsl:apply-templates>
<main class="ui main container inverted segment">
<xsl:apply-templates select="$current/host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
<xsl: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>
@ -54,9 +60,12 @@ $('.ui.dropdown').dropdown()
<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="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">
@ -86,7 +95,8 @@ $('.ui.dropdown').dropdown()
</xsl:choose>
</h1>
<table class="ui inverted table" style="width: max-content">
<table
class="ui inverted table" style="width: max-content">
<thead>
<tr>
<xsl:if test="address[@addrtype='ipv4']/@addr">
@ -146,7 +156,8 @@ $('.ui.dropdown').dropdown()
</tbody>
</table>
<xsl:if test="hostscript/script">
<xsl:if
test="hostscript/script">
<div class="ui inverted tree accordion">
<div class="title">
<i class="dropdown icon"></i> Informations supplémentaires </div>
@ -156,26 +167,32 @@ $('.ui.dropdown').dropdown()
</div>
</xsl:if>
<h2 class="ui header">Services</h2>
<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: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:apply-templates select="trace" />
<xsl:apply-templates
select="trace" />
</xsl:template>
<xsl:template match="port">
<xsl:param name="hostAddress" />
<xsl:param name="initHost" />
<xsl:param name="currentHost" />
<xsl:variable name="portid" select="@portid" />
<xsl:variable name="initPort" select="$initHost/ports/port[@portid=$portid]" />
<xsl:variable name="currentPort" select="$currentHost/ports/port[@portid=$portid]" />
<xsl:variable
name="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>
@ -187,7 +204,8 @@ $('.ui.dropdown').dropdown()
</xsl:choose>
</xsl:variable>
<div class="ui inverted card {$color}">
<div
class="ui inverted card {$color}">
<div class="content">
<div class="header">
<div class="ui {$color} ribbon label">
@ -236,7 +254,8 @@ $('.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'">
<a class="ui {$color} button" target="_blank">
<xsl:attribute name="href">
<xsl:choose>
@ -244,7 +263,8 @@ $('.ui.dropdown').dropdown()
<xsl:text>rdp.php?v=</xsl:text>
<xsl:value-of select="$hostAddress" />
<xsl:text>&amp;p=</xsl:text>
<xsl:value-of select="@portid" />
<xsl:value-of
select="@portid" />
</xsl:when>
<xsl:otherwise>
<xsl:choose>
@ -256,7 +276,8 @@ $('.ui.dropdown').dropdown()
</xsl:otherwise>
</xsl:choose>
<xsl:text>://</xsl:text>
<xsl:value-of select="$hostAddress" />
<xsl:value-of
select="$hostAddress" />
<xsl:text>:</xsl:text>
<xsl:value-of select="@portid" />
</xsl:otherwise>
@ -271,11 +292,13 @@ $('.ui.dropdown').dropdown()
<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: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:value-of
select="elem[@key='TotalSize']" />
</xsl:if>
</xsl:for-each>
</xsl:attribute>
@ -309,7 +332,8 @@ $('.ui.dropdown').dropdown()
</tbody>
</table>
</xsl:if>
<xsl:apply-templates select="table" />
<xsl:apply-templates
select="table" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@output" />
@ -362,7 +386,9 @@ $('.ui.dropdown').dropdown()
<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']}">
<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>
@ -391,10 +417,17 @@ $('.ui.dropdown').dropdown()
<xsl:value-of select="@ttl" />
</td>
<td>
<xsl:value-of select="@host" />
<xsl:text> (</xsl:text>
<xsl:value-of select="@ipaddr" />
<xsl:text>)</xsl:text>
<xsl:choose>
<xsl:when test="@host">
<xsl:value-of select="@host" />
<xsl:text> (</xsl:text>
<xsl:value-of select="@ipaddr" />
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@ipaddr" />
</xsl:otherwise>
</xsl:choose>
</td>
<td>
<xsl:value-of select="@rtt" />

View File

@ -2,22 +2,26 @@
<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:import href="lib/head.xsl" />
<xsl:import href="lib/nav.xsl" />
<xsl:import href="lib/services.xsl" />
<xsl:import href="lib/toast.xsl" />
<xsl:output method="html" encoding="UTF-8" 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="targets" 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">
@ -28,13 +32,14 @@
<body>
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="name" select="$name" />
</xsl:apply-templates>
<main class="ui main container inverted segment">
<h1 class="ui header">
<xsl:choose>
<xsl:when test="$name">
<xsl:value-of select="$name" />
<xsl:value-of select="$name" disable-output-escaping="yes" />
<div class="sub header">
<xsl:value-of select="$targets" />
</div>
@ -45,7 +50,8 @@
</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-width">Etat</th>
@ -59,7 +65,8 @@
</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>
@ -95,9 +102,12 @@ $('.ui.dropdown').dropdown()
<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="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">
@ -144,14 +154,17 @@ $('.ui.dropdown').dropdown()
<xsl:if test="substring-after(hostnames/hostname/@name, '.')">
<wbr />
<xsl:text>.</xsl:text>
<xsl:value-of select="substring-after(hostnames/hostname/@name, '.')" />
<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="ports/port | $initHost/ports/port[not(state/@state='closed')][not(@portid=$currentHost/ports/port/@portid)]" mode="service">
<xsl:apply-templates
select="ports/port | $initHost/ports/port[not(state/@state='closed')][not(@portid=$currentHost/ports/port/@portid)]"
mode="service">
<xsl:with-param name="initHost" select="$initHost" />
<xsl:with-param name="currentHost" select="$currentHost" />
<xsl:with-param name="hostAddress" select="$hostAddress" />

File diff suppressed because it is too large Load Diff