mucho sexupo
1 parent 55e1edd commit 794ba9b781c8844e568f5e763f10a2cf4bc8ac41
root authored on 6 Feb 2020
Showing 8 changed files
View
ReportToolz/1GB.zip 0 → 100644
Not supported
View
ReportToolz/1GB.zip.1 0 → 100644
Not supported
View
ReportToolz/1GB.zip.2 0 → 100644
Not supported
View
507
ReportToolz/rep2.php
$reader->close();
//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");
while ($reader->read()){
// find the content we want
$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);
}
 
$vulnPlace = 0;
$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;
}
 
//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
}
 
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++;
$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
}
$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"));
if (strpos($vuln[$i]['fix'], "Solution") === 0) $vuln[$i]['fix'] = substr($vuln[$i]['fix'], strlen("Solution"));
echo "[+] medium issues: $resultsFolder/findings_serious.csv\n";
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"))
echo "[+] remediation table: $resultsFolder/remediation.csv\n";
function writeAllTable($vuln, $path){
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);
}
fclose($fp);
View
81
ReportToolz/repgen.php
 
/***
* 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
*/
die("[-] no such folder! \n");
 
//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();
mkdir("/tmp/$rand");
echo "[+] doc extracted\n";
} 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 = '<draw:frame draw:style-name="fr9" draw:name="FPCheckLogo" text:anchor-type="frame" svg:x="0cm" svg:y="5.879cm" svg:width="6.83cm" svg:height="2.628cm" draw:z-index="40">
<draw:image xlink:href="Pictures/10000000000004A3000001C98E2CC6AE1D6F811E.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" loext:mime-type="image/jpeg"/>
</draw:frame>';
$check_section = '<text:p text:style-name="P26"/>
<text:p text:style-name="P26"/>
<text:p text:style-name="P26"/>
<text:p text:style-name="P26"/>
<text:p text:style-name="P26">
CHECK Ref: {checkRef}
</text:p>';
$source = str_replace('{check_img}', $check_img, $source);
$source = str_replace('{check_section}', $check_section, $source);
echo "[+] Added CHECK section\n";
}else{
$check_section = '<text:p text:style-name="P26">
<text:bookmark-start text:name="__RefHeading___Toc72207_536000782"/>
<text:bookmark-end text:name="__RefHeading___Toc72207_536000782"/>
</text:p>';
$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);
}
file_put_contents("/tmp/$rand/content.xml", $source);
$value = str_replace("<", "&lt;", $value);
$value = str_replace(">", "&gt;", $value);
$value = str_replace("\n", "</text:p><text:p text:style-name=\"Text_20_body\">", $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";
}
 
View
ReportToolz/templates/odt/blank_template_v0.6.odt 0 → 100755
Not supported
View
ReportToolz/templates/odt/blank_template_v1.0.odt 0 → 100755
Not supported
View
144
ReportToolz/templates/odt/vuln_template_v0.2.xml 0 → 100644
<text:list text:continue-numbering="true" text:style-name="Outline">
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:h text:outline-level="3"><text:span>{title}</text:span>
</text:h>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
<text:p text:style-name="Text_20_body">{description}</text:p>
<text:list text:continue-numbering="true" text:style-name="Outline">
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:h text:outline-level="4">Description</text:h>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
<text:p text:style-name="Text_20_body">{tech_description}</text:p>
<text:list text:continue-numbering="true" text:style-name="Outline">
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:h text:outline-level="4">Solution</text:h>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
<text:p text:style-name="Text_20_body">{solution}</text:p>
<text:list text:continue-numbering="true" text:style-name="Outline">
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:h text:outline-level="4">Risk Analysis</text:h>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
<table:table table:name="Table9" table:style-name="Table6">
<table:table-column table:style-name="Table9.A"/>
<table:table-column table:style-name="Table9.B"/>
<table:table-column table:style-name="Table9.C"/>
<table:table-header-rows><table:table-row table:style-name="Table10.1">
<table:table-cell table:style-name="Table9.A1" office:value-type="string">
<text:p text:style-name="Sapphire_20_Table_20_Header">Risk Level</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table9.C1" office:value-type="string">
<text:p text:style-name="Sapphire_20_Table_20_Header">
Impact
</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table9.C1" office:value-type="string">
<text:p text:style-name="Sapphire_20_Table_20_Header">
<text:span >Remediation</text:span>
</text:p>
</table:table-cell>
</table:table-row>
</table:table-header-rows>
<table:table-row>
<table:table-cell table:style-name="Table9.A2" office:value-type="string">
<text:p text:style-name="P59">
<draw:frame draw:style-name="fr5" draw:name="Image1" text:anchor-type="as-char" svg:width="0.741cm" svg:height="0.741cm" draw:z-index="40">
<draw:image xlink:href="Pictures/{risk_img}" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" loext:mime-type="image/png"/>
<svg:title>Vulnerability Img</svg:title>
</draw:frame>
<text:s/>{risk}: {owasp}</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table9.B2" office:value-type="string">
<text:p text:style-name="P59">
<text:span >{impact}</text:span>
</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table9.C2" office:value-type="string">
<text:p text:style-name="P30">{remediation}</text:p>
</table:table-cell>
</table:table-row>
</table:table>
<text:list text:continue-numbering="true" text:style-name="Outline">
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:h text:outline-level="4">CVSS Base Score</text:h>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
<text:p text:style-name="Text_20_body">{cvss3_score} - {cvss3_vector}</text:p>
<text:list text:continue-numbering="true" text:style-name="Outline">
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:list>
<text:list-item>
<text:h text:outline-level="4">Vulnerabilities Exist On</text:h>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
</text:list-item>
</text:list>
<text:p text:style-name="Text_20_body">host</text:p>
<text:p text:style-name="PageBreak"></text:p>
Buy Me A Coffee