toggle dark thme

This commit is contained in:
Adrien MALINGREY 2025-02-07 02:15:25 +01:00
parent cdf7e38604
commit b59c617a8d
7 changed files with 727 additions and 758 deletions

View File

@ -15,7 +15,7 @@
background-size: cover; background-size: cover;
} }
body > .grid { body>.grid {
height: 100%; height: 100%;
} }
@ -34,7 +34,7 @@
</style> </style>
</head> </head>
<body> <body class="inverted">
<div class="ui middle aligned center aligned inverted grid"> <div class="ui middle aligned center aligned inverted grid">
<div class="column" style="max-width: 450px;"> <div class="column" style="max-width: 450px;">
@ -51,7 +51,7 @@
<?php } ?> <?php } ?>
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get"> <form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
<div class="ui left aligned stacked segment inverted"> <div class="ui left aligned raised segment inverted">
<h4 class="ui header">Découvrir ou superviser un réseau</h4> <h4 class="ui header">Découvrir ou superviser un réseau</h4>
<div class="inverted field"> <div class="inverted field">
<div class="ui large input"> <div class="ui large input">
@ -63,8 +63,8 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<div class="field"> <div class="field">
<label for="nameInput">Enregistrer sous le nom (optionnel)</label> <label for="nameInput">Enregistrer sous le nom (optionnel)</label>
<div class="ui small input"> <div class="ui small input">
<input id="nameInput" type="text" name="name" placeholder="Reseau local" <input id="nameInput" type="text" name="name" placeholder="Reseau local" pattern='[0-9a-zA-Z\-_\. ]+'
pattern='[0-9a-zA-Z\-_\. ]+' title="Caractères autorisés: a-z A-Z 0-9 - _ ."/> title="Caractères autorisés: a-z A-Z 0-9 - _ ." />
</div> </div>
</div> </div>
<div class="ui error message"></div> <div class="ui error message"></div>
@ -77,7 +77,7 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
</form> </form>
<?php if (file_exists($SCANSDIR)) { ?> <?php if (file_exists($SCANSDIR)) { ?>
<div class="ui left aligned stacked segment inverted"> <div class="ui left aligned raised segment inverted">
<div class="ui inverted accordion"> <div class="ui inverted accordion">
<div class="title"><i class="dropdown icon"></i></i>Scans enregistrés</div> <div class="title"><i class="dropdown icon"></i></i>Scans enregistrés</div>
<div class="content"> <div class="content">
@ -108,39 +108,39 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <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 src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
<script> <script>
$('.ui.accordion').accordion() $('.ui.accordion').accordion()
scanForm.onsubmit = function (event) { scanForm.onsubmit = function (event) {
if (this.checkValidity()) { if (this.checkValidity()) {
scanForm.classList.add("loading") scanForm.classList.add("loading")
$.toast({ $.toast({
title: 'Scan en cours...', title: 'Scan en cours...',
message: 'Merci de patienter', message: 'Merci de patienter',
class: 'info', class: 'info',
showIcon: 'satellite dish', showIcon: 'satellite dish',
displayTime: 0, displayTime: 0,
closeIcon: true, closeIcon: true,
position: 'bottom right', position: 'bottom right',
}) })
return true return true
} else { } else {
event.preventDefault() event.preventDefault()
this.reportValidity() this.reportValidity()
} }
} }
function rescan(link) { function rescan(link) {
link.getElementsByTagName('i')[0].className = 'loading spinner icon' link.getElementsByTagName('i')[0].className = 'loading spinner icon'
$.toast({ $.toast({
title : 'Scan en cours...', title: 'Scan en cours...',
message : 'Merci de patienter', message: 'Merci de patienter',
class : 'info', class: 'info',
showIcon : 'satellite dish', showIcon: 'satellite dish',
displayTime: 0, displayTime: 0,
closeIcon : true, closeIcon: true,
position : 'bottom right', position: 'bottom right',
}) })
} }
</script> </script>
</body> </body>

View File

@ -24,7 +24,7 @@
</style> </style>
</head> </head>
<body> <body class="inverted">
<div class="ui middle aligned center aligned inverted grid"> <div class="ui middle aligned center aligned inverted grid">
<div class="column" style="max-width: 450px;"> <div class="column" style="max-width: 450px;">

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
body { body.inverted {
background-color: #1b1c1d; background-color: #1b1c1d;
} }

View File

@ -11,18 +11,14 @@
<xsl:output indent="yes" /> <xsl:output indent="yes" />
<xsl:strip-space elements='*' /> <xsl:strip-space elements='*' />
<xsl:variable name="stylesheetURL" <xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')" />
select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')" />
<xsl:variable name="base" select="concat($stylesheetURL, '/../../')" /> <xsl:variable name="base" select="concat($stylesheetURL, '/../../')" />
<xsl:variable name="name" <xsl:variable name="name" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'name='), '&quot;')" />
select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'name='), '&quot;')" />
<xsl:template match="nmaprun"> <xsl:template match="nmaprun">
<xsl:variable name="targets" select="substring-after(@args, '-oX - ')" /> <xsl:variable name="targets" select="substring-after(@args, '-oX - ')" />
<xsl:variable <xsl:variable name="current" select="." />
name="current" select="." /> <xsl:variable name="init" select="document(concat($base, 'scans/', $name, '.xml'))/nmaprun" />
<xsl:variable name="init"
select="document(concat($base, 'scans/', $name, '.xml'))/nmaprun" />
<html lang="fr"> <html lang="fr">
<xsl:apply-templates select="." mode="head"> <xsl:apply-templates select="." mode="head">
@ -31,14 +27,13 @@
<xsl:with-param name="targets" select="$targets" /> <xsl:with-param name="targets" select="$targets" />
</xsl:apply-templates> </xsl:apply-templates>
<body> <body class="inverted">
<xsl:apply-templates select="." mode="nav"> <xsl:apply-templates select="." mode="nav">
<xsl:with-param name="name" select="$name" /> <xsl:with-param name="name" select="$name" />
</xsl:apply-templates> </xsl:apply-templates>
<main class="ui main container inverted segment"> <main class="ui main container inverted segment">
<xsl:apply-templates <xsl:apply-templates select="$current/host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
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="init" select="$init" />
<xsl:with-param name="current" select="$current" /> <xsl:with-param name="current" select="$current" />
</xsl:apply-templates> </xsl:apply-templates>
@ -60,12 +55,9 @@ $('.ui.dropdown').dropdown()
<xsl:template match="host"> <xsl:template match="host">
<xsl:param name="init" /> <xsl:param name="init" />
<xsl:param name="current" /> <xsl:param name="current" />
<xsl:variable name="addr" <xsl:variable name="addr" select="address/@addr" />
select="address/@addr" /> <xsl:variable name="initHost" select="$init/host[address/@addr=$addr]" />
<xsl:variable name="initHost" <xsl:variable name="currentHost" select="$current/host[address/@addr=$addr]" />
select="$init/host[address/@addr=$addr]" />
<xsl:variable name="currentHost"
select="$current/host[address/@addr=$addr]" />
<xsl:variable name="hostAddress"> <xsl:variable name="hostAddress">
<xsl:choose> <xsl:choose>
<xsl:when test="hostnames/hostname/@name"> <xsl:when test="hostnames/hostname/@name">
@ -77,12 +69,11 @@ $('.ui.dropdown').dropdown()
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<h1 <h1 class="ui header">
class="ui header">
<div> <div>
<xsl:attribute name="class"> <xsl:attribute name="class">
<xsl:text>ui horizontal label </xsl:text> <xsl:text>ui horizontal label </xsl:text>
<xsl:choose> <xsl:choose>
<xsl:when test="$currentHost/status/@state='up'">green</xsl:when> <xsl:when test="$currentHost/status/@state='up'">green</xsl:when>
<xsl:otherwise>red</xsl:otherwise> <xsl:otherwise>red</xsl:otherwise>
</xsl:choose> </xsl:choose>
@ -99,8 +90,7 @@ $('.ui.dropdown').dropdown()
</xsl:choose> </xsl:choose>
</h1> </h1>
<table <table class="ui inverted table" style="width: max-content">
class="ui inverted table" style="width: max-content">
<thead> <thead>
<tr> <tr>
<xsl:if test="address[@addrtype='ipv4']/@addr"> <xsl:if test="address[@addrtype='ipv4']/@addr">
@ -160,8 +150,7 @@ $('.ui.dropdown').dropdown()
</tbody> </tbody>
</table> </table>
<xsl:if <xsl:if test="hostscript/script">
test="hostscript/script">
<div class="ui inverted tree accordion"> <div class="ui inverted tree accordion">
<div class="title"> <div class="title">
<i class="dropdown icon"></i> Informations supplémentaires </div> <i class="dropdown icon"></i> Informations supplémentaires </div>
@ -171,32 +160,26 @@ $('.ui.dropdown').dropdown()
</div> </div>
</xsl:if> </xsl:if>
<h2 <h2 class="ui header">Services</h2>
class="ui header">Services</h2>
<div class="ui cards"> <div class="ui cards">
<xsl:apply-templates <xsl:apply-templates select="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]">
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="initHost" select="$initHost" />
<xsl:with-param name="currentHost" select="$currentHost" /> <xsl:with-param name="currentHost" select="$currentHost" />
<xsl:with-param name="hostAddress" select="$hostAddress" /> <xsl:with-param name="hostAddress" select="$hostAddress" />
</xsl:apply-templates> </xsl:apply-templates>
</div> </div>
<xsl:apply-templates <xsl:apply-templates select="trace" />
select="trace" />
</xsl:template> </xsl:template>
<xsl:template match="port"> <xsl:template match="port">
<xsl:param name="hostAddress" /> <xsl:param name="hostAddress" />
<xsl:param name="initHost" /> <xsl:param name="initHost" />
<xsl:param name="currentHost" /> <xsl:param name="currentHost" />
<xsl:variable <xsl:variable name="portid" select="@portid" />
name="portid" select="@portid" /> <xsl:variable name="initPort" select="$initHost/ports/port[@portid=$portid]" />
<xsl:variable name="initPort" <xsl:variable name="currentPort" select="$currentHost/ports/port[@portid=$portid]" />
select="$initHost/ports/port[@portid=$portid]" />
<xsl:variable name="currentPort"
select="$currentHost/ports/port[@portid=$portid]" />
<xsl:variable name="color"> <xsl:variable name="color">
<xsl:choose> <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']>=500">red</xsl:when>
@ -208,8 +191,7 @@ $('.ui.dropdown').dropdown()
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<div <div class="ui inverted card {$color}">
class="ui inverted card {$color}">
<div class="content"> <div class="content">
<div class="header"> <div class="header">
<div class="ui {$color} ribbon label"> <div class="ui {$color} ribbon label">
@ -257,8 +239,7 @@ $('.ui.dropdown').dropdown()
</div> </div>
</div> </div>
</div> </div>
<xsl:if <xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https' or service/@name='ms-wbt-server'">
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"> <a class="ui {$color} button" target="_blank">
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:choose> <xsl:choose>
@ -266,8 +247,7 @@ $('.ui.dropdown').dropdown()
<xsl:text>rdp.php?v=</xsl:text> <xsl:text>rdp.php?v=</xsl:text>
<xsl:value-of select="$hostAddress" /> <xsl:value-of select="$hostAddress" />
<xsl:text>&amp;p=</xsl:text> <xsl:text>&amp;p=</xsl:text>
<xsl:value-of <xsl:value-of select="@portid" />
select="@portid" />
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:choose> <xsl:choose>
@ -279,8 +259,7 @@ $('.ui.dropdown').dropdown()
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:text>://</xsl:text> <xsl:text>://</xsl:text>
<xsl:value-of <xsl:value-of select="$hostAddress" />
select="$hostAddress" />
<xsl:text>:</xsl:text> <xsl:text>:</xsl:text>
<xsl:value-of select="@portid" /> <xsl:value-of select="@portid" />
</xsl:otherwise> </xsl:otherwise>
@ -295,13 +274,11 @@ $('.ui.dropdown').dropdown()
<xsl:attribute name="style"> <xsl:attribute name="style">
<xsl:for-each select="$currentPort/script[@id='smb-shares-size']/table"> <xsl:for-each select="$currentPort/script[@id='smb-shares-size']/table">
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending" /> <xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending" />
<xsl:if <xsl:if test="position()=1">
test="position()=1">
<xsl:text>--free: </xsl:text> <xsl:text>--free: </xsl:text>
<xsl:value-of select="elem[@key='FreeSize']" /> <xsl:value-of select="elem[@key='FreeSize']" />
<xsl:text>; --total: </xsl:text> <xsl:text>; --total: </xsl:text>
<xsl:value-of <xsl:value-of select="elem[@key='TotalSize']" />
select="elem[@key='TotalSize']" />
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
</xsl:attribute> </xsl:attribute>
@ -335,8 +312,7 @@ $('.ui.dropdown').dropdown()
</tbody> </tbody>
</table> </table>
</xsl:if> </xsl:if>
<xsl:apply-templates <xsl:apply-templates select="table" />
select="table" />
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="@output" /> <xsl:value-of select="@output" />
@ -389,9 +365,7 @@ $('.ui.dropdown').dropdown()
<xsl:template match="table"> <xsl:template match="table">
<xsl:param name="hostAddress" /> <xsl:param name="hostAddress" />
<a class="item share-size" <a class="item share-size" href="file://///{$hostAddress}/{@key}" target="_blank" rel="noopener noreferrer" style="--free: {elem[@key='FreeSize']}; --total: {elem[@key='TotalSize']}">
href="file://///{$hostAddress}/{@key}" target="_blank" rel="noopener noreferrer"
style="--free: {elem[@key='FreeSize']}; --total: {elem[@key='TotalSize']}">
<xsl:value-of select="@key" /> <xsl:value-of select="@key" />
</a> </a>
</xsl:template> </xsl:template>

