diff --git a/ReportToolz/1GB.zip b/ReportToolz/1GB.zip new file mode 100644 index 0000000..c308c46 --- /dev/null +++ b/ReportToolz/1GB.zip Binary files differ diff --git a/ReportToolz/1GB.zip b/ReportToolz/1GB.zip new file mode 100644 index 0000000..c308c46 --- /dev/null +++ b/ReportToolz/1GB.zip Binary files differ diff --git a/ReportToolz/1GB.zip.1 b/ReportToolz/1GB.zip.1 new file mode 100644 index 0000000..e27d9cf --- /dev/null +++ b/ReportToolz/1GB.zip.1 Binary files differ diff --git a/ReportToolz/1GB.zip b/ReportToolz/1GB.zip new file mode 100644 index 0000000..c308c46 --- /dev/null +++ b/ReportToolz/1GB.zip Binary files differ diff --git a/ReportToolz/1GB.zip.1 b/ReportToolz/1GB.zip.1 new file mode 100644 index 0000000..e27d9cf --- /dev/null +++ b/ReportToolz/1GB.zip.1 Binary files differ diff --git a/ReportToolz/1GB.zip.2 b/ReportToolz/1GB.zip.2 new file mode 100644 index 0000000..fdd2fcd --- /dev/null +++ b/ReportToolz/1GB.zip.2 Binary files differ diff --git a/ReportToolz/1GB.zip b/ReportToolz/1GB.zip new file mode 100644 index 0000000..c308c46 --- /dev/null +++ b/ReportToolz/1GB.zip Binary files differ diff --git a/ReportToolz/1GB.zip.1 b/ReportToolz/1GB.zip.1 new file mode 100644 index 0000000..e27d9cf --- /dev/null +++ b/ReportToolz/1GB.zip.1 Binary files differ diff --git a/ReportToolz/1GB.zip.2 b/ReportToolz/1GB.zip.2 new file mode 100644 index 0000000..fdd2fcd --- /dev/null +++ b/ReportToolz/1GB.zip.2 Binary files differ diff --git a/ReportToolz/rep2.php b/ReportToolz/rep2.php index 9cc9db3..b5eb6a2 100755 --- a/ReportToolz/rep2.php +++ b/ReportToolz/rep2.php @@ -72,6 +72,18 @@ //die(); echo "[=] fonts found: ".sizeof($fonts)."\n"; +// get template version used +$reader = new XMLReader(); +if (!$reader->open("/tmp/$rand/meta.xml")) die("[-] Failed to open 'meta.xml'\n"); +$templateVer = 0.0; +while ($reader->read()) { + if($reader->name == "dc:version"){ + $reader->read(); + $templateVer = number_format(floatval($reader->value), 2); + break; + } +} + // step through text:h and text:p elements to put them into an array $reader = new XMLReader(); if (!$reader->open("/tmp/$rand/content.xml")) die("[-] Failed to open 'content.xml'\n"); @@ -88,6 +100,7 @@ $start = 0; $end = 0; foreach($line as $key => $val){ if(strpos($val, "Discovered Vulnerabilities") === 0){ $start = $key; } + //if(strpos($val, "This section provides a quick guide to plan your remediation for the vulnerabilities discovered during the test.") === 0){ $end = $key-2; } if(strpos($val, "Observed Hosts and Services") === 0){ $end = $key-2; } $line[$key] = trim($val); } @@ -98,120 +111,241 @@ $switch = 0; $sub2 = 0; $sub3 = 1; -for ($i=$start; $i <= $end ; $i++) { - // change state (action to take) - /*** - * ~states~ - * 0 = do nothing - * 1 = next is title - * 2 = next is description - * 3 = next is solution - * 4 = next is remediation - * 5 = next is cvss no - * 6 = next is risk level - * 7 = next is hosts - * 8 = next possibly title - */ - switch ($line[$i]) { - case 'Discovered Vulnerabilieies': - $switch = 0; - break; - case 'Serious Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'High Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Medium Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Low Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Description': - $switch = 2; - break; - case 'Solution': - $switch = 3; - break; - case 'Remediation': - $switch = 4; - break; - case 'CVSS Base Score': - $switch = 5; - break; - case 'Risk Level': - $switch = 6; - break; - case 'Vulnerabilities Exist On': - $switch = 7; - break; - case 'Potential Impact': - $switch = 9; - break; - default: - # code... - break; - } +if(number_format($templateVer, 2) >= number_format(1.0, 2)){ + echo "[=] Template $templateVer used\n"; + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Analysis': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } - //take action - switch ($switch) { - case 1: - $i++; - $vuln[$vulnPlace]['title'] = $line[$i]; - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 2: - @$vuln[$vulnPlace]['desc'] .= $line[$i]; - break; - case 3: - @$vuln[$vulnPlace]['fix'] .= $line[$i]; - break; - case 4: - $i++; - $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); - $switch = 0; - break; - case 5: - $i++; - $vuln[$vulnPlace]['cvss'] = $line[$i]; - $switch = 0; - break; - case 6: - $i++; - $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); - $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); - $switch = 0; - break; - case 7: - $i++; - $vuln[$vulnPlace]['hosts'] = $line[$i]; - $switch = 8; - $vulnPlace++; - break; - case 8: - $vuln[$vulnPlace]['title'] = trim($line[$i]); - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 9: - @$vuln[$vulnPlace]['impact'] .= $line[$i]; - break; - default: - # code... - break; - } + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + //$vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $line[$i+3] = str_replace("Vulnerability Img", "", $line[$i+3]); + $vuln[$vulnPlace]['risk'] = strstr(trim($line[$i+3]), ":", true); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i+3], strpos($line[$i+3], ":") + 1)); + $vuln[$vulnPlace]['impact'] = trim(strtok($line[$i+4], " ")); + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i+5], " ")); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } - //echo $line[$i]."\n"; // DEBUG + //echo $line[$i]."\n"; // DEBUG + } + $first_desc = explode("Description", $vuln[0]['desc']); + $vuln[0]['desc'] = $first_desc[sizeof($first_desc)-1]; +}else{ // old template or Dave's format + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Level': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } + + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } + + //echo $line[$i]."\n"; // DEBUG + } } - // minor tidying of arrays for ($i=0; $i < sizeof($vuln) ; $i++) { if (strpos($vuln[$i]['desc'], "Description") === 0) $vuln[$i]['desc'] = substr($vuln[$i]['desc'], strlen("Description")); @@ -251,7 +385,15 @@ if(writeIssueTable($vuln, "Low", $resultsFolder."/findings_low.csv")) echo "[+] low issues: $resultsFolder/findings_serious.csv\n"; -if(writeAllTable($vuln, $resultsFolder."/findings_all.csv")) +$order = array('title', 'ref', 'desc', 'fix','rem','cvss','risk','impact','owasp','hosts'); +$orderedArray = array(); +foreach($vuln as $vn_no =>$vn){ + foreach ($order as $key) { + //echo $key."\n"; + $orderedArray[$vn_no][$key] = $vuln[$vn_no][$key]; + } +} +if(writeAllTable($orderedArray, $resultsFolder."/findings_all.csv")) echo "[+] all issues: $resultsFolder/findings_all.csv\n"; if(writeRemediationTable($vuln, $resultsFolder."/remediation.csv")) @@ -366,7 +508,9 @@ if(sizeof($vuln) > 0){ $fp = fopen($path, 'w'); fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF)); - fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk", "OWASP", "Affected")); + fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk","Impact", "OWASP", "Affected")); + + //print_r($orderedArray); foreach ($vuln as $fields) { fputcsv($fp, $fields); } diff --git a/ReportToolz/1GB.zip b/ReportToolz/1GB.zip new file mode 100644 index 0000000..c308c46 --- /dev/null +++ b/ReportToolz/1GB.zip Binary files differ diff --git a/ReportToolz/1GB.zip.1 b/ReportToolz/1GB.zip.1 new file mode 100644 index 0000000..e27d9cf --- /dev/null +++ b/ReportToolz/1GB.zip.1 Binary files differ diff --git a/ReportToolz/1GB.zip.2 b/ReportToolz/1GB.zip.2 new file mode 100644 index 0000000..fdd2fcd --- /dev/null +++ b/ReportToolz/1GB.zip.2 Binary files differ diff --git a/ReportToolz/rep2.php b/ReportToolz/rep2.php index 9cc9db3..b5eb6a2 100755 --- a/ReportToolz/rep2.php +++ b/ReportToolz/rep2.php @@ -72,6 +72,18 @@ //die(); echo "[=] fonts found: ".sizeof($fonts)."\n"; +// get template version used +$reader = new XMLReader(); +if (!$reader->open("/tmp/$rand/meta.xml")) die("[-] Failed to open 'meta.xml'\n"); +$templateVer = 0.0; +while ($reader->read()) { + if($reader->name == "dc:version"){ + $reader->read(); + $templateVer = number_format(floatval($reader->value), 2); + break; + } +} + // step through text:h and text:p elements to put them into an array $reader = new XMLReader(); if (!$reader->open("/tmp/$rand/content.xml")) die("[-] Failed to open 'content.xml'\n"); @@ -88,6 +100,7 @@ $start = 0; $end = 0; foreach($line as $key => $val){ if(strpos($val, "Discovered Vulnerabilities") === 0){ $start = $key; } + //if(strpos($val, "This section provides a quick guide to plan your remediation for the vulnerabilities discovered during the test.") === 0){ $end = $key-2; } if(strpos($val, "Observed Hosts and Services") === 0){ $end = $key-2; } $line[$key] = trim($val); } @@ -98,120 +111,241 @@ $switch = 0; $sub2 = 0; $sub3 = 1; -for ($i=$start; $i <= $end ; $i++) { - // change state (action to take) - /*** - * ~states~ - * 0 = do nothing - * 1 = next is title - * 2 = next is description - * 3 = next is solution - * 4 = next is remediation - * 5 = next is cvss no - * 6 = next is risk level - * 7 = next is hosts - * 8 = next possibly title - */ - switch ($line[$i]) { - case 'Discovered Vulnerabilieies': - $switch = 0; - break; - case 'Serious Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'High Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Medium Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Low Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Description': - $switch = 2; - break; - case 'Solution': - $switch = 3; - break; - case 'Remediation': - $switch = 4; - break; - case 'CVSS Base Score': - $switch = 5; - break; - case 'Risk Level': - $switch = 6; - break; - case 'Vulnerabilities Exist On': - $switch = 7; - break; - case 'Potential Impact': - $switch = 9; - break; - default: - # code... - break; - } +if(number_format($templateVer, 2) >= number_format(1.0, 2)){ + echo "[=] Template $templateVer used\n"; + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Analysis': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } - //take action - switch ($switch) { - case 1: - $i++; - $vuln[$vulnPlace]['title'] = $line[$i]; - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 2: - @$vuln[$vulnPlace]['desc'] .= $line[$i]; - break; - case 3: - @$vuln[$vulnPlace]['fix'] .= $line[$i]; - break; - case 4: - $i++; - $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); - $switch = 0; - break; - case 5: - $i++; - $vuln[$vulnPlace]['cvss'] = $line[$i]; - $switch = 0; - break; - case 6: - $i++; - $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); - $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); - $switch = 0; - break; - case 7: - $i++; - $vuln[$vulnPlace]['hosts'] = $line[$i]; - $switch = 8; - $vulnPlace++; - break; - case 8: - $vuln[$vulnPlace]['title'] = trim($line[$i]); - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 9: - @$vuln[$vulnPlace]['impact'] .= $line[$i]; - break; - default: - # code... - break; - } + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + //$vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $line[$i+3] = str_replace("Vulnerability Img", "", $line[$i+3]); + $vuln[$vulnPlace]['risk'] = strstr(trim($line[$i+3]), ":", true); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i+3], strpos($line[$i+3], ":") + 1)); + $vuln[$vulnPlace]['impact'] = trim(strtok($line[$i+4], " ")); + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i+5], " ")); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } - //echo $line[$i]."\n"; // DEBUG + //echo $line[$i]."\n"; // DEBUG + } + $first_desc = explode("Description", $vuln[0]['desc']); + $vuln[0]['desc'] = $first_desc[sizeof($first_desc)-1]; +}else{ // old template or Dave's format + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Level': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } + + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } + + //echo $line[$i]."\n"; // DEBUG + } } - // minor tidying of arrays for ($i=0; $i < sizeof($vuln) ; $i++) { if (strpos($vuln[$i]['desc'], "Description") === 0) $vuln[$i]['desc'] = substr($vuln[$i]['desc'], strlen("Description")); @@ -251,7 +385,15 @@ if(writeIssueTable($vuln, "Low", $resultsFolder."/findings_low.csv")) echo "[+] low issues: $resultsFolder/findings_serious.csv\n"; -if(writeAllTable($vuln, $resultsFolder."/findings_all.csv")) +$order = array('title', 'ref', 'desc', 'fix','rem','cvss','risk','impact','owasp','hosts'); +$orderedArray = array(); +foreach($vuln as $vn_no =>$vn){ + foreach ($order as $key) { + //echo $key."\n"; + $orderedArray[$vn_no][$key] = $vuln[$vn_no][$key]; + } +} +if(writeAllTable($orderedArray, $resultsFolder."/findings_all.csv")) echo "[+] all issues: $resultsFolder/findings_all.csv\n"; if(writeRemediationTable($vuln, $resultsFolder."/remediation.csv")) @@ -366,7 +508,9 @@ if(sizeof($vuln) > 0){ $fp = fopen($path, 'w'); fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF)); - fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk", "OWASP", "Affected")); + fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk","Impact", "OWASP", "Affected")); + + //print_r($orderedArray); foreach ($vuln as $fields) { fputcsv($fp, $fields); } diff --git a/ReportToolz/repgen.php b/ReportToolz/repgen.php index a425b47..1597feb 100755 --- a/ReportToolz/repgen.php +++ b/ReportToolz/repgen.php @@ -5,9 +5,9 @@ /*** * Configuration options */ -$template = "templates/odt/blank_template_v0.5.odt"; -$CHECKtemplate = "templates/odt/blank_template_check_v0.4.odt"; -$vulnTemplate = "templates/odt/vuln_template.xml"; +$template = "templates/odt/blank_template_v1.0.odt"; +//$CHECKtemplate = "templates/odt/blank_template_check_v0.4.odt"; +$vulnTemplate = "templates/odt/vuln_template_v0.2.xml"; /*** * Main program - Don't edit below @@ -41,10 +41,6 @@ //get config file $config = json_decode(file_get_contents($filter->getParam("path")."config.conf")); -if(isset($config->checkRef) && trim($config->checkRef) <> ""){ - $template = $CHECKtemplate; // if checkRefset use CHECK template - echo "[+] using CHECK template\n"; -} // extract doc and get contents $rand = uniqid(); @@ -55,11 +51,33 @@ } else { die("[-] unable to extract doc\n"); } +$source = file_get_contents("/tmp/$rand/content.xml"); - +// add CHECK section into report if needed +if(isset($config->checkRef) && trim($config->checkRef) <> ""){ + $check_img = ' + + '; + $check_section = ' + + + + + CHECK Ref: {checkRef} + '; + $source = str_replace('{check_img}', $check_img, $source); + $source = str_replace('{check_section}', $check_section, $source); + echo "[+] Added CHECK section\n"; +}else{ + $check_section = ' + + + '; + $source = str_replace('{check_img}', "", $source); + $source = str_replace('{check_section}', $check_section, $source); +} // add config into template -$source = file_get_contents("/tmp/$rand/content.xml"); foreach ($config as $key => $value) { $source = str_replace('{'.$key.'}', $value, $source); } @@ -93,7 +111,27 @@ $value = str_replace(">", ">", $value); $value = str_replace("\n", "", $value); $templateSource = str_replace('{'.$key.'}', $value, $templateSource); + if($key == "risk"){ + switch ($togo) { + case 'Serious': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C2B2344F988E3C014.png', $templateSource); + break; + case 'High': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C478E326DAB1B0673.gif', $templateSource); + break; + case 'Medium': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C08AD11DB0A5D02CD.png', $templateSource); + break; + case 'Low': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C6CC3BB57AA64608B.gif', $templateSource); + break; + case 'Info': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C7365C375D1750C0F.gif', $templateSource); + break; + } + } } + $$togo .= $templateSource; echo "[+] added $togo: ".$singlevuln['title']."\n"; } diff --git a/ReportToolz/1GB.zip b/ReportToolz/1GB.zip new file mode 100644 index 0000000..c308c46 --- /dev/null +++ b/ReportToolz/1GB.zip Binary files differ diff --git a/ReportToolz/1GB.zip.1 b/ReportToolz/1GB.zip.1 new file mode 100644 index 0000000..e27d9cf --- /dev/null +++ b/ReportToolz/1GB.zip.1 Binary files differ diff --git a/ReportToolz/1GB.zip.2 b/ReportToolz/1GB.zip.2 new file mode 100644 index 0000000..fdd2fcd --- /dev/null +++ b/ReportToolz/1GB.zip.2 Binary files differ diff --git a/ReportToolz/rep2.php b/ReportToolz/rep2.php index 9cc9db3..b5eb6a2 100755 --- a/ReportToolz/rep2.php +++ b/ReportToolz/rep2.php @@ -72,6 +72,18 @@ //die(); echo "[=] fonts found: ".sizeof($fonts)."\n"; +// get template version used +$reader = new XMLReader(); +if (!$reader->open("/tmp/$rand/meta.xml")) die("[-] Failed to open 'meta.xml'\n"); +$templateVer = 0.0; +while ($reader->read()) { + if($reader->name == "dc:version"){ + $reader->read(); + $templateVer = number_format(floatval($reader->value), 2); + break; + } +} + // step through text:h and text:p elements to put them into an array $reader = new XMLReader(); if (!$reader->open("/tmp/$rand/content.xml")) die("[-] Failed to open 'content.xml'\n"); @@ -88,6 +100,7 @@ $start = 0; $end = 0; foreach($line as $key => $val){ if(strpos($val, "Discovered Vulnerabilities") === 0){ $start = $key; } + //if(strpos($val, "This section provides a quick guide to plan your remediation for the vulnerabilities discovered during the test.") === 0){ $end = $key-2; } if(strpos($val, "Observed Hosts and Services") === 0){ $end = $key-2; } $line[$key] = trim($val); } @@ -98,120 +111,241 @@ $switch = 0; $sub2 = 0; $sub3 = 1; -for ($i=$start; $i <= $end ; $i++) { - // change state (action to take) - /*** - * ~states~ - * 0 = do nothing - * 1 = next is title - * 2 = next is description - * 3 = next is solution - * 4 = next is remediation - * 5 = next is cvss no - * 6 = next is risk level - * 7 = next is hosts - * 8 = next possibly title - */ - switch ($line[$i]) { - case 'Discovered Vulnerabilieies': - $switch = 0; - break; - case 'Serious Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'High Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Medium Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Low Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Description': - $switch = 2; - break; - case 'Solution': - $switch = 3; - break; - case 'Remediation': - $switch = 4; - break; - case 'CVSS Base Score': - $switch = 5; - break; - case 'Risk Level': - $switch = 6; - break; - case 'Vulnerabilities Exist On': - $switch = 7; - break; - case 'Potential Impact': - $switch = 9; - break; - default: - # code... - break; - } +if(number_format($templateVer, 2) >= number_format(1.0, 2)){ + echo "[=] Template $templateVer used\n"; + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Analysis': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } - //take action - switch ($switch) { - case 1: - $i++; - $vuln[$vulnPlace]['title'] = $line[$i]; - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 2: - @$vuln[$vulnPlace]['desc'] .= $line[$i]; - break; - case 3: - @$vuln[$vulnPlace]['fix'] .= $line[$i]; - break; - case 4: - $i++; - $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); - $switch = 0; - break; - case 5: - $i++; - $vuln[$vulnPlace]['cvss'] = $line[$i]; - $switch = 0; - break; - case 6: - $i++; - $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); - $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); - $switch = 0; - break; - case 7: - $i++; - $vuln[$vulnPlace]['hosts'] = $line[$i]; - $switch = 8; - $vulnPlace++; - break; - case 8: - $vuln[$vulnPlace]['title'] = trim($line[$i]); - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 9: - @$vuln[$vulnPlace]['impact'] .= $line[$i]; - break; - default: - # code... - break; - } + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + //$vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $line[$i+3] = str_replace("Vulnerability Img", "", $line[$i+3]); + $vuln[$vulnPlace]['risk'] = strstr(trim($line[$i+3]), ":", true); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i+3], strpos($line[$i+3], ":") + 1)); + $vuln[$vulnPlace]['impact'] = trim(strtok($line[$i+4], " ")); + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i+5], " ")); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } - //echo $line[$i]."\n"; // DEBUG + //echo $line[$i]."\n"; // DEBUG + } + $first_desc = explode("Description", $vuln[0]['desc']); + $vuln[0]['desc'] = $first_desc[sizeof($first_desc)-1]; +}else{ // old template or Dave's format + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Level': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } + + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } + + //echo $line[$i]."\n"; // DEBUG + } } - // minor tidying of arrays for ($i=0; $i < sizeof($vuln) ; $i++) { if (strpos($vuln[$i]['desc'], "Description") === 0) $vuln[$i]['desc'] = substr($vuln[$i]['desc'], strlen("Description")); @@ -251,7 +385,15 @@ if(writeIssueTable($vuln, "Low", $resultsFolder."/findings_low.csv")) echo "[+] low issues: $resultsFolder/findings_serious.csv\n"; -if(writeAllTable($vuln, $resultsFolder."/findings_all.csv")) +$order = array('title', 'ref', 'desc', 'fix','rem','cvss','risk','impact','owasp','hosts'); +$orderedArray = array(); +foreach($vuln as $vn_no =>$vn){ + foreach ($order as $key) { + //echo $key."\n"; + $orderedArray[$vn_no][$key] = $vuln[$vn_no][$key]; + } +} +if(writeAllTable($orderedArray, $resultsFolder."/findings_all.csv")) echo "[+] all issues: $resultsFolder/findings_all.csv\n"; if(writeRemediationTable($vuln, $resultsFolder."/remediation.csv")) @@ -366,7 +508,9 @@ if(sizeof($vuln) > 0){ $fp = fopen($path, 'w'); fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF)); - fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk", "OWASP", "Affected")); + fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk","Impact", "OWASP", "Affected")); + + //print_r($orderedArray); foreach ($vuln as $fields) { fputcsv($fp, $fields); } diff --git a/ReportToolz/repgen.php b/ReportToolz/repgen.php index a425b47..1597feb 100755 --- a/ReportToolz/repgen.php +++ b/ReportToolz/repgen.php @@ -5,9 +5,9 @@ /*** * Configuration options */ -$template = "templates/odt/blank_template_v0.5.odt"; -$CHECKtemplate = "templates/odt/blank_template_check_v0.4.odt"; -$vulnTemplate = "templates/odt/vuln_template.xml"; +$template = "templates/odt/blank_template_v1.0.odt"; +//$CHECKtemplate = "templates/odt/blank_template_check_v0.4.odt"; +$vulnTemplate = "templates/odt/vuln_template_v0.2.xml"; /*** * Main program - Don't edit below @@ -41,10 +41,6 @@ //get config file $config = json_decode(file_get_contents($filter->getParam("path")."config.conf")); -if(isset($config->checkRef) && trim($config->checkRef) <> ""){ - $template = $CHECKtemplate; // if checkRefset use CHECK template - echo "[+] using CHECK template\n"; -} // extract doc and get contents $rand = uniqid(); @@ -55,11 +51,33 @@ } else { die("[-] unable to extract doc\n"); } +$source = file_get_contents("/tmp/$rand/content.xml"); - +// add CHECK section into report if needed +if(isset($config->checkRef) && trim($config->checkRef) <> ""){ + $check_img = ' + + '; + $check_section = ' + + + + + CHECK Ref: {checkRef} + '; + $source = str_replace('{check_img}', $check_img, $source); + $source = str_replace('{check_section}', $check_section, $source); + echo "[+] Added CHECK section\n"; +}else{ + $check_section = ' + + + '; + $source = str_replace('{check_img}', "", $source); + $source = str_replace('{check_section}', $check_section, $source); +} // add config into template -$source = file_get_contents("/tmp/$rand/content.xml"); foreach ($config as $key => $value) { $source = str_replace('{'.$key.'}', $value, $source); } @@ -93,7 +111,27 @@ $value = str_replace(">", ">", $value); $value = str_replace("\n", "", $value); $templateSource = str_replace('{'.$key.'}', $value, $templateSource); + if($key == "risk"){ + switch ($togo) { + case 'Serious': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C2B2344F988E3C014.png', $templateSource); + break; + case 'High': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C478E326DAB1B0673.gif', $templateSource); + break; + case 'Medium': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C08AD11DB0A5D02CD.png', $templateSource); + break; + case 'Low': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C6CC3BB57AA64608B.gif', $templateSource); + break; + case 'Info': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C7365C375D1750C0F.gif', $templateSource); + break; + } + } } + $$togo .= $templateSource; echo "[+] added $togo: ".$singlevuln['title']."\n"; } diff --git a/ReportToolz/templates/odt/blank_template_v0.6.odt b/ReportToolz/templates/odt/blank_template_v0.6.odt new file mode 100755 index 0000000..8ee26a6 --- /dev/null +++ b/ReportToolz/templates/odt/blank_template_v0.6.odt Binary files differ diff --git a/ReportToolz/1GB.zip b/ReportToolz/1GB.zip new file mode 100644 index 0000000..c308c46 --- /dev/null +++ b/ReportToolz/1GB.zip Binary files differ diff --git a/ReportToolz/1GB.zip.1 b/ReportToolz/1GB.zip.1 new file mode 100644 index 0000000..e27d9cf --- /dev/null +++ b/ReportToolz/1GB.zip.1 Binary files differ diff --git a/ReportToolz/1GB.zip.2 b/ReportToolz/1GB.zip.2 new file mode 100644 index 0000000..fdd2fcd --- /dev/null +++ b/ReportToolz/1GB.zip.2 Binary files differ diff --git a/ReportToolz/rep2.php b/ReportToolz/rep2.php index 9cc9db3..b5eb6a2 100755 --- a/ReportToolz/rep2.php +++ b/ReportToolz/rep2.php @@ -72,6 +72,18 @@ //die(); echo "[=] fonts found: ".sizeof($fonts)."\n"; +// get template version used +$reader = new XMLReader(); +if (!$reader->open("/tmp/$rand/meta.xml")) die("[-] Failed to open 'meta.xml'\n"); +$templateVer = 0.0; +while ($reader->read()) { + if($reader->name == "dc:version"){ + $reader->read(); + $templateVer = number_format(floatval($reader->value), 2); + break; + } +} + // step through text:h and text:p elements to put them into an array $reader = new XMLReader(); if (!$reader->open("/tmp/$rand/content.xml")) die("[-] Failed to open 'content.xml'\n"); @@ -88,6 +100,7 @@ $start = 0; $end = 0; foreach($line as $key => $val){ if(strpos($val, "Discovered Vulnerabilities") === 0){ $start = $key; } + //if(strpos($val, "This section provides a quick guide to plan your remediation for the vulnerabilities discovered during the test.") === 0){ $end = $key-2; } if(strpos($val, "Observed Hosts and Services") === 0){ $end = $key-2; } $line[$key] = trim($val); } @@ -98,120 +111,241 @@ $switch = 0; $sub2 = 0; $sub3 = 1; -for ($i=$start; $i <= $end ; $i++) { - // change state (action to take) - /*** - * ~states~ - * 0 = do nothing - * 1 = next is title - * 2 = next is description - * 3 = next is solution - * 4 = next is remediation - * 5 = next is cvss no - * 6 = next is risk level - * 7 = next is hosts - * 8 = next possibly title - */ - switch ($line[$i]) { - case 'Discovered Vulnerabilieies': - $switch = 0; - break; - case 'Serious Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'High Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Medium Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Low Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Description': - $switch = 2; - break; - case 'Solution': - $switch = 3; - break; - case 'Remediation': - $switch = 4; - break; - case 'CVSS Base Score': - $switch = 5; - break; - case 'Risk Level': - $switch = 6; - break; - case 'Vulnerabilities Exist On': - $switch = 7; - break; - case 'Potential Impact': - $switch = 9; - break; - default: - # code... - break; - } +if(number_format($templateVer, 2) >= number_format(1.0, 2)){ + echo "[=] Template $templateVer used\n"; + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Analysis': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } - //take action - switch ($switch) { - case 1: - $i++; - $vuln[$vulnPlace]['title'] = $line[$i]; - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 2: - @$vuln[$vulnPlace]['desc'] .= $line[$i]; - break; - case 3: - @$vuln[$vulnPlace]['fix'] .= $line[$i]; - break; - case 4: - $i++; - $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); - $switch = 0; - break; - case 5: - $i++; - $vuln[$vulnPlace]['cvss'] = $line[$i]; - $switch = 0; - break; - case 6: - $i++; - $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); - $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); - $switch = 0; - break; - case 7: - $i++; - $vuln[$vulnPlace]['hosts'] = $line[$i]; - $switch = 8; - $vulnPlace++; - break; - case 8: - $vuln[$vulnPlace]['title'] = trim($line[$i]); - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 9: - @$vuln[$vulnPlace]['impact'] .= $line[$i]; - break; - default: - # code... - break; - } + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + //$vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $line[$i+3] = str_replace("Vulnerability Img", "", $line[$i+3]); + $vuln[$vulnPlace]['risk'] = strstr(trim($line[$i+3]), ":", true); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i+3], strpos($line[$i+3], ":") + 1)); + $vuln[$vulnPlace]['impact'] = trim(strtok($line[$i+4], " ")); + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i+5], " ")); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } - //echo $line[$i]."\n"; // DEBUG + //echo $line[$i]."\n"; // DEBUG + } + $first_desc = explode("Description", $vuln[0]['desc']); + $vuln[0]['desc'] = $first_desc[sizeof($first_desc)-1]; +}else{ // old template or Dave's format + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Level': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } + + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } + + //echo $line[$i]."\n"; // DEBUG + } } - // minor tidying of arrays for ($i=0; $i < sizeof($vuln) ; $i++) { if (strpos($vuln[$i]['desc'], "Description") === 0) $vuln[$i]['desc'] = substr($vuln[$i]['desc'], strlen("Description")); @@ -251,7 +385,15 @@ if(writeIssueTable($vuln, "Low", $resultsFolder."/findings_low.csv")) echo "[+] low issues: $resultsFolder/findings_serious.csv\n"; -if(writeAllTable($vuln, $resultsFolder."/findings_all.csv")) +$order = array('title', 'ref', 'desc', 'fix','rem','cvss','risk','impact','owasp','hosts'); +$orderedArray = array(); +foreach($vuln as $vn_no =>$vn){ + foreach ($order as $key) { + //echo $key."\n"; + $orderedArray[$vn_no][$key] = $vuln[$vn_no][$key]; + } +} +if(writeAllTable($orderedArray, $resultsFolder."/findings_all.csv")) echo "[+] all issues: $resultsFolder/findings_all.csv\n"; if(writeRemediationTable($vuln, $resultsFolder."/remediation.csv")) @@ -366,7 +508,9 @@ if(sizeof($vuln) > 0){ $fp = fopen($path, 'w'); fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF)); - fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk", "OWASP", "Affected")); + fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk","Impact", "OWASP", "Affected")); + + //print_r($orderedArray); foreach ($vuln as $fields) { fputcsv($fp, $fields); } diff --git a/ReportToolz/repgen.php b/ReportToolz/repgen.php index a425b47..1597feb 100755 --- a/ReportToolz/repgen.php +++ b/ReportToolz/repgen.php @@ -5,9 +5,9 @@ /*** * Configuration options */ -$template = "templates/odt/blank_template_v0.5.odt"; -$CHECKtemplate = "templates/odt/blank_template_check_v0.4.odt"; -$vulnTemplate = "templates/odt/vuln_template.xml"; +$template = "templates/odt/blank_template_v1.0.odt"; +//$CHECKtemplate = "templates/odt/blank_template_check_v0.4.odt"; +$vulnTemplate = "templates/odt/vuln_template_v0.2.xml"; /*** * Main program - Don't edit below @@ -41,10 +41,6 @@ //get config file $config = json_decode(file_get_contents($filter->getParam("path")."config.conf")); -if(isset($config->checkRef) && trim($config->checkRef) <> ""){ - $template = $CHECKtemplate; // if checkRefset use CHECK template - echo "[+] using CHECK template\n"; -} // extract doc and get contents $rand = uniqid(); @@ -55,11 +51,33 @@ } else { die("[-] unable to extract doc\n"); } +$source = file_get_contents("/tmp/$rand/content.xml"); - +// add CHECK section into report if needed +if(isset($config->checkRef) && trim($config->checkRef) <> ""){ + $check_img = ' + + '; + $check_section = ' + + + + + CHECK Ref: {checkRef} + '; + $source = str_replace('{check_img}', $check_img, $source); + $source = str_replace('{check_section}', $check_section, $source); + echo "[+] Added CHECK section\n"; +}else{ + $check_section = ' + + + '; + $source = str_replace('{check_img}', "", $source); + $source = str_replace('{check_section}', $check_section, $source); +} // add config into template -$source = file_get_contents("/tmp/$rand/content.xml"); foreach ($config as $key => $value) { $source = str_replace('{'.$key.'}', $value, $source); } @@ -93,7 +111,27 @@ $value = str_replace(">", ">", $value); $value = str_replace("\n", "", $value); $templateSource = str_replace('{'.$key.'}', $value, $templateSource); + if($key == "risk"){ + switch ($togo) { + case 'Serious': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C2B2344F988E3C014.png', $templateSource); + break; + case 'High': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C478E326DAB1B0673.gif', $templateSource); + break; + case 'Medium': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C08AD11DB0A5D02CD.png', $templateSource); + break; + case 'Low': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C6CC3BB57AA64608B.gif', $templateSource); + break; + case 'Info': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C7365C375D1750C0F.gif', $templateSource); + break; + } + } } + $$togo .= $templateSource; echo "[+] added $togo: ".$singlevuln['title']."\n"; } diff --git a/ReportToolz/templates/odt/blank_template_v0.6.odt b/ReportToolz/templates/odt/blank_template_v0.6.odt new file mode 100755 index 0000000..8ee26a6 --- /dev/null +++ b/ReportToolz/templates/odt/blank_template_v0.6.odt Binary files differ diff --git a/ReportToolz/templates/odt/blank_template_v1.0.odt b/ReportToolz/templates/odt/blank_template_v1.0.odt new file mode 100755 index 0000000..48dd38a --- /dev/null +++ b/ReportToolz/templates/odt/blank_template_v1.0.odt Binary files differ diff --git a/ReportToolz/1GB.zip b/ReportToolz/1GB.zip new file mode 100644 index 0000000..c308c46 --- /dev/null +++ b/ReportToolz/1GB.zip Binary files differ diff --git a/ReportToolz/1GB.zip.1 b/ReportToolz/1GB.zip.1 new file mode 100644 index 0000000..e27d9cf --- /dev/null +++ b/ReportToolz/1GB.zip.1 Binary files differ diff --git a/ReportToolz/1GB.zip.2 b/ReportToolz/1GB.zip.2 new file mode 100644 index 0000000..fdd2fcd --- /dev/null +++ b/ReportToolz/1GB.zip.2 Binary files differ diff --git a/ReportToolz/rep2.php b/ReportToolz/rep2.php index 9cc9db3..b5eb6a2 100755 --- a/ReportToolz/rep2.php +++ b/ReportToolz/rep2.php @@ -72,6 +72,18 @@ //die(); echo "[=] fonts found: ".sizeof($fonts)."\n"; +// get template version used +$reader = new XMLReader(); +if (!$reader->open("/tmp/$rand/meta.xml")) die("[-] Failed to open 'meta.xml'\n"); +$templateVer = 0.0; +while ($reader->read()) { + if($reader->name == "dc:version"){ + $reader->read(); + $templateVer = number_format(floatval($reader->value), 2); + break; + } +} + // step through text:h and text:p elements to put them into an array $reader = new XMLReader(); if (!$reader->open("/tmp/$rand/content.xml")) die("[-] Failed to open 'content.xml'\n"); @@ -88,6 +100,7 @@ $start = 0; $end = 0; foreach($line as $key => $val){ if(strpos($val, "Discovered Vulnerabilities") === 0){ $start = $key; } + //if(strpos($val, "This section provides a quick guide to plan your remediation for the vulnerabilities discovered during the test.") === 0){ $end = $key-2; } if(strpos($val, "Observed Hosts and Services") === 0){ $end = $key-2; } $line[$key] = trim($val); } @@ -98,120 +111,241 @@ $switch = 0; $sub2 = 0; $sub3 = 1; -for ($i=$start; $i <= $end ; $i++) { - // change state (action to take) - /*** - * ~states~ - * 0 = do nothing - * 1 = next is title - * 2 = next is description - * 3 = next is solution - * 4 = next is remediation - * 5 = next is cvss no - * 6 = next is risk level - * 7 = next is hosts - * 8 = next possibly title - */ - switch ($line[$i]) { - case 'Discovered Vulnerabilieies': - $switch = 0; - break; - case 'Serious Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'High Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Medium Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Low Risk Vulnerabilities': - $sub2++; $sub3 = 1; - $switch = 1; - break; - case 'Description': - $switch = 2; - break; - case 'Solution': - $switch = 3; - break; - case 'Remediation': - $switch = 4; - break; - case 'CVSS Base Score': - $switch = 5; - break; - case 'Risk Level': - $switch = 6; - break; - case 'Vulnerabilities Exist On': - $switch = 7; - break; - case 'Potential Impact': - $switch = 9; - break; - default: - # code... - break; - } +if(number_format($templateVer, 2) >= number_format(1.0, 2)){ + echo "[=] Template $templateVer used\n"; + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Analysis': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } - //take action - switch ($switch) { - case 1: - $i++; - $vuln[$vulnPlace]['title'] = $line[$i]; - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 2: - @$vuln[$vulnPlace]['desc'] .= $line[$i]; - break; - case 3: - @$vuln[$vulnPlace]['fix'] .= $line[$i]; - break; - case 4: - $i++; - $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); - $switch = 0; - break; - case 5: - $i++; - $vuln[$vulnPlace]['cvss'] = $line[$i]; - $switch = 0; - break; - case 6: - $i++; - $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); - $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); - $switch = 0; - break; - case 7: - $i++; - $vuln[$vulnPlace]['hosts'] = $line[$i]; - $switch = 8; - $vulnPlace++; - break; - case 8: - $vuln[$vulnPlace]['title'] = trim($line[$i]); - $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; - $sub3++; - $switch = 0; - break; - case 9: - @$vuln[$vulnPlace]['impact'] .= $line[$i]; - break; - default: - # code... - break; - } + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + //$vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $line[$i+3] = str_replace("Vulnerability Img", "", $line[$i+3]); + $vuln[$vulnPlace]['risk'] = strstr(trim($line[$i+3]), ":", true); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i+3], strpos($line[$i+3], ":") + 1)); + $vuln[$vulnPlace]['impact'] = trim(strtok($line[$i+4], " ")); + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i+5], " ")); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } - //echo $line[$i]."\n"; // DEBUG + //echo $line[$i]."\n"; // DEBUG + } + $first_desc = explode("Description", $vuln[0]['desc']); + $vuln[0]['desc'] = $first_desc[sizeof($first_desc)-1]; +}else{ // old template or Dave's format + for ($i=$start; $i <= $end ; $i++) { + // change state (action to take) + /*** + * ~states~ + * 0 = do nothing + * 1 = next is title + * 2 = next is description + * 3 = next is solution + * 4 = next is remediation + * 5 = next is cvss no + * 6 = next is risk level + * 7 = next is hosts + * 8 = next possibly title + */ + switch ($line[$i]) { + case 'Discovered Vulnerabilities': + $switch = 0; + break; + case 'Serious Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'High Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Medium Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Low Risk Vulnerabilities': + $sub2++; $sub3 = 1; + $switch = 1; + break; + case 'Description': + $switch = 2; + break; + case 'Solution': + $switch = 3; + break; + case 'Remediation': + $switch = 4; + break; + case 'CVSS Base Score': + $switch = 5; + break; + case 'Risk Level': + $switch = 6; + break; + case 'Vulnerabilities Exist On': + $switch = 7; + break; + case 'Potential Impact': + $switch = 9; + break; + default: + # code... + break; + } + + //take action + switch ($switch) { + case 1: + $i++; + $vuln[$vulnPlace]['title'] = $line[$i]; + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 2: + @$vuln[$vulnPlace]['desc'] .= $line[$i]; + break; + case 3: + @$vuln[$vulnPlace]['fix'] .= $line[$i]; + break; + case 4: + $i++; + $vuln[$vulnPlace]['rem'] = trim(strtok($line[$i], " ")); + $switch = 0; + break; + case 5: + $i++; + $vuln[$vulnPlace]['cvss'] = $line[$i]; + $switch = 0; + break; + case 6: + $i++; + $vuln[$vulnPlace]['risk'] = trim(strtok($line[$i], " ")); + $vuln[$vulnPlace]['owasp'] = trim(substr($line[$i], strpos($line[$i], ":") + 1)); + $switch = 0; + break; + case 7: + $i++; + $vuln[$vulnPlace]['hosts'] = $line[$i]; + $switch = 8; + $vulnPlace++; + break; + case 8: + $vuln[$vulnPlace]['title'] = trim($line[$i]); + $vuln[$vulnPlace]['ref'] = "$sub1.$sub2.$sub3"; + $sub3++; + $switch = 0; + break; + case 9: + @$vuln[$vulnPlace]['impact'] .= $line[$i]; + break; + default: + # code... + break; + } + + //echo $line[$i]."\n"; // DEBUG + } } - // minor tidying of arrays for ($i=0; $i < sizeof($vuln) ; $i++) { if (strpos($vuln[$i]['desc'], "Description") === 0) $vuln[$i]['desc'] = substr($vuln[$i]['desc'], strlen("Description")); @@ -251,7 +385,15 @@ if(writeIssueTable($vuln, "Low", $resultsFolder."/findings_low.csv")) echo "[+] low issues: $resultsFolder/findings_serious.csv\n"; -if(writeAllTable($vuln, $resultsFolder."/findings_all.csv")) +$order = array('title', 'ref', 'desc', 'fix','rem','cvss','risk','impact','owasp','hosts'); +$orderedArray = array(); +foreach($vuln as $vn_no =>$vn){ + foreach ($order as $key) { + //echo $key."\n"; + $orderedArray[$vn_no][$key] = $vuln[$vn_no][$key]; + } +} +if(writeAllTable($orderedArray, $resultsFolder."/findings_all.csv")) echo "[+] all issues: $resultsFolder/findings_all.csv\n"; if(writeRemediationTable($vuln, $resultsFolder."/remediation.csv")) @@ -366,7 +508,9 @@ if(sizeof($vuln) > 0){ $fp = fopen($path, 'w'); fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF)); - fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk", "OWASP", "Affected")); + fputcsv($fp, array("Title", "Ref", "Description", "Solution", "Remediation", "CVSS", "Risk","Impact", "OWASP", "Affected")); + + //print_r($orderedArray); foreach ($vuln as $fields) { fputcsv($fp, $fields); } diff --git a/ReportToolz/repgen.php b/ReportToolz/repgen.php index a425b47..1597feb 100755 --- a/ReportToolz/repgen.php +++ b/ReportToolz/repgen.php @@ -5,9 +5,9 @@ /*** * Configuration options */ -$template = "templates/odt/blank_template_v0.5.odt"; -$CHECKtemplate = "templates/odt/blank_template_check_v0.4.odt"; -$vulnTemplate = "templates/odt/vuln_template.xml"; +$template = "templates/odt/blank_template_v1.0.odt"; +//$CHECKtemplate = "templates/odt/blank_template_check_v0.4.odt"; +$vulnTemplate = "templates/odt/vuln_template_v0.2.xml"; /*** * Main program - Don't edit below @@ -41,10 +41,6 @@ //get config file $config = json_decode(file_get_contents($filter->getParam("path")."config.conf")); -if(isset($config->checkRef) && trim($config->checkRef) <> ""){ - $template = $CHECKtemplate; // if checkRefset use CHECK template - echo "[+] using CHECK template\n"; -} // extract doc and get contents $rand = uniqid(); @@ -55,11 +51,33 @@ } else { die("[-] unable to extract doc\n"); } +$source = file_get_contents("/tmp/$rand/content.xml"); - +// add CHECK section into report if needed +if(isset($config->checkRef) && trim($config->checkRef) <> ""){ + $check_img = ' + + '; + $check_section = ' + + + + + CHECK Ref: {checkRef} + '; + $source = str_replace('{check_img}', $check_img, $source); + $source = str_replace('{check_section}', $check_section, $source); + echo "[+] Added CHECK section\n"; +}else{ + $check_section = ' + + + '; + $source = str_replace('{check_img}', "", $source); + $source = str_replace('{check_section}', $check_section, $source); +} // add config into template -$source = file_get_contents("/tmp/$rand/content.xml"); foreach ($config as $key => $value) { $source = str_replace('{'.$key.'}', $value, $source); } @@ -93,7 +111,27 @@ $value = str_replace(">", ">", $value); $value = str_replace("\n", "", $value); $templateSource = str_replace('{'.$key.'}', $value, $templateSource); + if($key == "risk"){ + switch ($togo) { + case 'Serious': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C2B2344F988E3C014.png', $templateSource); + break; + case 'High': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C478E326DAB1B0673.gif', $templateSource); + break; + case 'Medium': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C08AD11DB0A5D02CD.png', $templateSource); + break; + case 'Low': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C6CC3BB57AA64608B.gif', $templateSource); + break; + case 'Info': + $templateSource = str_replace('{risk_img}', '100000000000001C0000001C7365C375D1750C0F.gif', $templateSource); + break; + } + } } + $$togo .= $templateSource; echo "[+] added $togo: ".$singlevuln['title']."\n"; } diff --git a/ReportToolz/templates/odt/blank_template_v0.6.odt b/ReportToolz/templates/odt/blank_template_v0.6.odt new file mode 100755 index 0000000..8ee26a6 --- /dev/null +++ b/ReportToolz/templates/odt/blank_template_v0.6.odt Binary files differ diff --git a/ReportToolz/templates/odt/blank_template_v1.0.odt b/ReportToolz/templates/odt/blank_template_v1.0.odt new file mode 100755 index 0000000..48dd38a --- /dev/null +++ b/ReportToolz/templates/odt/blank_template_v1.0.odt Binary files differ diff --git a/ReportToolz/templates/odt/vuln_template_v0.2.xml b/ReportToolz/templates/odt/vuln_template_v0.2.xml new file mode 100644 index 0000000..3bd66d2 --- /dev/null +++ b/ReportToolz/templates/odt/vuln_template_v0.2.xml @@ -0,0 +1,144 @@ + + + + + + + {title} + + + + + + + +{description} + + + + + + + + + Description + + + + + + + + +{tech_description} + + + + + + + + + Solution + + + + + + + + +{solution} + + + + + + + + + Risk Analysis + + + + + + + + + + + + + + + Risk Level + + + + Impact + + + + + Remediation + + + + + + + + + + Vulnerability Img + + {risk}: {owasp} + + + + {impact} + + + + {remediation} + + + + + + + + + + + + CVSS Base Score + + + + + + + + +{cvss3_score} - {cvss3_vector} + + + + + + + + + Vulnerabilities Exist On + + + + + + + + +host + \ No newline at end of file