| |
---|
| | |
---|
| | //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"; |
---|
| |
---|
| | |