Beispiel #1
0
     foreach ($val as $k2 => $v2) {
         $f2s = $key . '/' . $v2;
         //key is path, v2 is filename
         if (substr($f2s, -3) == 'php' && substr($f2s, -7) != 'gis.php') {
             if (!$htmlMode && $scanner->getOutput() != 'silent') {
                 $counter++;
                 $perc = round(100 * ($counter / $totalFiles), 1, PHP_ROUND_HALF_EVEN);
                 //TODO find out why there are x2 checks???
                 $modulo = fmod($perc, $firstDigit);
                 if ($modulo == 0) {
                     //fwrite(STDOUT,$perc."%..");
                     fwrite(STDOUT, "..");
                 }
             }
             //$output .= 'File: '.$f2s.PHP_EOL;
             $scanner->setNewf2s($f2s);
             $scanner->scanFile("all", $patternData, $stringData);
             if (count($scanner->found)) {
                 foreach ($scanner->found as $l) {
                     $found .= $l;
                 }
                 $output .= "{$bS}{$f2s}{$bE}" . $eol . '---------------' . $eol . $found . '---------------' . $eol;
                 array_splice($scanner->found, 0, count($scanner->found));
                 //truncate found results array
                 $found = '';
                 //truncate found results
             }
         }
     }
 } else {
     //TODO not sure if this is needed!
Beispiel #2
0
//add steps
include_once 'lib/step_simplestring.php';
$scanner->addStep(new StepSimplestring($scanner, $log));
include_once 'lib/step_simplepattern.php';
$scanner->addStep(new StepSimplepattern($scanner, $log));
include_once 'lib/step_preg.php';
$scanner->addStep(new StepPreg($scanner, $log));
include_once 'lib/step_wp.php';
$scanner->addStep(new StepWP($scanner, $log));
include_once 'lib/step_comments.php';
$scanner->addStep(new StepComments($scanner, $log));
//run scan
$filenum = count($scanner->files);
$log->logHeader();
$log->logNormal('Scanning: ' . $filenum . " file(s)", 0);
//parse in steps
$scanner->prepareSteps();
//real scan
$at = 0;
foreach ($scanner->files as $onefile) {
    $log->logFilename($onefile);
    $scanner->setNewf2s($onefile);
    $scanner->scanFile();
    $at++;
    $log->logUpdateStatus($filenum, $at);
}
$log->logFooter($filenum, $scanner);
//write log at the end
if ($scanner->nologfile == false) {
    $log->flushLogToFile();
}