traceroute
This commit is contained in:
27
scan.php
27
scan.php
@ -7,33 +7,13 @@ $targetsListRegex = '/^[\da-zA-Z-. \/]+$/';
|
||||
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||
if ($lan) {
|
||||
$cmd = "$NMAP $LANSCANOPTIONS $lan";
|
||||
|
||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||
$filename = str_replace("/", "!", $lan);
|
||||
$path = "$SCANSDIR/$filename.xml";
|
||||
|
||||
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
||||
|
||||
header('Content-type: text/xml');
|
||||
system("$cmd", $retcode);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||
if ($host) {
|
||||
$cmd = "$NMAP $HOSTSCANOPTIONS $host";
|
||||
|
||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||
$filename = str_replace("/", "!", $host);
|
||||
$path = "$SCANSDIR/$filename.xml";
|
||||
|
||||
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
||||
|
||||
header('Content-type: text/xml');
|
||||
system("$cmd", $retcode);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||
@ -173,10 +153,11 @@ if ($targets) {
|
||||
}
|
||||
|
||||
$cmd = "$NMAP$options $targets";
|
||||
echo "<!--$cmd-->\n";
|
||||
|
||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||
$filename = str_replace("/", "!", $targets);
|
||||
}
|
||||
|
||||
if ($cmd) {
|
||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||
$path = "$SCANSDIR/$filename.xml";
|
||||
|
||||
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
||||
|
Reference in New Issue
Block a user