| |
---|
| | if ($filter->getParam("path") == false) |
---|
| | die("[-] no path set\n"); |
---|
| | |
---|
| | // load vdb vulns |
---|
| | $vdbVulns = getDirContents($vulnDB); |
---|
| | $vdbVulns = getDirContents($vulnDB, '/\.json$/'); |
---|
| | foreach($vdbVulns as $h => $i){ // remove begining of vdb path (keeps clean) |
---|
| | $vdbVulns[$h] = str_replace($vulnDB, "", $i); |
---|
| | } |
---|
| | echo "VDB: ".sizeof($vdbVulns).", "; |
---|
| |
---|
| | |reporting easier for everyone! | |
---|
| | |_______________________________________________|\n"; |
---|
| | |
---|
| | |
---|
| | function getDirContents($path) { |
---|
| | $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); |
---|
| | function getDirContents($dir, $filter = '', &$results = array()) { |
---|
| | $files = scandir($dir); |
---|
| | |
---|
| | $files = array(); |
---|
| | foreach ($rii as $file) |
---|
| | if (!$file->isDir()) |
---|
| | $files[] = $file->getPathname(); |
---|
| | foreach($files as $key => $value){ |
---|
| | $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
---|
| | |
---|
| | return $files; |
---|
| | } |
---|
| | if(!is_dir($path)) { |
---|
| | if(empty($filter) || preg_match($filter, $path)) $results[] = $path; |
---|
| | } elseif($value != "." && $value != "..") { |
---|
| | getDirContents($path, $filter, $results); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | return $results; |
---|
| | } |
---|
| | |
---|
| | |