Ejemplo n.º 1
0
function dir_apply($dir, $callback, $path = false, $hidden = false, $maxcall = 0, $params = null, $recurse = false)
{
    $n = 0;
    if (!is_dir($dir)) {
        return 0;
    }
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            // if we're processing hidden files or the file is not a hidden file
            // we do the call back
            if ($hidden || substr($file, 0, 1) != '.') {
                // prefix with the full name of the path if the caller wants it so
                if ($recurse && is_dir($dir . "/" . $file)) {
                    if ($file != '.' && $file != '..' && !is_link($dir . "/" . $file)) {
                        dir_apply($dir . "/" . $file, $callback, $path, $hidden, $maxcall, $params, $recurse);
                    }
                } else {
                    if ($path) {
                        $file = $dir . "/" . $file;
                    }
                    if ($callback) {
                        if ($params) {
                            eval("{$callback}(\$" . "file,\$" . "params);");
                        } else {
                            eval("{$callback}(\$" . "file);");
                        }
                    }
                }
                $n++;
                if ($maxcall && $n >= $maxcall) {
                    break;
                }
            }
        }
        closedir($dh);
    }
    return $n;
}
Ejemplo n.º 2
0
    echo "<td><a href='{$url}'>" . substr($url, 0, 20) . "...</a></td>\n";
    echo "<td></td>\n";
    echo "<td></td>\n";
    echo "</tr>\n";
}
function ec_header()
{
    echo "<tr>\n";
    echo "<th>Domain:</th>\n";
    echo "<th>Evercookie Url:</th>\n";
    echo "<th>Kind:</th>\n";
    echo "<th>Comments:</th>\n";
    echo "</tr>\n";
}
$ranking = load_ranking("top-1m.csv");
dir_apply($inputdir, "process_domain");
// show which hosts were found how many times
asort($hosts);
echo "resource distribution (divided by 10):\n";
ksort($nresources);
print_r($nresources);
echo "domains using evercookies:\n";
echo "domains using evercookies directly:\n";
echo "<table>\n";
ec_header();
foreach (@$domains['evercookie'] as $d => $url) {
    if (contains($url, $d)) {
        list_ec_domain($d, $url);
    }
}
echo "</table>\n";