diff --git a/ReportToolz/rep2.php b/ReportToolz/rep2.php index d53efa3..2d55ad7 100755 --- a/ReportToolz/rep2.php +++ b/ReportToolz/rep2.php @@ -358,6 +358,17 @@ //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")); @@ -367,6 +378,24 @@ 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