function printoutput($output, $treestyle = 1) { if (!empty($output)) { $nr = 0; reset($output); do { if (key($output) != "" && !empty($output[key($output)]) && fileHasVulns($output[key($output)])) { //echo '<div class="filebox">', //'<span class="filename">File: ',key($output),'</span><br>', //'<div id="',key($output),'"><br>'; echo "{'file': '" . key($output) . "', "; //nishant foreach ($output[key($output)] as $vulnBlock) { if ($vulnBlock->vuln) { $nr++; //echo '<div class="vulnblock">', //'<div id="pic',$vulnBlock->category,$nr,'" class="minusico" name="pic',$vulnBlock->category,'" style="margin-top:5px" title="minimize"', //' onClick="hide(\'',$vulnBlock->category,$nr,'\')"></div><div class="vulnblocktitle">',$vulnBlock->category,'</div>', //'</div><div name="allcats"><div class="vulnblock" style="border-top:0px" name="',$vulnBlock->category,'" id="',$vulnBlock->category,$nr,'">'; echo "'warning_type': '" . $vulnBlock->category . "', "; //nishant if ($treestyle == 2) { krsort($vulnBlock->treenodes); } foreach ($vulnBlock->treenodes as $tree) { /* echo '<div class="codebox"><table border=0>',"\n", '<tr><td valign="top" nowrap>',"\n", '<div class="fileico" title="review code" ', 'onClick="openCodeViewer(this,\'', addslashes($tree->filename), '\',\'', implode(',', $tree->lines), '\');"></div>'."\n", '<div id="pic',key($output),$tree->lines[0],'" class="minusico" title="minimize"', ' onClick="hide(\'',addslashes(key($output)),$tree->lines[0],'\')"></div><br />',"\n"; */ if (isset($GLOBALS['scan_functions'][$tree->name])) { // help button /* echo '<div class="help" title="get help" onClick="openHelp(this,\'', $vulnBlock->category,'\',\'',$tree->name,'\',\'', (int)!empty($tree->get),'\',\'', (int)!empty($tree->post),'\',\'', (int)!empty($tree->cookie),'\',\'', (int)!empty($tree->files),'\',\'', (int)!empty($tree->cookie),'\')"></div>',"\n"; */ if (isset($GLOBALS['F_DATABASE'][$tree->name]) || isset($GLOBALS['F_FILE_AFFECT'][$tree->name]) || isset($GLOBALS['F_FILE_READ'][$tree->name]) || isset($GLOBALS['F_LDAP'][$tree->name]) || isset($GLOBALS['F_XPATH'][$tree->name]) || isset($GLOBALS['F_POP'][$tree->name])) { // data leak scan if (!empty($vulnBlock->dataleakvar)) { /* echo '<div class="dataleak" title="check data leak" onClick="leakScan(this,\'', $vulnBlock->dataleakvar[1],'\',\'', // varname $vulnBlock->dataleakvar[0],'\', false)"></div>',"\n"; // line */ } else { $tree->title .= ' (Blind exploitation)'; //$tree->title .= ''; } } } if (!empty($tree->get) || !empty($tree->post) || !empty($tree->cookie) || !empty($tree->files) || !empty($tree->server)) { /* echo '<div class="hotpatch" title="hotpatch" ', 'onClick="openHotpatch(this, \'', addslashes($tree->filename), '\',\'',implode(',',array_unique($tree->get)), '\',\'',implode(',',array_unique($tree->post)), '\',\'',implode(',',array_unique($tree->cookie)), '\',\'',implode(',',array_unique($tree->files)), '\',\'',implode(',',array_unique($tree->server)),'\');"></div>',"\n", echo '<div class="exploit" title="generate exploit" ', 'onClick="openExploitCreator(this, \'', addslashes($tree->filename), '\',\'',implode(',',array_unique($tree->get)), '\',\'',implode(',',array_unique($tree->post)), '\',\'',implode(',',array_unique($tree->cookie)), '\',\'',implode(',',array_unique($tree->files)), '\',\'',implode(',',array_unique($tree->server)),'\');"></div>'; */ } // $tree->title //echo '</td><td><span class="vulntitle">',$tree->title,'</span>', //'<div class="code" id="',key($output),$tree->lines[0],'">',"\n"; echo "'description': '" . $tree->title . "', "; //nishant if ($treestyle == 1) { traverseBottomUp($tree); } else { if ($treestyle == 2) { traverseTopDown($tree); } } //echo '<ul><li>',"\n"; dependenciesTraverse($tree); //echo '</li></ul>',"\n", '</div>',"\n", '</td></tr></table></div>',"\n"; } if (!empty($vulnBlock->alternatives)) { //echo '<div class="codebox"><table><tr><td><ul><li><span class="vulntitle">Vulnerability is also triggered in:</span>'; echo 'Vulnerability is also triggered in:</br>'; foreach ($vulnBlock->alternatives as $alternative) { //echo '<ul><li>'.$alternative.'</li></ul>'; echo $alternative . '<br/>'; } //echo '</li></ul></td></table></div>'; } //echo '</div></div><div style="height:20px"></div>',"\n"; } } /* echo '</div><div class="buttonbox">',"\n", '<input type="submit" class="Button" value="hide all" ', 'onClick="hide(\'',addslashes(key($output)),'\')">',"\n", '</div></div><hr>',"\n"; */ } else { if (count($output) == 1) { //echo '<div style="margin-left:30px;color:#000000">Nothing vulnerable found. Change the verbosity level or vulnerability type and try again.</div>'; echo 'Nothing vulnerable found. Change the verbosity level or vulnerability type and try again.'; } } } while (next($output)); } else { if (count($GLOBALS['scanned_files']) > 0) { //echo '<div style="margin-left:30px;color:#000000">Nothing vulnerable found. Change the verbosity level or vulnerability type and try again.</div>'; echo 'Nothing vulnerable found. Change the verbosity level or vulnerability type and try again.'; } else { //echo '<div style="margin-left:30px;color:#000000">Nothing to scan. Please check your path/file name.</div>'; echo 'Nothing to scan. Please check your path/file name.'; } } }
function printoutput($output, $treestyle = 1) { if (!empty($output)) { $nr = 0; reset($output); do { if (key($output) != "" && !empty($output[key($output)]) && fileHasVulns($output[key($output)])) { echo '<div class="filebox">', '<span class="filenames hide">File: ', key($output), '</span>', '<div id="', key($output), '">'; $total_issues = 0; $issuenames = array(); foreach ($_SESSION['stats']['vuln'] as $issue => $data) { $issuenames[] = $issue . ' (' . $data['count'] . ')'; $total_issues += $data['count']; } require_once 'dm_functions.php'; $overview = 'Found ' . $total_issues . ' error'; $overview .= $total_issues == 1 ? '' : 's'; $overview .= ' of type'; $overview .= count($issuenames) == 1 ? '' : 's'; $overview .= ' ' . arrayToSentence($issuenames); echo '<pre class="report_summary"> ' . strtoupper($overview) . '</pre>'; #echo "<br/>".str_replace (' ', ' ',nl2br(var_export($_SESSION, TRUE)));die("<br/>".date("H:i:s").' => "'.__FILE__.'": Line '.__LINE__); foreach ($output[key($output)] as $vulnBlock) { if ($vulnBlock->vuln) { $nr++; echo '<div class="vulnblock">', '<div id="pic', $vulnBlock->category, $nr, '" class="minusico" name="pic', $vulnBlock->category, '" style="margin-top:5px" title="minimize"', ' onClick="hide(\'', $vulnBlock->category, $nr, '\')"></div><div class="vulnblocktitle">', $vulnBlock->category, '</div>', '</div><div name="allcats"><div class="vulnblock" style="border-top:0px" name="', $vulnBlock->category, '" id="', $vulnBlock->category, $nr, '">'; if ($treestyle == 2) { krsort($vulnBlock->treenodes); } foreach ($vulnBlock->treenodes as $tree) { echo '<div class="codebox"><table border=0>', "\n", '<tr><td class="iconbox hide" valign="top" nowrap>', "\n", '<div class="fileico" title="review code" ', 'onClick="openCodeViewer(this,\'', addslashes($tree->filename), '\',\'', implode(',', $tree->lines), '\');"></div>' . "\n", '<div id="pic', key($output), $tree->lines[0], '" class="minusico" title="minimize"', ' onClick="hide(\'', addslashes(key($output)), $tree->lines[0], '\')"></div><br />', "\n"; if (isset($GLOBALS['scan_functions'][$tree->name])) { // help button echo '<div class="help" title="get help" onClick="openHelp(this,\'', $vulnBlock->category, '\',\'', $tree->name, '\',\'', (int) (!empty($tree->get)), '\',\'', (int) (!empty($tree->post)), '\',\'', (int) (!empty($tree->cookie)), '\',\'', (int) (!empty($tree->files)), '\',\'', (int) (!empty($tree->cookie)), '\')"></div>', "\n"; if (isset($GLOBALS['F_DATABASE'][$tree->name]) || isset($GLOBALS['F_FILE_AFFECT'][$tree->name]) || isset($GLOBALS['F_FILE_READ'][$tree->name]) || isset($GLOBALS['F_LDAP'][$tree->name]) || isset($GLOBALS['F_XPATH'][$tree->name]) || isset($GLOBALS['F_POP'][$tree->name])) { // data leak scan if (!empty($vulnBlock->dataleakvar)) { echo '<div class="dataleak" title="check data leak" onClick="leakScan(this,\'', $vulnBlock->dataleakvar[1], '\',\'', $vulnBlock->dataleakvar[0], '\', false)"></div>', "\n"; // line } else { $tree->title .= ' (Blind exploitation)'; } } } if (!empty($tree->get) || !empty($tree->post) || !empty($tree->cookie) || !empty($tree->files) || !empty($tree->server)) { /*echo '<div class="hotpatch" title="hotpatch" ', 'onClick="openHotpatch(this, \'', addslashes($tree->filename), '\',\'',implode(',',array_unique($tree->get)), '\',\'',implode(',',array_unique($tree->post)), '\',\'',implode(',',array_unique($tree->cookie)), '\',\'',implode(',',array_unique($tree->files)), '\',\'',implode(',',array_unique($tree->server)),'\');"></div>',"\n",*/ echo '<div class="exploit" title="generate exploit" ', 'onClick="openExploitCreator(this, \'', addslashes($tree->filename), '\',\'', implode(',', array_unique($tree->get)), '\',\'', implode(',', array_unique($tree->post)), '\',\'', implode(',', array_unique($tree->cookie)), '\',\'', implode(',', array_unique($tree->files)), '\',\'', implode(',', array_unique($tree->server)), '\');"></div>'; } // $tree->title echo '</td><td class="before-vulntitle"><span class="vulntitle">', $tree->title, '</span>', '<div class="code" id="', key($output), $tree->lines[0], '">', "\n"; if ($treestyle == 1) { traverseBottomUp($tree); } else { if ($treestyle == 2) { traverseTopDown($tree); } } echo '<ul><li>', "\n"; dependenciesTraverse($tree); echo '</li></ul>', "\n", '</div>', "\n", '</td></tr></table></div>', "\n"; } if (!empty($vulnBlock->alternatives)) { echo '<div class="codebox"><table><tr><td><ul><li><span class="vulntitle">Vulnerability is also triggered in:</span>'; foreach ($vulnBlock->alternatives as $alternative) { echo '<ul><li>' . $alternative . '</li></ul>'; } echo '</li></ul></td></table></div>'; } echo '</div></div><div style="height:10px"></div>', "\n"; } } echo '</div><div class="buttonbox">', "\n", '<input type="submit" class="Button" value="hide all" ', 'onClick="hide(\'', addslashes(key($output)), '\')">', "\n", '</div></div>', "\n"; } else { if (count($output) == 1) { echo '<div class="report"><pre><div class="report_summary clean"> GREAT JOB. NO ERRORS FOUND :-) </div></pre></div>'; } } } while (next($output)); } else { if (count($GLOBALS['scanned_files']) > 0) { echo '<div class="report"><pre><div class="report_summary clean"> GREAT JOB. NO ERRORS FOUND :-) </div></pre></div>'; } else { echo '<div style="margin-left:30px;color:#000000">Nothing to scan. Please check your path/file name.</div>'; } } }