function forEachSubFile($func, $params, $root, $incfilter = array(), $excfilter = array("ZZZZ"))
{
    $dh = opendir($root);
    while (false !== ($dirname = readdir($dh))) {
        if (is_dir($root . "/" . $dirname) && !in_array($dirname, array(".", "..", ".svn"))) {
            $dirh = opendir($root . "/" . $dirname);
            while (false !== ($filename = readdir($dirh))) {
                $thisfile = $root . "/" . $dirname . "/" . $filename;
                if (is_dir($thisfile)) {
                    continue;
                }
                if (anyMatch($thisfile, $excfilter)) {
                    continue;
                }
                if (!matchAll($thisfile, $incfilter)) {
                    continue;
                }
                if (wordlistShouldBeSplit($thisfile, $params)) {
                    splitWordlist($thisfile, $filename, $func, $params);
                } else {
                    $func($thisfile, $params);
                }
            }
        }
    }
}
예제 #2
0
            $func($params['wordlist'], $params);
        }
        break;
    case 5.4:
        $params = array();
        $params["rules"] = 1;
        $params['wordlist'] = 'build/wordlists/extralarge/nsfw_ascii_art.txt';
        if (getAppZip()) {
            $params['wordlist'] .= ".xz";
        }
        $params["wordlist-flags"] = JOHN_WL_FORLOWERCASE | HASHCAT_WL_238K | CUDAHASHCAT_WL_238K;
        $func = create_function('$filename, $params', '
			global $wordlist_stamped, $app;
			$wordlist_stamped = copyfile($filename, "wl");
			$params["wordlist"] = $filename;
			writeJob($params);
			');
        if (wordlistShouldBeSplit($params['wordlist'], $params)) {
            splitWordlist($params['wordlist'], basename($params['wordlist']), $func, $params);
        } else {
            $func($params['wordlist'], $params);
        }
        break;
    default:
        echo "This phase is not implemented.\n";
        break;
}
fwrite($f, "rm createWorkScript\n");
//fwrite($f,"chown -R apache download/\n");
fclose($f);
echo "\ndone, created " . ($jobNum - 1) . " jobs\n";