Ejemplo n.º 1
0
print "drawing graph took: " . (microtime(true) - $start) . " secs\n";
$start = microtime(true);
$fp = fopen('/usr/local/apache/htdocs/proxy_framework/stats', 'w+');
flock($fp, LOCK_EX);
$udata = new UniqueIPDatabase();
fwrite($fp, $udata->getDatabase()->entryCount() . "\n");
$files = scandir(PF_DIR);
$newfiles = array();
foreach ($files as $file) {
    if (strpos($file, "snapshot") !== false) {
        $newfiles[] = $file;
    }
}
$file = PF_DIR . "/" . $newfiles[count($newfiles) - 1];
$db = new DatabaseImpl($file);
$good = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_ARRAY, 8, 0));
fwrite($fp, "{$good}\n");
$bad = $db->entryCount() - $good;
fwrite($fp, "{$bad}\n");
$fast = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_COMPARE | SEARCH_ARRAY, 4, "<20", null, null, null, 0));
fwrite($fp, "{$fast}\n");
$slow = $good - $fast;
fwrite($fp, "{$slow}\n");
$ssl = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_ARRAY, 5, 1, null, null, 0));
fwrite($fp, "{$ssl}\n");
$http = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_ARRAY, 7, PROXY, 0));
fwrite($fp, "{$http}\n");
$socks4 = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_ARRAY, 7, SOCKS4, 0));
fwrite($fp, "{$socks4}\n");
$socks5 = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_ARRAY, 7, SOCKS5, 0));
fwrite($fp, "{$socks5}\n");