#!/usr/local/bin/php * * Copyright 2011 Jason Antman all rights reserved. * Distribution and use of this script is unlimited, provided that you leave this notice intact and send any corrections/additions back to me. * * This is assuming a relatively simple scan - only one protocol, one or more hosts, one or more ports, and that different scans will be differentiated only by type * * USAGE: nmap-xml-to-table.php [xml file] [xml file] [...] * * $LastChangedRevision$ * $HeadURL$ * */ header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past exec("mkdir /usr/local/www/packages/strikeback/reports"); $dir = 'reports/'; $reports = scandir($dir); //print_r($reports); foreach($reports as $i => $value){ $reports[$i] = "reports/".$reports[$i]; $i++; } array_shift($reports); array_shift($reports); //print_r($reports); //array_shift($argv); // get rid of script name //print_r($reports); $files = array(); //foreach($argv as $file) foreach($reports as $file) { if(file_exists($file) && is_readable($file)) { $files[] = $file; } else { fwrite(STDERR, "File $file does not exist or is not readable, skipping.\n"); } } $results = array(); $scanInfo = array(); $hostAndPort = array(); $count = 0; foreach($files as $file) { $info = getScanResults($file); $results[$count] = $info['hosts']; $info['scan']['filename'] = $file; $scanInfo[$count] = $info['scan']; foreach($info['hosts'] as $host => $portArr) { if(! isset($hostAndPort[$host])){ $hostAndPort[$host] = array();} foreach($portArr as $port => $foo) { $hostAndPort[$host][$port] = $foo['service']; } } $count++; } ?> Condensed NMAP scan results

Nmap scan results (condensed)

Show/Hide scanned services '."\n"; echo 'Scans'."\n"; //echo 'NumprototypeServicesnum hostscommandfilename'."\n"; echo 'NumprototypeServicesfilenameDelete'."\n"; if(isset($_GET[delete])) { echo($_GET[delete]); exec("rm ".$_GET[delete]); unlink($_GET[delete]); echo "