variable rename
This commit is contained in:
24
scan.php
24
scan.php
@ -17,34 +17,36 @@ $dir = $SCANS_DIR;
|
||||
if (!file_exists($SCANS_DIR)) {
|
||||
mkdir($SCANS_DIR);
|
||||
}
|
||||
$firstPath = "$SCANS_DIR/".str_replace('/', '!', $targets).'_init.xml';
|
||||
if (file_exists($firstPath)) {
|
||||
$path = ("$SCANS_DIR/".str_replace('/', '!', $targets).'_current.xml');
|
||||
$initPath = "$SCANS_DIR/".str_replace('/', '!', $targets).'_init.xml';
|
||||
if (file_exists($initPath)) {
|
||||
$currentPath = ("$SCANS_DIR/".str_replace('/', '!', $targets).'_current.xml');
|
||||
} else {
|
||||
$path = $firstPath;
|
||||
$firstPath = '';
|
||||
$currentPath = $initPath;
|
||||
$initPath = '';
|
||||
}
|
||||
|
||||
$stylesheetUrl = "$basedir/stylesheet.xsl";
|
||||
|
||||
$command = "NMAPDIR=./nmap nmap $NMAP_OPTIONS -oX ".escapeshellarg($path)." --stylesheet $basedir/stylesheet.xsl $targets";
|
||||
$command = "NMAPDIR=./nmap nmap $NMAP_OPTIONS -oX ".escapeshellarg($currentPath)." --stylesheet $basedir/stylesheet.xsl $targets";
|
||||
|
||||
exec($command, $output, $retval);
|
||||
|
||||
if (!file_exists($path)) {
|
||||
if (!file_exists($currentPath)) {
|
||||
http_response_code(500);
|
||||
exit(implode("<br/>\n", $output));
|
||||
}
|
||||
|
||||
// Add params
|
||||
$xml = new DOMDocument();
|
||||
$xml->load($path);
|
||||
$xml->load($currentPath);
|
||||
$processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='targets' value='$targets'");
|
||||
$xml->insertBefore($processingInstruction, $xml->documentElement);
|
||||
$processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='basedir' value='$basedir'");
|
||||
$xml->insertBefore($processingInstruction, $xml->documentElement);
|
||||
$processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='compareWith' value='$firstPath'");
|
||||
$processingInstruction = $xml->createProcessingInstruction('xslt-param', "name='compareWith' value='$initPath'");
|
||||
$xml->insertBefore($processingInstruction, $xml->documentElement);
|
||||
$xml->save($path);
|
||||
$xml->save($currentPath);
|
||||
|
||||
header('Location: '.$path);
|
||||
//header('Location: '.$currentPath);
|
||||
header('Content-type: text/xml');
|
||||
exit($xml->saveXML());
|
||||
|
Reference in New Issue
Block a user