Example #1
0
if ($numOfargz < 2 || $scannerOptions == '--help' || $o2s == '--help') {
    Usage($eol);
}
//get the object's info
if (file_exists($o2s)) {
    if (!$htmlMode) {
        // FIXME when output option is silent???
        fwrite(STDOUT, PHP_EOL . "{$blue} " . '* Ghost In the Shell php security file scanner*' . " {$RST}" . PHP_EOL . PHP_EOL);
        fwrite(STDOUT, "please wait while scanning..." . PHP_EOL);
    }
    if (is_dir($o2s)) {
        $scanner = new Scanner($o2s, $eol, $htmlMode, $scannerOptions);
        $scanner->getDirContents($o2s, true);
        $totalFiles = count($scanner->files);
        $output_head = "List: " . $totalFiles . " files " . $eol;
        if (!$htmlMode && $scanner->getOutput() != 'silent') {
            fwrite(STDOUT, "Scanning " . $totalFiles . " files" . PHP_EOL);
        }
        $counter = 0;
        $firstDigit = substr($totalFiles, 0, 1);
        foreach ($scanner->files as $key => $val) {
            if (is_array($val)) {
                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);