order
This commit is contained in:
@ -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="'), '?')" />
|
||||
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'), '?')" />
|
||||
<xsl:variable name="base" select="concat($stylesheetURL, '/../../')" />
|
||||
<xsl:variable name="name"
|
||||
select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'name='), '"')" />
|
||||
<xsl:variable name="name" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'name='), '"')" />
|
||||
|
||||
<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,8 +47,7 @@
|
||||
</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>
|
||||
@ -68,8 +63,7 @@
|
||||
</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,193 @@ 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>&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>&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'">
|
||||
<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: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: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>
|
Reference in New Issue
Block a user