From 0d0402fbfd69a2978d43e7551319ba970a2d77ef Mon Sep 17 00:00:00 2001 From: Tom Schaefer Date: Fri, 27 May 2011 23:07:11 -0400 Subject: Push strikeback package --- config/strikeback/parse.tmp | 289 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 config/strikeback/parse.tmp (limited to 'config/strikeback/parse.tmp') diff --git a/config/strikeback/parse.tmp b/config/strikeback/parse.tmp new file mode 100644 index 00000000..085a73fb --- /dev/null +++ b/config/strikeback/parse.tmp @@ -0,0 +1,289 @@ +#!/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 "