options
This commit is contained in:
parent
bcb63b3d0f
commit
664bee1249
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
scans/
|
scans/
|
||||||
server.php
|
server.php
|
||||||
|
test.php
|
||||||
|
@ -37,7 +37,7 @@ Exemples: <?=$_SERVER['REMOTE_ADDR']; ?>/24 <?=$_SERVER['SERVER_NAME']; ?> 10.0-
|
|||||||
<form class="item" method="get" action="scan-options.php">
|
<form class="item" method="get" action="scan-options.php">
|
||||||
<input id="hiddenInput" type="hidden" name="targets" value="<?=$targets; ?>"/>
|
<input id="hiddenInput" type="hidden" name="targets" value="<?=$targets; ?>"/>
|
||||||
<input id="hiddenInput" type="hidden" name="name" value="<?=$name; ?>"/>
|
<input id="hiddenInput" type="hidden" name="name" value="<?=$name; ?>"/>
|
||||||
<?='<input type="hidden" name="'.str_replace('=', '" value="', http_build_query($input_args, '', '/><input type="hidden" name="')).'"/>'; ?>
|
<?='<input type="hidden" name="'.str_replace('=', '" value="', http_build_query($options, '', '/><input type="hidden" name="')).'"/>'; ?>
|
||||||
<button class="ui teal submit button" type="submit">Options</button>
|
<button class="ui teal submit button" type="submit">Options</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
27407
nmap/nmap-services
27407
nmap/nmap-services
File diff suppressed because it is too large
Load Diff
22
scan.php
22
scan.php
@ -5,7 +5,7 @@ include_once 'filter_inputs.php';
|
|||||||
|
|
||||||
if (!$targets) {
|
if (!$targets) {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
exit('Paramètre manquant : targets');
|
die('Paramètre manquant : targets');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($SCANS_DIR)) {
|
if (!file_exists($SCANS_DIR)) {
|
||||||
@ -14,9 +14,21 @@ if (!file_exists($SCANS_DIR)) {
|
|||||||
|
|
||||||
$basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}".dirname($_SERVER['REQUEST_URI']);
|
$basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}".dirname($_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
$args = str_replace('=', ' ', http_build_query($input_args, '', ' '));
|
$args = '';
|
||||||
|
foreach ($options as $arg => $value) {
|
||||||
|
if (is_null($value)) {
|
||||||
|
http_response_code(400);
|
||||||
|
exit("Valeur incorecte pour le paramètre $option : ".filter_input(INPUT_GET, $option, FILTER_SANITIZE_FULL_SPECIAL_CHARS));
|
||||||
|
} else if ($value) {
|
||||||
|
if ($value === true) {
|
||||||
|
$args .= " -$arg";
|
||||||
|
} else {
|
||||||
|
$arg .= " -$arg ".escapeshellarg($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = `nmap $args --stylesheet $basedir/stylesheet.xsl -oX - $targets`;
|
$result = `nmap$args --stylesheet $basedir/stylesheet.xsl -oX - $targets`;
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
exit();
|
exit();
|
||||||
@ -33,7 +45,9 @@ if (!file_exists($SCANS_DIR)) {
|
|||||||
$path = "$SCANS_DIR/".str_replace('/', '!', $targets).'.xml';
|
$path = "$SCANS_DIR/".str_replace('/', '!', $targets).'.xml';
|
||||||
if (!file_exists($path)) {
|
if (!file_exists($path)) {
|
||||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value=''"), $xml->documentElement);
|
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value=''"), $xml->documentElement);
|
||||||
$xml->save($path);
|
$xml->
|
||||||
|
|
||||||
|
save($path);
|
||||||
} else {
|
} else {
|
||||||
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value='$path'"), $xml->documentElement);
|
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value='$path'"), $xml->documentElement);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user