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;
}
body > .grid {
body>.grid {
height: 100%;
}
@ -34,7 +34,7 @@
</style>
</head>
<body>
<body class="inverted">
<div class="ui middle aligned center aligned inverted grid">
<div class="column" style="max-width: 450px;">
@ -51,7 +51,7 @@
<?php } ?>
<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>
<div class="inverted field">
<div class="ui large input">
@ -63,8 +63,8 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<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 - _ ."/>
<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>
@ -77,7 +77,7 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
</form>
<?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="title"><i class="dropdown icon"></i></i>Scans enregistrés</div>
<div class="content">
@ -108,9 +108,9 @@ 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://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
<script>
$('.ui.accordion').accordion()
$('.ui.accordion').accordion()
scanForm.onsubmit = function (event) {
scanForm.onsubmit = function (event) {
if (this.checkValidity()) {
scanForm.classList.add("loading")
$.toast({
@ -127,20 +127,20 @@ scanForm.onsubmit = function (event) {
event.preventDefault()
this.reportValidity()
}
}
}
function rescan(link) {
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',
title: 'Scan en cours...',
message: 'Merci de patienter',
class: 'info',
showIcon: 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
closeIcon: true,
position: 'bottom right',
})
}
}
</script>
</body>

View File

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

View File

@ -3,7 +3,7 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<head>
<meta charset="utf-8" />
<title>lanScan</title>
<link rel="icon" href="favicon.ico" />
@ -15,16 +15,19 @@
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.polyfills.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
</head>
<body>
<body class="inverted">
<nav class="ui inverted secondary menu">
<a href="." class="ui header button item logo">lan<?php include 'logo.svg'; ?>can</a>
<div class="right menu">
<div class="item">
<a class="button item" href="https://nmap.org/man/fr/index.html" target="_blank">
<a class="ui icon button item" href="https://nmap.org/man/fr/index.html" target="_blank">
<i class="question circle icon"></i>
</a>
<button id="toggleThemeButton" type="button" class="ui icon link item" title="Thème clair/sombre">
<i class="sun icon"></i>
</button>
</div>
</div>
</nav>
@ -450,15 +453,9 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<select id="minRTTUnit" class="ui clearable dropdown label"
oninput="minRTTHidden.value = minRTTNumber.value? minRTTNumber.value+minRTTUnit.value: ''">
<option value="">ms</option>
<option value="s"
secondes
</option>
<option value="m"
minutes
</option>
<option value="h"
heures
</option>
<option value="s" secondes </option>
<option value="m" minutes </option>
<option value="h" heures </option>
</select>
</div>
<input id="minRTTHidden" type="hidden" name="--min-rtt-timeout">
@ -471,15 +468,9 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<select id="maxRTTUnit" class="ui clearable dropdown label"
oninput="maxRTTHidden.value = maxRTTNumber.value? maxRTTNumber.value+maxRTTUnit.value: ''">
<option value="">ms</option>
<option value="s"
secondes
</option>
<option value="m"
minutes
</option>
<option value="h"
heures
</option>
<option value="s" secondes </option>
<option value="m" minutes </option>
<option value="h" heures </option>
</select>
</div>
<input id="maxRTTHidden" type="hidden" name="--max-rtt-timeout">
@ -501,12 +492,9 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<select id="hostTimoutUnit" class="ui clearable dropdown label"
oninput="hostTimoutHidden.value = hostTimoutNumber.value? hostTimoutNumber.value+hostTimoutUnit.value: ''">
<option value="">ms</option>
<option value="s" secondes
</option>
<option value="m" minutes
</option>
<option value="h" heures
</option>
<option value="s" secondes </option>
<option value="m" minutes </option>
<option value="h" heures </option>
</select>
</div>
<input id="hostTimoutHidden" type="hidden" name="--host-timeout">
@ -521,12 +509,9 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<select id="scanDelayUnit" class="ui clearable dropdown label"
oninput="scanDelayHidden.value = scanDelayNumber.value? scanDelayNumber.value+scanDelayUnit.value: ''">
<option value="">ms</option>
<option value="s" secondes
</option>
<option value="m" minutes
</option>
<option value="h" heures
</option>
<option value="s" secondes </option>
<option value="m" minutes </option>
<option value="h" heures </option>
</select>
</div>
<input id="scanDelayHidden" type="hidden" name="--scan-delay">
@ -539,14 +524,9 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<select id="maxRTTUnit" class="ui clearable dropdown label"
oninput="maxRTTHidden.value = maxScanDelay.value? maxScanDelay.value+maxRTTUnit.value: ''">
<option value="">ms</option>
<option value="s"
secondes
</option>
<option value="m"
minutes
</option>
<option value="h" heures
</option>
<option value="s" secondes </option>
<option value="m" minutes </option>
<option value="h" heures </option>
</select>
</div>
<input id="maxRTTHidden" type="hidden" name="--max-scan-delay">
@ -701,12 +681,13 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
</datalist>
<script>
class TagsInput extends Tagify {
constructor(input, options = {}, delim = ",") {
if (!options.delimiters) options.delimiters = " |,"
if (!options.originalInputValueFormat) options.originalInputValueFormat = tags => tags.map(tag => tag.value).join(delim)
if (input.list) options.whitelist = Array.from(input.list.options).map(option => option.value)
super(input, options)
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")
}
}
@ -739,7 +720,7 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
delimiters: ','
})
newScanForm.onsubmit = function(event) {
newScanForm.onsubmit = function (event) {
if (this.checkValidity()) {
newScanForm.classList.add("loading")
$.toast({
@ -758,6 +739,6 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
}
}
</script>
</body>
</body>
</html>

View File

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

View File

@ -11,18 +11,14 @@
<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">
@ -31,14 +27,13 @@
<xsl:with-param name="targets" select="$targets" />
</xsl:apply-templates>
<body>
<body class="inverted">
<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>
@ -60,12 +55,9 @@ $('.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">
@ -77,8 +69,7 @@ $('.ui.dropdown').dropdown()
</xsl:choose>
</xsl:variable>
<h1
class="ui header">
<h1 class="ui header">
<div>
<xsl:attribute name="class">
<xsl:text>ui horizontal label </xsl:text>
@ -99,8 +90,7 @@ $('.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">
@ -160,8 +150,7 @@ $('.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>
@ -171,32 +160,26 @@ $('.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>
@ -208,8 +191,7 @@ $('.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">
@ -257,8 +239,7 @@ $('.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>
@ -266,8 +247,7 @@ $('.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>
@ -279,8 +259,7 @@ $('.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>
@ -295,13 +274,11 @@ $('.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>
@ -335,8 +312,7 @@ $('.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" />
@ -389,9 +365,7 @@ $('.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>

View File

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

View File

@ -55,25 +55,39 @@
</svg>
can</a>
<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">
<form id="scanForm" action="scan.php" method="get">
<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" />
<i class="satellite dish icon"></i>
</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>
</a>
<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>
</a>
</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>
</nav>
<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) {
if (scanForm.checkValidity()) {
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.getElementsByTagName('i')[0].className = 'loading spinner icon'
$.toast({
@ -101,7 +115,7 @@ refreshLink.onclick = function(event) {
position : 'bottom right',
})
}
</xsl:if>
</xsl:if>
</script>
</xsl:template>
</xsl:stylesheet>