Example #1
0
    # http://localhost/server-status or otherwise, needs mod_status
    # ------------------------------------------------------------
    // the request for server status
    $server_status = file_get_contents("http://localhost/server-status");
    if ($server_status) {
        // Our great regex
        preg_match_all("@((?:\\d{1,3}\\.){3}\\d{1,3})@", $server_status, $matches);
        // Gather up connection and IP info
        foreach ($matches[1] as $k => $v) {
            $iparray[$v]++;
        }
        // Sort it all out
        foreach ($iparray as $k => $v) {
            if ($v > $apache_connections_limit) {
                $snap_log = 1;
                firewall($k, "{$v} httpd connections detected.");
            }
        }
        unset($iparray);
        // Did IPs get banned? Take an HTML based snapshot of the
        // page so we can see what it looked like.
        if ($snap_log) {
            $server_status_log = @fopen("./flood_logs/server-status-" . time() . ".txt", "a");
            @fwrite($server_status_log, $server_status);
            @fclose($server_status_log);
        }
        unset($snap_log);
    }
    sleep(4);
    echo "Checking...\n";
}
Example #2
0
    exit;
}
if (isset($_GET["rrd-perform"])) {
    rrd_perform();
    exit;
}
if (isset($_GET["squidhour-repair-exec"])) {
    squidhour_repair_executed();
    exit;
}
if (isset($_GET["squidhour-repair"])) {
    squidhour_repair();
    exit;
}
if (isset($_GET["firewall"])) {
    firewall();
    exit;
}
if (isset($_GET["prepare-build"])) {
    prepare_build();
    exit;
}
if (isset($_GET["prepare-build-tests"])) {
    prepare_build_tests();
    exit;
}
if (isset($_GET["saveSquidContent"])) {
    saveSquidContent();
    exit;
}
if (isset($_GET["logrotate-tenir"])) {
Example #3
0
    echo suricata_dashboard();
    die;
}
if ($argv[1] == "--parse-rules") {
    $GLOBALS["OUTPUT"] = true;
    parse_rulesToPostGres();
    die;
}
if ($argv[1] == "--reload-progress") {
    $GLOBALS["OUTPUT"] = true;
    reload_progress();
    die;
}
if ($argv[1] == "--firewall") {
    $GLOBALS["OUTPUT"] = true;
    firewall($argv[2]);
    die;
}
function build_progress($text, $pourc)
{
    echo "{$pourc}% {$text}\n";
    $cachefile = "/usr/share/artica-postfix/ressources/logs/suricata.install.progress";
    if (is_numeric($text)) {
        $array["POURC"] = $text;
        $array["TEXT"] = $pourc;
    } else {
        $array["POURC"] = $pourc;
        $array["TEXT"] = $text;
    }
    @file_put_contents($cachefile, serialize($array));
    @chmod($cachefile, 0755);