View File

@ -26,12 +26,12 @@
<xsl:with-param name="targets" select="$targets" /> <xsl:with-param name="targets" select="$targets" />
</xsl:apply-templates> </xsl:apply-templates>
<body> <body class="inverted">
<xsl:apply-templates select="." mode="nav"> <xsl:apply-templates select="." mode="nav">
<xsl:with-param name="name" select="$name" /> <xsl:with-param name="name" select="$name" />
</xsl:apply-templates> </xsl:apply-templates>
<main class="ui main container inverted segment"> <main class="ui main container inverted vertical segment">
<h1 class="ui header"> <h1 class="ui header">
<xsl:choose> <xsl:choose>
<xsl:when test="$name"> <xsl:when test="$name">

View File

@ -55,25 +55,39 @@
</svg> </svg>
can</a> can</a>
<div class="right menu"> <div class="right menu">
<form class="ui right aligned category search item" id="scanForm" action="scan.php" method="get"> <div class="ui right aligned category search item">
<div class="ui inverted icon input" id="targetsInputDiv"> <form id="scanForm" action="scan.php" method="get">
<input name="lan" class="prompt" type="text" placeholder="Scanner un réseau" pattern="[a-zA-Z0-9._\/ \-]+" title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc. <div class="ui inverted icon input" id="targetsInputDiv">
<input name="lan" class="prompt" type="text" placeholder="Scanner un réseau" pattern="[a-zA-Z0-9._\/ \-]+" 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" /> Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254" />
<i class="satellite dish icon"></i> <i class="satellite dish icon"></i>
</div> </div>
<a class="button item" href="options.php" title="Options avancées"> </form>
<a class="ui icon button item" href="options.php" title="Options avancées">
<i class="settings icon"></i> <i class="settings icon"></i>
</a> </a>
<xsl:if test="$name"> <xsl:if test="$name">
<a class="button item" id="refreshLink" href="rescan.php?name={$name}" title="Actualiser"> <a class="ui icon button item" id="refreshLink" href="rescan.php?name={$name}" title="Actualiser">
<i class='sync icon'></i> <i class='sync icon'></i>
</a> </a>
</xsl:if> </xsl:if>
</form> <button id="toggleThemeButton" type="button" class="ui icon link item" title="Thème clair/sombre">
<i class="sun icon"></i>
</button>
</div>
</div> </div>
</nav> </nav>
<script> <script>
toggleThemeButton.onclick = function(event) {
if (document.body.classList.contains('inverted')) {
$(".inverted").addClass("light").removeClass("inverted")
$("#toggleThemeButton i").addClass("moon").removeClass("sun")
} else {
$(".light").addClass("inverted").removeClass("light")
$("#toggleThemeButton i").addClass("sun").removeClass("moon")
}
}
scanForm.onsubmit = function(event) { scanForm.onsubmit = function(event) {
if (scanForm.checkValidity()) { if (scanForm.checkValidity()) {
targetsInputDiv.classList.add('loading') targetsInputDiv.classList.add('loading')
@ -88,7 +102,7 @@ scanForm.onsubmit = function(event) {
}) })
} }
} }
<xsl:if test="$name"> <xsl:if test="$name">
refreshLink.onclick = function(event) { refreshLink.onclick = function(event) {
refreshLink.getElementsByTagName('i')[0].className = 'loading spinner icon' refreshLink.getElementsByTagName('i')[0].className = 'loading spinner icon'
$.toast({ $.toast({
@ -101,7 +115,7 @@ refreshLink.onclick = function(event) {
position : 'bottom right', position : 'bottom right',
}) })
} }
</xsl:if> </xsl:if>
</script> </script>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>