host scan stylesheet

This commit is contained in:
Adrien MALINGREY 2024-10-14 02:50:36 +02:00
parent ad79495608
commit 2f7eebdaf1
5 changed files with 307 additions and 327 deletions

View File

@ -10,6 +10,8 @@ $LANSCAN_OPTIONS = [
];
$HOSTSCAN_OPTIONS = [
'Pn' => true,
'F' => true,
'sV' => true,
'stylesheet' => "$BASEDIR/hostScan.xsl"
];

View File

@ -72,17 +72,17 @@
<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"/><g id="g998" transform="matrix(0,0.04687491,-0.04687491,0,24,2.2682373e-5)"><g id="g147"><g id="g145"><path d="m 322.065,92.046 c -46.24,0 -83.851,37.619 -83.851,83.857 v 168.712 c 0,25.224 -21.148,45.745 -46.372,45.745 -25.224,0 -46.372,-20.521 -46.372,-45.745 V 199.464 h -38.114 v 145.151 c 0,46.24 38.246,83.859 84.486,83.859 46.24,0 84.486,-37.619 84.486,-83.859 V 175.903 c 0,-25.223 20.514,-45.743 45.737,-45.743 25.223,0 45.737,20.521 45.737,45.743 v 134.092 h 38.114 V 175.903 c 0,-46.239 -37.611,-83.857 -83.851,-83.857 z" id="path143"/></g></g><g id="g153"><g id="g151"><path d="M 144.198,0 H 108.625 C 98.101,0 89.568,8.746 89.568,19.271 c 0,1.157 0.121,2.328 0.318,3.598 h 73.052 c 0.197,-1.27 0.318,-2.441 0.318,-3.598 C 163.256,8.746 154.723,0 144.198,0 Z" id="path149"/></g></g><g id="g159"><g id="g157"><path d="m 420.183,486.591 h -71.731 c -0.626,2.541 -0.978,4.077 -0.978,6.176 0,10.525 8.532,19.234 19.057,19.234 h 35.573 c 10.525,0 19.057,-8.709 19.057,-19.234 0,-2.098 -0.352,-3.635 -0.978,-6.176 z" id="path155"/></g></g><g id="g165"><g id="g163"><rect x="87.027" y="41.925999" width="80.040001" height="138.481" id="rect161"/></g></g><g id="g171"><g id="g169"><rect x="344.93301" y="329.052" width="80.040001" height="138.481" id="rect167"/></g></g><g id="g173"></g><g id="g175"></g><g id="g177"></g><g id="g179"></g><g id="g181"></g><g id="g183"></g><g id="g185"></g><g id="g187"></g><g id="g189"></g><g id="g191"></g><g id="g193"></g><g id="g195"></g><g id="g197"></g><g id="g199"></g><g id="g201"></g></g></svg>
<xsl:text>can</xsl:text>
</a>
<form class="right menu">
<form class="right menu" onsubmit="targetsInputDiv.classList.add('loading')">
<div class="ui category search item">
<div id="lanInputDiv" class="ui icon input">
<input class="prompt" type="text" id="lanInput" name="lan" oninput="hiddenInput.value=this.value" required=""
<div id="targetsInputDiv" class="ui icon input">
<input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value" required=""
pattern="[a-zA-Z0-9._\/ \-]+" value="{$targets}" placeholder="Scanner un réseau..."
title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
<i class="satellite dish icon"></i>
</div>
<input type="hidden" name="compareWith" value="{$nextCompareWith}"/>
<button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php" onsubmit="lanInputDiv.classList.add('loading')"></button>
<button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php"></button>
</div>
<div class="item">
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/options.php" onclick="targetsInput.required=false">
@ -90,9 +90,9 @@ Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
</button>
</div>
<div class="item">
<a class="ui teal icon button" href="{$refreshURL}">
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/scan.php" onclick="this.getElementsByTagName('i')[0].className = 'loading spinner icon'">
<i class="sync icon"></i>
</a>
</button>
</div>
<div class="item">
<a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank">
@ -103,22 +103,7 @@ Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
</nav>
<main class="ui main container">
<h1 class="ui header"><xsl:value-of select="$targets"/></h1>
<table id="scanResultsTable" style="width:100%" role="grid" class="ui sortable small table">
<thead>
<tr>
<th>Etat</th>
<th>Adresse IP</th>
<th>Nom</th>
<th class="ten wide">Services</th>
<th></th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]"/>
</tbody>
</table>
</main>
<footer class="ui footer segment">
@ -146,7 +131,6 @@ var table = $('#scanResultsTable').DataTable({
],
responsive: true,
})
table.order([1, 'asc']).draw()
$('.ui.dropdown').dropdown()
@ -155,7 +139,7 @@ $.toast({
title: '<xsl:value-of select="runstats/finished/@exit"/>',
message: '<xsl:value-of select="runstats/finished/@summary"/>',
showIcon: 'satellite dish',
displayTime: 'auto',
displayTime: 0,
closeIcon: true,
position: 'bottom right',
})
@ -166,7 +150,7 @@ $.toast({
message: '<xsl:value-of select="runstats/finished/@errormsg"/>',
showIcon: 'exclamation triangle',
class: 'error',
displayTime: 'auto',
displayTime: 0,
closeIcon: true,
position: 'bottom right',
})
@ -176,7 +160,7 @@ $.toast({
message: 'Comparaison avec les résultats du <xsl:value-of select="$init/runstats/finished/@timestr"/>',
class: 'info',
showIcon: 'calendar',
displayTime: 'auto',
displayTime: 0,
closeIcon: true,
position: 'bottom right',
})
@ -186,6 +170,138 @@ $.toast({
</html>
</xsl:template>
<xsl:template match="host">
<xsl:variable name="addr" select="address/@addr"/>
<xsl:variable name="initHost" select="$init/host[address/@addr=$addr]"/>
<xsl:variable name="currentHost" select="$current/host[address/@addr=$addr]"/>
<xsl:variable name="hostAddress">
<xsl:choose>
<xsl:when test="hostnames/hostname/@name">
<xsl:value-of select="hostnames/hostname/@name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="address/@addr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<h1 class="ui header">
<xsl:choose>
<xsl:when test="hostnames/hostname/@name">
<xsl:value-of select="hostnames/hostname/@name"/>
<div class="sub header"><xsl:value-of select="address/@addr"/></div>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="address/@addr"/>
</xsl:otherwise>
</xsl:choose>
</h1>
<table id="scanResultsTable" style="width:100%" role="grid" class="ui sortable small table">
<thead>
<tr>
<th>Etat</th>
<th>Protocole</th>
<th>Port</th>
<th>Service</th>
<th>Produit</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<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:sort select="@portid" order="ascending"/>
</xsl:apply-templates>
</tbody>
</table>
</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]"/>
<tr>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">negative</xsl:when>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">warning</xsl:when>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">positive</xsl:when>
<xsl:when test="$currentPort/state/@state='open'">positive</xsl:when>
<xsl:when test="$currentPort/state/@state='filtered'">warning</xsl:when>
<xsl:otherwise>negative</xsl:otherwise>
<xsl:when test="$currentHost/status/@state='up'">positive</xsl:when>
<xsl:otherwise>negative</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td>
<div>
<xsl:attribute name="class">
<xsl:text>ui mini circular label </xsl:text>
<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:value-of select="$currentPort/state/@state"/>
</div>
</td>
<td>
<xsl:value-of select="@protocol"/>
</td>
<td>
<xsl:value-of select="@portid"/>
</td>
<td>
<a>
<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:value-of select="service/@name"/>
</a>
</td>
<td>
<xsl:value-of select="service/@product"/>
</td>
<td>
<xsl:value-of select="service/@version"/>
</td>
</tr>
</xsl:template>
<xsl:template name="optionsList">
<xsl:param name="argList" select=""/>
<xsl:param name="asURL" select="false()"/>
@ -273,147 +389,4 @@ $.toast({
</xsl:choose>
</xsl:template>
<xsl:template match="host">
<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:choose>
<xsl:when test="$currentHost/status/@state='up'">ui green circular label</xsl:when>
<xsl:otherwise>ui red circular label</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="hostnames/hostname/@name"/></b>
</td>
<td>
<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:sort select="@portid" order="ascending"/>
</xsl:apply-templates>
</td>
<td>
<a class="ui right labeled tiny teal icon button" onclick="console.log(this);this.getElementsByTagName('i').className = 'loading spinner icon'">
<xsl:attribute name="href">
<xsl:value-of select="$basedir"/>
<xsl:text>/scan.php?host=</xsl:text>
<xsl:value-of select="$hostAddress"/>
</xsl:attribute>
<i class="satellite dish icon"></i>
Scanner
</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 class="ui label" target="_blank">
<xsl:attribute name="class">
<xsl:text>ui label </xsl:text>
<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 disabled</xsl:when>
<xsl:otherwise>red disabled</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table"> mini dropdown button share-size</xsl:when>
<xsl:otherwise> small</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
<xsl:attribute name="href">
<xsl:value-of select="service/@name"/>
<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:value-of select="service/@name"/>
<div class="detail">
<xsl:choose>
<xsl:when test="@protocol='udp'">U:</xsl:when>
<xsl:otherwise>:</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@portid"/>
</div>
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table">
<xsl:attribute name="style">
<xsl:for-each select="$currentHost/hostscript/script[@id='smb-shares-size']/table">
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending"/>
<xsl:if test="position()=1">
<xsl:text>--free: </xsl:text>
<xsl:value-of select="elem[@key='FreeSize']"/>
<xsl:text>; --total: </xsl:text>
<xsl:value-of select="elem[@key='TotalSize']"/>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
<i class="dropdown icon"></i>
<div class="menu">
<xsl:apply-templates select="$currentHost/hostscript/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>

View File

@ -23,16 +23,16 @@ include_once 'filter_inputs.php';
<a class="ui teal button item" href=".">
lan<?php include 'logo.svg'; ?>can
</a>
<form class="right menu">
<form class="right menu" onsubmit="targetsInputDiv.classList.add('loading')">
<div class="ui category search item">
<div id="lanInputDiv" class="ui icon input">
<input class="prompt" type="text" id="lanInput" name="lan" required
<div id="targetsInputDiv" class="ui icon input">
<input class="prompt" type="text" id="targetsInput" name="lan" required
pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $targets; ?>" placeholder="Scanner un réseau..."
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" />
<i class="satellite dish icon"></i>
</div>
<button style="display: none;" type="submit" formmethod="get" formaction="scan.php" onsubmit="lanInput.classList.add('loading')"></button>
<button style="display: none;" type="submit" formmethod="get" formaction="scan.php"></button>
</div>
<div class="item">
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="options.php" onclick="lanInput.required=false">

View File

@ -72,17 +72,21 @@
<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"/><g id="g998" transform="matrix(0,0.04687491,-0.04687491,0,24,2.2682373e-5)"><g id="g147"><g id="g145"><path d="m 322.065,92.046 c -46.24,0 -83.851,37.619 -83.851,83.857 v 168.712 c 0,25.224 -21.148,45.745 -46.372,45.745 -25.224,0 -46.372,-20.521 -46.372,-45.745 V 199.464 h -38.114 v 145.151 c 0,46.24 38.246,83.859 84.486,83.859 46.24,0 84.486,-37.619 84.486,-83.859 V 175.903 c 0,-25.223 20.514,-45.743 45.737,-45.743 25.223,0 45.737,20.521 45.737,45.743 v 134.092 h 38.114 V 175.903 c 0,-46.239 -37.611,-83.857 -83.851,-83.857 z" id="path143"/></g></g><g id="g153"><g id="g151"><path d="M 144.198,0 H 108.625 C 98.101,0 89.568,8.746 89.568,19.271 c 0,1.157 0.121,2.328 0.318,3.598 h 73.052 c 0.197,-1.27 0.318,-2.441 0.318,-3.598 C 163.256,8.746 154.723,0 144.198,0 Z" id="path149"/></g></g><g id="g159"><g id="g157"><path d="m 420.183,486.591 h -71.731 c -0.626,2.541 -0.978,4.077 -0.978,6.176 0,10.525 8.532,19.234 19.057,19.234 h 35.573 c 10.525,0 19.057,-8.709 19.057,-19.234 0,-2.098 -0.352,-3.635 -0.978,-6.176 z" id="path155"/></g></g><g id="g165"><g id="g163"><rect x="87.027" y="41.925999" width="80.040001" height="138.481" id="rect161"/></g></g><g id="g171"><g id="g169"><rect x="344.93301" y="329.052" width="80.040001" height="138.481" id="rect167"/></g></g><g id="g173"></g><g id="g175"></g><g id="g177"></g><g id="g179"></g><g id="g181"></g><g id="g183"></g><g id="g185"></g><g id="g187"></g><g id="g189"></g><g id="g191"></g><g id="g193"></g><g id="g195"></g><g id="g197"></g><g id="g199"></g><g id="g201"></g></g></svg>
<xsl:text>can</xsl:text>
</a>
<form class="right menu">
<form class="right menu" onsubmit="targetsInputDiv.classList.add('loading')">
<xsl:call-template name="optionsList">
<xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/>
<xsl:with-param name="asURL" select="false()"/>
</xsl:call-template>
<div class="ui category search item">
<div id="lanInputDiv" class="ui icon input">
<input class="prompt" type="text" id="lanInput" name="lan" oninput="hiddenInput.value=this.value" required=""
<div id="targetsInputDiv" class="ui icon input">
<input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value" required=""
pattern="[a-zA-Z0-9._\/ \-]+" value="{$targets}" placeholder="Scanner un réseau..."
title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
<i class="satellite dish icon"></i>
</div>
<input type="hidden" name="compareWith" value="{$nextCompareWith}"/>
<button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php" onsubmit="lanInputDiv.classList.add('loading')"></button>
<button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php"></button>
</div>
<div class="item">
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/options.php" onclick="targetsInput.required=false">
@ -90,9 +94,9 @@ Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
</button>
</div>
<div class="item">
<a class="ui teal icon button" href="{$refreshURL}">
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/scan.php" onclick="this.getElementsByTagName('i')[0].className = 'loading spinner icon'">
<i class="sync icon"></i>
</a>
</button>
</div>
<div class="item">
<a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank">
@ -112,7 +116,7 @@ Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
<th>Adresse IP</th>
<th>Nom</th>
<th class="ten wide">Services</th>
<th></th>
<th>Scanner</th>
</tr>
</thead>
<tbody>
@ -155,7 +159,7 @@ $.toast({
title: '<xsl:value-of select="runstats/finished/@exit"/>',
message: '<xsl:value-of select="runstats/finished/@summary"/>',
showIcon: 'satellite dish',
displayTime: 'auto',
displayTime: 0,
closeIcon: true,
position: 'bottom right',
})
@ -166,7 +170,7 @@ $.toast({
message: '<xsl:value-of select="runstats/finished/@errormsg"/>',
showIcon: 'exclamation triangle',
class: 'error',
displayTime: 'auto',
displayTime: 0,
closeIcon: true,
position: 'bottom right',
})
@ -176,7 +180,7 @@ $.toast({
message: 'Comparaison avec les résultats du <xsl:value-of select="$init/runstats/finished/@timestr"/>',
class: 'info',
showIcon: 'calendar',
displayTime: 'auto',
displayTime: 0,
closeIcon: true,
position: 'bottom right',
})
@ -186,6 +190,150 @@ $.toast({
</html>
</xsl:template>
<xsl:template match="host">
<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="hostnames/hostname/@name"/></b>
</td>
<td>
<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:sort select="@portid" order="ascending"/>
</xsl:apply-templates>
</td>
<td>
<a class="ui right labeled mini teal icon button" onclick="this.getElementsByTagName('i')[0].className = 'loading spinner icon'">
<xsl:attribute name="href">
<xsl:value-of select="$basedir"/>
<xsl:text>/scan.php?host=</xsl:text>
<xsl:value-of select="$hostAddress"/>
</xsl:attribute>
<i class="satellite dish icon"></i>
<xsl:text>Scanner</xsl:text>
</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 class="ui label" target="_blank">
<xsl:attribute name="class">
<xsl:text>ui label </xsl:text>
<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 disabled</xsl:when>
<xsl:otherwise>red disabled</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table"> mini dropdown button share-size</xsl:when>
<xsl:otherwise> small</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
<xsl:attribute name="href">
<xsl:value-of select="service/@name"/>
<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:value-of select="service/@name"/>
<div class="detail">
<xsl:choose>
<xsl:when test="@protocol='udp'">U:</xsl:when>
<xsl:otherwise>:</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@portid"/>
</div>
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table">
<xsl:attribute name="style">
<xsl:for-each select="$currentHost/hostscript/script[@id='smb-shares-size']/table">
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending"/>
<xsl:if test="position()=1">
<xsl:text>--free: </xsl:text>
<xsl:value-of select="elem[@key='FreeSize']"/>
<xsl:text>; --total: </xsl:text>
<xsl:value-of select="elem[@key='TotalSize']"/>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
<i class="dropdown icon"></i>
<div class="menu">
<xsl:apply-templates select="$currentHost/hostscript/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 name="optionsList">
<xsl:param name="argList" select=""/>
<xsl:param name="asURL" select="false()"/>
@ -273,147 +421,4 @@ $.toast({
</xsl:choose>
</xsl:template>
<xsl:template match="host">
<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:choose>
<xsl:when test="$currentHost/status/@state='up'">ui green circular label</xsl:when>
<xsl:otherwise>ui red circular label</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="hostnames/hostname/@name"/></b>
</td>
<td>
<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:sort select="@portid" order="ascending"/>
</xsl:apply-templates>
</td>
<td>
<a class="ui right labeled tiny teal icon button" onclick="console.log(this);this.getElementsByTagName('i').className = 'loading spinner icon'">
<xsl:attribute name="href">
<xsl:value-of select="$basedir"/>
<xsl:text>/scan.php?host=</xsl:text>
<xsl:value-of select="$hostAddress"/>
</xsl:attribute>
<i class="satellite dish icon"></i>
Scanner
</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 class="ui label" target="_blank">
<xsl:attribute name="class">
<xsl:text>ui label </xsl:text>
<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 disabled</xsl:when>
<xsl:otherwise>red disabled</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table"> mini dropdown button share-size</xsl:when>
<xsl:otherwise> small</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
<xsl:attribute name="href">
<xsl:value-of select="service/@name"/>
<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:value-of select="service/@name"/>
<div class="detail">
<xsl:choose>
<xsl:when test="@protocol='udp'">U:</xsl:when>
<xsl:otherwise>:</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@portid"/>
</div>
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table">
<xsl:attribute name="style">
<xsl:for-each select="$currentHost/hostscript/script[@id='smb-shares-size']/table">
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending"/>
<xsl:if test="position()=1">
<xsl:text>--free: </xsl:text>
<xsl:value-of select="elem[@key='FreeSize']"/>
<xsl:text>; --total: </xsl:text>
<xsl:value-of select="elem[@key='TotalSize']"/>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
<i class="dropdown icon"></i>
<div class="menu">
<xsl:apply-templates select="$currentHost/hostscript/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>

View File

@ -41,7 +41,7 @@ include_once 'filter_inputs.php';
<label for="targetsInput" title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254">Cibles</label>
<input id="targetsInput" type="text" name="targets" placeholder="Cibles" required
pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $lan; ?>" list="targetsList"
pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $targets ?? $lan ?? $host; ?>" list="targetsList"
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>