supports JSON summary tags
1 parent 6a11295 commit 3a3fcea84172cfeb35c602f8ee6495a0bc0cec95
root authored on 28 Jan 2021
Showing 1 changed file
View
29
ReportToolz/rep2.php
 
//echo $line[$i]."\n"; // DEBUG
}
}
 
// get all vulns.json if there are any
$currentPath = dirname($filter->getParam("doc"));
$jsonVuln = array();
$jsonFiles = glob($currentPath."/*.json");
foreach($jsonFiles as $finding){
$placeholder = json_decode(file_get_contents($finding), true);
if(isset($placeholder['title'])) // is a vuln and not config file
$jsonVuln[] = $placeholder;
}
 
// 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"));
// remove html encoding
foreach($vuln[$i] as $key => $val){
$vuln[$i][$key] = mb_convert_encoding($val, "UTF-8", 'UTF-8');
}
 
// fixing summary tables
$descExpl = explode(".", $vuln[$i]['desc']);
$fixExpl = explode(".", $vuln[$i]['fix']);
$vuln[$i]['desc'] = $descExpl[0];
$vuln[$i]['fix'] = $fixExpl[0];
foreach($jsonVuln as $id => $jsonIssue){
if($jsonIssue['title'] == $vuln[$i]['title']){
if(isset($jsonIssue['summary_issue']) || isset($jsonIssue['summary_solution'])){
echo "[+] summary found for: ".$vuln[$i]['title']."\n";
$vuln[$i]['desc'] = $jsonIssue['summary_issue'];
$vuln[$i]['fix'] = $jsonIssue['summary_solution'];
}
}
}
 
}
 
//print_r($vuln); // DEBUG
echo "[+] vulnerabilities identified\n";
Buy Me A Coffee