This commit is contained in:
Adrien MALINGREY 2024-10-22 01:26:34 +02:00
parent f1bb88abec
commit c01cfb631b
11 changed files with 48 additions and 48 deletions

View File

@ -11,7 +11,7 @@ $presets = [
'-PS' => 'microsoft-ds',
'-F' => true,
'-T' => 5,
'--stylesheet' => "$BASEDIR/templates/hostsTable.xsl",
'--stylesheet' => "$BASEDIR/templates/lanScan.xsl",
'refreshPeriod' => 60,
'sudo' => false,
],
@ -21,7 +21,7 @@ $presets = [
'-sV' => true,
'-T' => 5,
'--script' => "http-info,smb-shares-size",
'--stylesheet' => "$BASEDIR/templates/servicesTable.xsl",
'--stylesheet' => "$BASEDIR/templates/hostScan.xsl",
'refreshPeriod' => 60,
'sudo' => true,
],

View File

@ -11,7 +11,7 @@ $presets = [
'-PS' => 'microsoft-ds',
'-F' => true,
'-T' => 5,
'--stylesheet' => "$BASEDIR/templates/hostsTable.xsl",
'--stylesheet' => "$BASEDIR/templates/lanScan.xsl",
'refreshPeriod' => 60,
'sudo' => false,
],
@ -21,7 +21,7 @@ $presets = [
'-sV' => true,
'-T' => 5,
'--script' => "http-info,smb-shares-size",
'--stylesheet' => "$BASEDIR/templates/servicesTable.xsl",
'--stylesheet' => "$BASEDIR/templates/hostScan.xsl",
'refreshPeriod' => 60,
'sudo' => true,
],

View File

@ -110,7 +110,7 @@ if ($preset && isset($presets[$preset])) {
'--stylesheet' => FILTER_VALIDATE_URL,
// lanScan
'saveAs' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
'original' => FILTER_VALIDATE_URL,
'originalURL' => FILTER_VALIDATE_URL,
'refreshPeriod' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'sudo' => FILTER_VALIDATE_BOOLEAN,
], false) ?: $presets["default"];

View File

