temp file
This commit is contained in:
parent
bcf6ddff0d
commit
f5a0cffc05
@ -21,7 +21,7 @@ include_once 'filter_inputs.php';
|
||||
<body>
|
||||
<form>
|
||||
<nav class="ui inverted teal fixed menu">
|
||||
<button class="ui teal button item" type="submit" formmethod="get" formaction=".">
|
||||
<button class="ui teal button item" type="submit" formmethod="get" formaction="." onclick="targetsInput.required=false">
|
||||
lan<?php include 'logo.svg'; ?>can
|
||||
</button>
|
||||
<div class="right menu">
|
||||
@ -39,10 +39,17 @@ foreach($inputs as $name => $value) {
|
||||
}
|
||||
?>
|
||||
<button style="display: none;" type="submit" formmethod="get" formaction="scan.php" onsubmit="targetsInputDiv.classList.add('loading')"></button>
|
||||
</div>
|
||||
<div class="item">
|
||||
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="options.php" onclick="targetsInput.required=false">
|
||||
<i class="sliders horizontal icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="item">
|
||||
<a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank">
|
||||
<i class="question circle icon"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</form>
|
||||
|
8
scan.php
8
scan.php
@ -29,21 +29,23 @@ foreach ($inputs as $arg => $value) {
|
||||
}
|
||||
|
||||
$basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . dirname($_SERVER['REQUEST_URI']);
|
||||
exec("nmap$args --stylesheet $basedir/stylesheet.xsl -oX $SCANS_DIR/.tmp $targets 2>&1", $stderr, $code);
|
||||
|
||||
$tempPath = tempnam(sys_get_temp_dir(), 'scan_').".xml";
|
||||
exec("nmap$args --stylesheet $basedir/stylesheet.xsl -oX '$tempPath' $targets 2>&1", $stderr, $code);
|
||||
if ($code) {
|
||||
http_response_code(500);
|
||||
die(implode("<br/>\n", $stderr));
|
||||
}
|
||||
|
||||
$xml = new DOMDocument();
|
||||
$xml->load("$SCANS_DIR/.tmp");
|
||||
$xml->load($tempPath);
|
||||
`rm "$tempPath"`;
|
||||
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='saveAs' value='".htmlentities($saveAs, ENT_QUOTES)."'"), $xml->documentElement);
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='scansDir' value='".htmlentities($SCANS_DIR, ENT_QUOTES)."'"), $xml->documentElement);
|
||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value='".htmlentities($compareWith, ENT_QUOTES)."'"), $xml->documentElement);
|
||||
|
||||
if ($saveAs) {
|
||||
if (!file_exists($SCANS_DIR)) mkdir($SCANS_DIR);
|
||||
$path = "$SCANS_DIR/$saveAs.xml";
|
||||
$xml->save($path);
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
<xsl:variable name="init" select="document(concat($scansDir, '/', $compareWith, '.xml'))/nmaprun"/>
|
||||
|
||||
<xsl:template match="nmaprun">
|
||||
<xsl:variable name="targets" select="substring-after(@args, '/.tmp ')"/>
|
||||
<xsl:variable name="targets" select="substring-after(@args, '.xml ')"/>
|
||||
|
||||
<html lang="fr">
|
||||
<head>
|
||||
@ -67,7 +67,7 @@
|
||||
<body>
|
||||
<form>
|
||||
<nav class="ui inverted teal fixed menu">
|
||||
<button class="ui teal button item" type="submit" formmethod="get" formaction="{$basedir}">
|
||||
<button class="ui teal button item" type="submit" formmethod="get" formaction="{$basedir}" onclick="targetsInput.required=false">
|
||||
<xsl:text>lan</xsl:text>
|
||||
<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"
|
||||
@ -132,10 +132,17 @@ Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/>
|
||||
</xsl:call-template>
|
||||
<xsl:if test="string-length($name)"><input type="hidden" name="compareWith" value="{$name}"/></xsl:if>
|
||||
<button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php" onsubmit="targetsInputDiv.classList.add('loading')"></button>
|
||||
</div>
|
||||
<div class="item">
|
||||
<button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/options.php" onclick="targetsInput.required=false">
|
||||
<i class="sliders horizontal icon"></i>
|
||||
<i class="sliders horizontal icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="item">
|
||||
<a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank">
|
||||
<i class="question circle icon"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</form>
|
||||
|
Loading…
x
Reference in New Issue
Block a user