refreshPeriod input
This commit is contained in:
parent
9cb008785c
commit
f8f1183fe7
@ -20,3 +20,4 @@ $SCANSDIR = 'scans';
|
||||
$DATADIR = '/usr/share/nmap';
|
||||
|
||||
$sudo = true;
|
||||
$refreshPeriod = 60;
|
||||
|
@ -7,12 +7,12 @@ $portsListRegex = "/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/";
|
||||
$tempoRegex = "/^\d+[smh]?$/";
|
||||
$fileNameRegex = '/^[^<>:"\/|?]+$/';
|
||||
|
||||
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex]]);
|
||||
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex]]);
|
||||
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex]]);
|
||||
$saveAs = filter_input(INPUT_GET, 'saveAs', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex]]);
|
||||
$compareWith = filter_input(INPUT_GET, 'compareWith', FILTER_VALIDATE_URL);
|
||||
|
||||
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex]]);
|
||||
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex]]);
|
||||
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex]]);
|
||||
$saveAs = filter_input(INPUT_GET, 'saveAs', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $fileNameRegex]]);
|
||||
$compareWith = filter_input(INPUT_GET, 'compareWith', FILTER_VALIDATE_URL);
|
||||
$refreshPeriod = filter_input(INPUT_GET, 'refreshPeriod', FILTER_VALIDATE_INT, ['options' => ['min_range' => 0]]) ?? $refreshPeriod;
|
||||
|
||||
if ($lan) {
|
||||
$targets = $lan;
|
||||
@ -22,7 +22,7 @@ if ($lan) {
|
||||
$inputs = $HOSTSCAN_OPTIONS;
|
||||
} else {
|
||||
$inputs = filter_input_array(INPUT_GET, [
|
||||
'iR' => FILTER_VALIDATE_INT,
|
||||
'iR' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||
'exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||
|
||||
'sL' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||
|
27
hostScan.xsl
27
hostScan.xsl
@ -9,8 +9,13 @@
|
||||
<xsl:strip-space elements='*'/>
|
||||
|
||||
<xsl:param name="saveAs" select=""/>
|
||||
<xsl:param name="scansDir" select="scans"/>
|
||||
<xsl:param name="compareWith" select=""/>
|
||||
<xsl:param name="refreshPeriod" select="0"/>
|
||||
|
||||
<xsl:variable name="current" select="./nmaprun"/>
|
||||
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'),'"')"/>
|
||||
<xsl:variable name="basedir" select="concat($stylesheetURL, '/..')"/>
|
||||
<xsl:variable name="init" select="document($compareWith)/nmaprun"/>
|
||||
<xsl:variable name="nextCompareWith">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$saveAs"><xsl:value-of select="$saveAs"/></xsl:when>
|
||||
@ -18,10 +23,6 @@
|
||||
<xsl:otherwise></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="current" select="./nmaprun"/>
|
||||
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'),'"')"/>
|
||||
<xsl:variable name="basedir" select="concat($stylesheetURL, '/..')"/>
|
||||
<xsl:variable name="init" select="document($compareWith)/nmaprun"/>
|
||||
|
||||
<xsl:template match="nmaprun">
|
||||
<xsl:variable name="targets" select="substring-after(@args, '.xml ')"/>
|
||||
@ -41,12 +42,15 @@
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="refresh">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:text>60;URL=</xsl:text>
|
||||
<xsl:value-of select="$refreshURL"/>
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
<xsl:if test="$refreshPeriod > 0">
|
||||
<meta http-equiv="refresh">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:value-of select="$refreshPeriod"/>
|
||||
<xsl:text>;URL=</xsl:text>
|
||||
<xsl:value-of select="$refreshURL"/>
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
</xsl:if>
|
||||
<title>
|
||||
<xsl:text>lanScan - </xsl:text>
|
||||
<xsl:value-of select="$targets"/>
|
||||
@ -82,6 +86,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="compareWith" value="{$nextCompareWith}"/>
|
||||
<input type="hidden" name="refreshPeriod" value="{$refreshPeriod}"/>
|
||||
<button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php"></button>
|
||||
</div>
|
||||
<div class="item">
|
||||
|
26
lanScan.xsl
26
lanScan.xsl
@ -10,6 +10,12 @@
|
||||
|
||||
<xsl:param name="savedAs" select=""/>
|
||||
<xsl:param name="compareWith" select=""/>
|
||||
<xsl:param name="refreshPeriod" select="0"/>
|
||||
|
||||
<xsl:variable name="current" select="./nmaprun"/>
|
||||
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'),'"')"/>
|
||||
<xsl:variable name="basedir" select="concat($stylesheetURL, '/..')"/>
|
||||
<xsl:variable name="init" select="document($compareWith)/nmaprun"/>
|
||||
<xsl:variable name="nextCompareWith">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$savedAs"><xsl:value-of select="$savedAs"/></xsl:when>
|
||||
@ -17,10 +23,6 @@
|
||||
<xsl:otherwise></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="current" select="./nmaprun"/>
|
||||
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'),'"')"/>
|
||||
<xsl:variable name="basedir" select="concat($stylesheetURL, '/..')"/>
|
||||
<xsl:variable name="init" select="document($compareWith)/nmaprun"/>
|
||||
|
||||
<xsl:template match="nmaprun">
|
||||
<xsl:variable name="targets" select="substring-after(@args, '.xml ')"/>
|
||||
@ -40,12 +42,15 @@
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="refresh">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:text>60;URL=</xsl:text>
|
||||
<xsl:value-of select="$refreshURL"/>
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
<xsl:if test="$refreshPeriod > 0">
|
||||
<meta http-equiv="refresh">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:value-of select="$refreshPeriod"/>
|
||||
<xsl:text>;URL=</xsl:text>
|
||||
<xsl:value-of select="$refreshURL"/>
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
</xsl:if>
|
||||
<title>
|
||||
<xsl:text>lanScan - </xsl:text>
|
||||
<xsl:value-of select="$targets"/>
|
||||
@ -85,6 +90,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="compareWith" value="{$nextCompareWith}"/>
|
||||
<input type="hidden" name="refreshPeriod" value="{$refreshPeriod}"/>
|
||||
<button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php"></button>
|
||||
</div>
|
||||
<div class="item">
|
||||
|
@ -246,6 +246,15 @@ foreach (scandir($SCANSDIR) as $filename) {
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="refreshPeriodInput">Rafraîchir toutes les</label>
|
||||
<div class="ui right labeled input">
|
||||
<input type="number" min="0" id="refreshPeriodInput" name="refreshPeriod" placeholder="Période"
|
||||
value="<?= $refreshPeriod ?? "" ?>">
|
||||
<div class="ui label">secondes</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
1
scan.php
1
scan.php
@ -41,6 +41,7 @@ $xml->load($tempPath);
|
||||
$saveAsURL = $saveAs? "$BASEDIR/$SCANSDIR/$saveAs.xml" : "";
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='savedAs' value='".htmlentities($saveAsURL, ENT_QUOTES)."'"), $xml->documentElement);
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value='".htmlentities($compareWith, ENT_QUOTES)."'"), $xml->documentElement);
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='refreshPeriod' value='".htmlentities($refreshPeriod, ENT_QUOTES)."'"), $xml->documentElement);
|
||||
|
||||
if ($saveAs) {
|
||||
$path = "$SCANSDIR/$saveAs.xml";
|
||||
|
Loading…
x
Reference in New Issue
Block a user