@ -593,8 +593,8 @@ foreach (scandir('templates') as $filename) {
</div>
<div class="field">
<label for="originalSelect">Comparer avec un précédent scan</label>
<select id="originalSelect" class="ui dropdown" name="original" value="<?= $options["original"] ?? "" ?>">
<label for="originalURLSelect">Comparer avec un précédent scan</label>
<select id="originalURLSelect" class="ui dropdown" name="originalURL" value="<?= $options["originalURL"] ?? "" ?>">
<option value="">Précédent scan</option>
<?php
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
@ -602,7 +602,7 @@ foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) === '.xml') {
$name = substr($filename, 0, -4);
$URL = "$BASEDIR/$SCANSDIR/".rawurlencode($filename);
if (isset($options["original"]) && $URL == $options["original"]) {
if (isset($options["originalURL"]) && $URL == $options["originalURL"]) {
echo " <option value='$URL' selected>$name</option>\n";
} else {
echo " <option value='$URL'>$name</option>\n";
@ -733,7 +733,7 @@ foreach ([$DATADIR, $NMAPDIR] as $dir) {
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 (!options.originalURLInputValueFormat) options.originalURLInputValueFormat = 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)
}

View File

@ -41,8 +41,8 @@ $xml = new DOMDocument();
$xml->load($tempPath);
`rm "$tempPath"`;
$saveAsURL = $options["saveAs"]?? false ? "$BASEDIR/$SCANSDIR/{$options["saveAs"]}.xml" : "";
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='savedAs' value='".htmlentities($saveAsURL, ENT_QUOTES)."'"), $xml->documentElement);
$thisURL = $options["saveAs"]?? false ? "$BASEDIR/$SCANSDIR/{$options["saveAs"]}.xml" : "";
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='thisURL' value='".htmlentities($thisURL, ENT_QUOTES)."'"), $xml->documentElement);
foreach ($options as $option => $value) {
if (substr($option, 0, 1) != '-') {
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='$option' value='".htmlentities($value, ENT_QUOTES)."'"), $xml->documentElement);

View File

@ -13,19 +13,19 @@
<xsl:output indent="yes"/>
<xsl:strip-space elements='*'/>
<xsl:param name="savedAs" select=""/>
<xsl:param name="original" select=""/>
<xsl:param name="thisURL" select=""/>
<xsl:param name="originalURL" select=""/>
<xsl:param name="refreshPeriod" select="0"/>
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'),'&quot;')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($original)/nmaprun"/>
<xsl:variable name="nextCompareWith">
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
<xsl:choose>
<xsl:when test="$savedAs"><xsl:value-of select="$savedAs"/></xsl:when>
<xsl:when test="$original"><xsl:value-of select="$original"/></xsl:when>
<xsl:when test="$thisURL"><xsl:value-of select="$thisURL"/></xsl:when>
<xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
@ -37,7 +37,7 @@
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextCompareWith" select="$nextCompareWith"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
@ -46,7 +46,7 @@
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextCompareWith" select="$nextCompareWith"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>

View File

@ -12,19 +12,19 @@
<xsl:output indent="yes"/>
<xsl:strip-space elements='*'/>
<xsl:param name="savedAs" select=""/>
<xsl:param name="original" select=""/>
<xsl:param name="thisURL" select=""/>
<xsl:param name="originalURL" select=""/>
<xsl:param name="refreshPeriod" select="0"/>
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'),'&quot;')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($original)/nmaprun"/>
<xsl:variable name="nextCompareWith">
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
<xsl:choose>
<xsl:when test="$savedAs"><xsl:value-of select="$savedAs"/></xsl:when>
<xsl:when test="$original"><xsl:value-of select="$original"/></xsl:when>
<xsl:when test="$thisURL"><xsl:value-of select="$thisURL"/></xsl:when>
<xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
@ -36,7 +36,7 @@
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextCompareWith" select="$nextCompareWith"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
@ -45,7 +45,7 @@
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextCompareWith" select="$nextCompareWith"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>

View File

@ -12,19 +12,19 @@
<xsl:output indent="yes"/>
<xsl:strip-space elements='*'/>
<xsl:param name="savedAs" select=""/>
<xsl:param name="original" select=""/>
<xsl:param name="thisURL" select=""/>
<xsl:param name="originalURL" select=""/>
<xsl:param name="refreshPeriod" select="0"/>
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'),'&quot;')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($original)/nmaprun"/>
<xsl:variable name="nextCompareWith">
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
<xsl:choose>
<xsl:when test="$savedAs"><xsl:value-of select="$saveAs"/></xsl:when>
<xsl:when test="$original"><xsl:value-of select="$original"/></xsl:when>
<xsl:when test="$thisURL"><xsl:value-of select="$saveAs"/></xsl:when>
<xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
@ -36,7 +36,7 @@
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextCompareWith" select="$nextCompareWith"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
@ -45,7 +45,7 @@
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextCompareWith" select="$nextCompareWith"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>

View File

@ -13,19 +13,19 @@
<xsl:output indent="yes"/>
<xsl:strip-space elements='*'/>
<xsl:param name="savedAs" select=""/>
<xsl:param name="original" select=""/>
<xsl:param name="thisURL" select=""/>
<xsl:param name="originalURL" select=""/>
<xsl:param name="refreshPeriod" select="0"/>
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'),'&quot;')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($original)/nmaprun"/>
<xsl:variable name="nextCompareWith">
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
<xsl:choose>
<xsl:when test="$savedAs"><xsl:value-of select="$savedAs"/></xsl:when>
<xsl:when test="$original"><xsl:value-of select="$original"/></xsl:when>
<xsl:when test="$thisURL"><xsl:value-of select="$thisURL"/></xsl:when>
<xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
@ -37,7 +37,7 @@
<xsl:apply-templates select="." mode="head">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextCompareWith" select="$nextCompareWith"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
@ -46,7 +46,7 @@
<xsl:apply-templates select="." mode="nav">
<xsl:with-param name="basedir" select="$basedir"/>
<xsl:with-param name="targets" select="$targets"/>
<xsl:with-param name="nextCompareWith" select="$nextCompareWith"/>
<xsl:with-param name="nextComparison" select="$nextComparison"/>
<xsl:with-param name="refreshPeriod" select="$refreshPeriod"/>
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>

View File

@ -9,7 +9,7 @@
<xsl:template match="nmaprun" mode="head">
<xsl:param name="basedir"/>
<xsl:param name="targets"/>
<xsl:param name="nextCompareWith"/>
<xsl:param name="nextComparison"/>
<xsl:param name="refreshPeriod"/>
<xsl:param name="sudo"/>
@ -28,8 +28,8 @@
<xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/>
<xsl:with-param name="asURL" select="true()"/>
</xsl:call-template>
<xsl:text>original=</xsl:text>
<xsl:value-of select="$nextCompareWith"/>
<xsl:text>originalURL=</xsl:text>
<xsl:value-of select="$nextComparison"/>
<xsl:text>&amp;refreshPeriod=</xsl:text>
<xsl:value-of select="$refreshPeriod"/>
<xsl:text>&amp;sudo=</xsl:text>

View File

@ -9,7 +9,7 @@
<xsl:template match="nmaprun" mode="nav">
<xsl:param name="basedir"/>
<xsl:param name="targets"/>
<xsl:param name="nextCompareWith"/>
<xsl:param name="nextComparison"/>
<xsl:param name="refreshPeriod"/>
<xsl:param name="sudo"/>
<nav class="ui inverted teal fixed menu">
@ -31,7 +31,7 @@
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="original" value="{$nextCompareWith}"/>
<input type="hidden" name="originalURL" value="{$nextComparison}"/>
<input type="hidden" name="refreshPeriod" value="{$refreshPeriod}"/>
<input type="hidden" name="sudo" value="{$sudo}"/>
<button id="hiddenButton" style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php"></button>