Exemplo n.º 1
0
function access_events()
{
    $filename = "/var/log/squid/haarp.access.log";
    $search = $_GET["access-events"];
    $unix = new unix();
    $search = $unix->StringToGrep($search);
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $refixcmd = "{$tail} -n 2500 {$filename}";
    if ($search != null) {
        $refixcmd = $refixcmd . "|{$grep} -i -E '{$search}'|{$tail} -n 500";
    } else {
        $refixcmd = "{$tail} -n 500 {$filename}";
    }
    exec($refixcmd . " 2>&1", $results);
    writelogs_framework($refixcmd . " (" . count($results) . ")", __FUNCTION__, __FILE__, __LINE__);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
Exemplo n.º 2
0
function audit_log()
{
    $unix = new unix();
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $search = trim(base64_decode($_GET["filter"]));
    $maillog = "/var/log/auth.log";
    $prefix = "{$grep} -i -E '\\s+zarafa\\-(spooler|server|gateway|dagent|license)\\[' {$maillog}|";
    $max = 500;
    if (isset($_GET["rp"])) {
        $max = $_GET["rp"];
    }
    if ($search != null) {
        $search = $unix->StringToGrep($search);
        $cmd = "{$prefix}{$grep} -i -E '{$search}' |{$tail} -n {$max} 2>&1";
    } else {
        $cmd = "{$prefix}{$tail} -n {$max} 2>&1";
    }
    writelogs_framework("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
    exec($cmd, $results);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
Exemplo n.º 3
0
function fetchmail_logs()
{
    $unix = new unix();
    $search = trim(base64_decode($_GET["search"]));
    $tail = $unix->find_program("tail");
    $grep = $unix->find_program("grep");
    $sourcefile = "/var/log/fetchmail.log";
    $rp = 25;
    if (is_numeric($_GET["rp"])) {
        $rp = $_GET["rp"];
    }
    if ($search == null) {
        $cmd = "{$tail} -n {$rp} {$sourcefile} 2>&1";
        writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
        exec($cmd, $results);
        echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
        return;
    }
    $search = $unix->StringToGrep($search);
    exec("{$grep} -i -E '{$search}' /var/log/fetchmail.log|{$tail} -n {$rp}", $results);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
Exemplo n.º 4
0
function www_events()
{
    $servername = $_GET["servername"];
    $port = $_GET["port"];
    $type = $_GET["type"];
    $filename = "/var/log/apache2/{$servername}/nginx.access.log";
    if ($type == 2) {
        $filename = "/var/log/apache2/{$servername}/nginx.error.log";
    }
    $search = $_GET["search"];
    $unix = new unix();
    $search = $unix->StringToGrep($search);
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $refixcmd = "{$tail} -n 2500 {$filename}";
    if ($search != null) {
        $refixcmd = $refixcmd . "|{$grep} -i -E '{$search}'|{$tail} -n 500";
    } else {
        $refixcmd = "{$tail} -n 500 {$filename}";
    }
    exec($refixcmd . " 2>&1", $results);
    writelogs_framework($refixcmd . " (" . count($results) . ")", __FUNCTION__, __FILE__, __LINE__);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
Exemplo n.º 5
0
function query_maillog()
{
    $unix = new unix();
    $maillog = $_GET["maillog"];
    if ($maillog == null) {
        echo "<articadatascgi>" . base64_encode(serialize(array())) . "</articadatascgi>";
        return;
    }
    $maillogSecond = $maillog;
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $search = trim(base64_decode($_GET["filter"]));
    $emails = unserialize(base64_decode($_GET["emails"]));
    $zz = array();
    if (count($emails) > 0) {
        while (list($num, $line) = each($emails)) {
            if (trim($line) == null) {
                continue;
            }
            $zz[] = $line;
        }
        if (count($zz) > 0) {
            $searchEmails = "(" . @implode("|", $zz) . ")";
            writelogs_framework("searchEmails = \"{$searchEmails}\"", __FUNCTION__, __FILE__, __LINE__);
            $searchEmails = str_replace(".", "\\.", $searchEmails);
            $searchEmails = ".*?{$searchEmails}";
        }
    }
    if (isset($_GET["zarafa-filter"])) {
        if ($_GET["zarafa-filter"] == "yes") {
            $_GET["prefix"] = "\\s+zarafa\\-(spooler|server|gateway|dagent|license){$searchEmails}";
        }
    }
    if (isset($_GET["miltergrey-filter"])) {
        if ($_GET["miltergrey-filter"] == "yes") {
            $_GET["prefix"] = "\\s+milter-greylist{$searchEmails}";
        }
    }
    if (isset($_GET["mimedefang-filter"])) {
        if ($_GET["mimedefang-filter"] == "yes") {
            $_GET["prefix"] = "\\s+mimedefang(\\-multiplexor|\\[){$searchEmails}";
        }
    }
    if (isset($_GET["prefix"])) {
        $prefix = "{$grep} -i -E '{$_GET["prefix"]}(\\[|:){$searchEmails}' {$maillog}|";
        $maillogSecond = null;
    }
    $filename = "/usr/share/artica-postfix/ressources/logs/web/query.mail.log";
    $max = 500;
    if (isset($_GET["rp"])) {
        $max = $_GET["rp"];
    }
    if ($search != null) {
        $search = $unix->StringToGrep($search);
        if ($searchEmails != null) {
            $cmd = "{$prefix}{$grep} -i -E '{$searchEmails}' {$maillog}|{$grep} -E '{$search}'|{$tail} -n {$max} >{$filename} 2>&1";
        } else {
            $cmd = "{$prefix}{$grep} -i -E '{$search}' {$maillogSecond}|{$tail} -n {$max} >{$filename} 2>&1";
        }
    } else {
        if ($prefix != null) {
            $cmd = "{$prefix}{$tail} -n {$max} >{$filename} 2>&1";
        } else {
            if ($searchEmails != null) {
                $cmd = "{$grep} -i -E '{$searchEmails}' {$maillog}|{$tail} -n {$max} >{$filename} 2>&1";
            } else {
                $cmd = "{$tail} -n {$max} {$maillog} >{$filename} 2>&1";
            }
        }
    }
    writelogs_framework("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
    exec($cmd, $results);
}
Exemplo n.º 6
0
function events()
{
    $search = trim(base64_decode($_GET["ss5events"]));
    $unix = new unix();
    $tail = $unix->find_program("tail");
    $grep = $unix->find_program("grep");
    $rp = 500;
    if (is_numeric($_GET["rp"])) {
        $rp = $_GET["rp"];
    }
    if ($search == null) {
        $cmd = "{$grep} -i -E 'Crunch:' /var/log/privoxy/privoxy.log|{$tail} -n {$rp} 2>&1";
        writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
        exec($cmd, $results);
        @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/privoxy-events", serialize($results));
        return;
    }
    $search = $unix->StringToGrep($search);
    $cmd = "{$grep} -i -E 'Crunch:' /var/log/privoxy/privoxy.log|{$grep} -i -E '{$search}'|{$tail} -n {$rp} 2>&1";
    writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
    exec("{$cmd}", $results);
    @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/privoxy-events", serialize($results));
}
Exemplo n.º 7
0
function squiddb_query()
{
    $filelog = "/opt/squidsql/error.log";
    $unix = new unix();
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $search = trim(base64_decode($_GET["search"]));
    $prefix = null;
    $max = 500;
    if (isset($_GET["rp"])) {
        $max = $_GET["rp"];
    }
    if ($search != null) {
        $prefix = "{$grep} -i -E '{$search}' {$filelog}| ";
    }
    if ($search != null) {
        $search = $unix->StringToGrep($search);
        $cmd = "{$grep} -i -E '{$search}' {$filelog}| {$tail} -n {$max} 2>&1";
    } else {
        $cmd = "{$tail} -n {$max} {$filelog} 2>&1";
    }
    writelogs_framework("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
    exec($cmd, $results);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
Exemplo n.º 8
0
function accesslogs()
{
    $search = trim(base64_decode($_GET["accesslogs"]));
    $OnlyIpAddr = $_GET["OnlyIpAddr"];
    if ($OnlyIpAddr != null) {
        $OnlyIpAddr = str_replace(".", "\\.", $OnlyIpAddr);
        $OnlyIpAddr = ".*?{$OnlyIpAddr}";
    }
    $unix = new unix();
    $tail = $unix->find_program("tail");
    $grep = $unix->find_program("grep");
    $rp = 500;
    if (is_numeric($_GET["rp"])) {
        $rp = $_GET["rp"];
    }
    if ($search == null) {
        $cmd = "{$tail} -n 3000 /var/log/auth.log|{$grep} -i -E 'squid.*?{$OnlyIpAddr}'|{$tail} -n {$rp} 2>&1";
        writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
        exec("{$cmd}", $results);
        echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
        return;
    }
    $search = $unix->StringToGrep($search);
    $cmd = "{$tail} -n 3000 /var/log/auth.log|{$grep} -i -E 'squid([\\[|\\-])' 2>&1|{$grep} -E '{$search}' 2>&1|{$tail} -n {$rp} 2>&1";
    writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
    exec("{$cmd}", $results);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}