當前位置: 首頁>>代碼示例>>PHP>>正文


PHP unix::StringToGrep方法代碼示例

本文整理匯總了PHP中unix::StringToGrep方法的典型用法代碼示例。如果您正苦於以下問題:PHP unix::StringToGrep方法的具體用法?PHP unix::StringToGrep怎麽用?PHP unix::StringToGrep使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在unix的用法示例。


在下文中一共展示了unix::StringToGrep方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: access_events

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>";
}
開發者ID:BillTheBest,項目名稱:1.6.x,代碼行數:18,代碼來源:haarp.php

示例2: audit_log

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>";
}
開發者ID:BillTheBest,項目名稱:1.6.x,代碼行數:22,代碼來源:zarafa.php

示例3: fetchmail_logs

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>";
}
開發者ID:articatech,項目名稱:artica,代碼行數:22,代碼來源:cmd.php

示例4: www_events

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>";
}
開發者ID:articatech,項目名稱:artica,代碼行數:24,代碼來源:nginx.php

示例5: query_maillog

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);
}
開發者ID:BillTheBest,項目名稱:1.6.x,代碼行數:73,代碼來源:postfix.php

示例6: events

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));
}
開發者ID:articatech,項目名稱:artica,代碼行數:23,代碼來源:privoxy.php

示例7: squiddb_query

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>";
}
開發者ID:articatech,項目名稱:artica,代碼行數:25,代碼來源:system.php

示例8: accesslogs

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>";
}
開發者ID:articatech,項目名稱:artica,代碼行數:28,代碼來源:squid.php


注:本文中的unix::StringToGrep方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。