Пример #1
0
include_once $NETCAT_FOLDER . "vars.inc.php";
require $ADMIN_FOLDER . "function.inc.php";
require $ADMIN_FOLDER . "report/system.inc.php";
$Delimeter = " &gt ";
$main_section = "report";
$item_id = 3;
$Title1 = BEGINHTML_ALARMOFF;
$Title2 = BEGINHTML_ALARMVIEW;
$Title3 = "<a href=" . $ADMIN_PATH . "report/system.php>" . SECTION_INDEX_REPORTS_SYSTEM . "</a>";
$UI_CONFIG = new ui_config_tool(SECTION_INDEX_REPORTS_SYSTEM, SECTION_INDEX_REPORTS_SYSTEM, 'i_netcat_big.gif', 'tools.systemmessages');
$perm->ExitIfNotAccess(NC_PERM_REPORT, 0, 0, 0, 1);
if ($SystemMessageID && $phase == 1) {
    $res = $db->query("UPDATE SystemMessage SET Date=Date,Checked=1 WHERE SystemMessage_ID=" . ($SystemMessageID + 0));
    $ANY_SYSTEM_MESSAGE = $db->get_var("SELECT count(*) FROM SystemMessage WHERE Checked=0");
}
LoadSettings();
if ($SystemMessageID && $phase != 1) {
    $UI_CONFIG->locationHash = "tools.systemmessages({$SystemMessageID})";
    BeginHtml($Title2, $Title3 . $Delimeter . $Title2, "http://" . $DOC_DOMAIN . "/reports/sysmessages/");
    if ($res = $db->get_row("SELECT * FROM SystemMessage WHERE SystemMessage_ID=" . ($SystemMessageID + 0), ARRAY_A)) {
        $Array = $res;
    }
    //  In MySQL 4.1, TIMESTAMP display format changes to be the same as DATETIME.
    if (substr($Array['Date'], 4, 1) != '-') {
        $Array['Date'] = nc_substr($Array['Date'], 0, 4) . "-" . nc_substr($Array['Date'], 4, 2) . "-" . nc_substr($Array['Date'], 6, 2) . " " . nc_substr($Array['Date'], 8, 2) . ":" . nc_substr($Array['Date'], 10, 2) . ":" . nc_substr($Array['Date'], 12, 2);
    }
    ?>
    <table class="admin_table" width='100%'>
        <tr>
            <td><b><?php 
    echo $Array["Description"];
Пример #2
0
function ufdbguard_checks($id)
{
    LoadSettings();
    if ($GLOBALS["VERBOSE"]) {
        $GLOBALS["output"] = true;
        echo "OPEN: /etc/squid3/ufdb.groups.{$id}.db\n";
    }
    if (!is_file("/etc/squid3/ufdb.groups.{$id}.db")) {
        if ($GLOBALS["output"]) {
            echo "Cannot perform this operation\nYou have to create correctly a Web filtering rule\nIncluding blacklists and whitelists\nAnd compile your Web filtering rules in order to dump groups\n";
        }
        return null;
    }
    $arrayGROUPS = unserialize(@file_get_contents("/etc/squid3/ufdb.groups.{$id}.db"));
    $FINAL = array();
    $Hash = array();
    if ($GLOBALS["VERBOSE"]) {
        echo "DUMP: ARRAY ***********************\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        print_r($arrayGROUPS);
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "***********************************\n";
    }
    if (isset($arrayGROUPS["EXT-LDAP"])) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Found:EXT-LDAP\n";
        }
        $extn_ldap = new ldap_extern();
        while (list($index, $DNS) = each($arrayGROUPS["EXT-LDAP"])) {
            if ($GLOBALS["VERBOSE"]) {
                echo "DN:{$DNS}\n";
            }
            $rr = $extn_ldap->HashUsersFromGroupDN($DNS);
            if ($GLOBALS["output"]) {
                echo "{$DNS} return " . count($rr) . " users\n";
            }
            while (list($a, $b) = each($rr)) {
                $b = trim($b);
                if ($b == null) {
                    continue;
                }
                echo "USER= {$b}\n";
                $MemberArray[$a] = $a;
            }
            while (list($a, $b) = each($MemberArray)) {
                $FINAL[] = $a;
            }
        }
    }
    if (isset($arrayGROUPS["EXTLDAP"])) {
        while (list($index, $CONFS) = each($arrayGROUPS["EXTLDAP"])) {
            $rr = external_ldap_members($CONFS["DN"], $CONFS["CONF"]);
            if ($GLOBALS["output"]) {
                echo "{$CONFS["DN"]} return " . count($rr) . " users\n";
            }
            while (list($a, $b) = each($rr)) {
                echo "USER= {$b}\n";
                $MemberArray[$a] = $a;
            }
        }
        while (list($a, $b) = each($MemberArray)) {
            $FINAL[] = $a;
        }
    }
    if (isset($arrayGROUPS["AD"])) {
        while (list($index, $DNenc) = each($arrayGROUPS["AD"])) {
            $DN = base64_decode($DNenc);
            if ($GLOBALS["output"]) {
                echo "Loading Active Directory groups...\n";
            }
            if ($GLOBALS["output"]) {
                echo "Branch {$DN}\n";
            }
            if ($GLOBALS["VERBOSE"]) {
                echo "DN, {$DN}\n";
            }
            $ldapExt = new external_acl_squid_ldap();
            $members = $ldapExt->AdLDAP_MembersFromGroup($DN);
            if ($GLOBALS["VERBOSE"]) {
                echo "DN, {$DN} -> " . count($members) . "\n";
            }
            while (list($a, $b) = each($members)) {
                $Hash[$b] = $b;
            }
        }
        while (list($a, $b) = each($Hash)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "USER= {$b}\n";
            }
            $FINAL[] = $b;
        }
    }
    if (isset($arrayGROUPS["LDAP"])) {
        while (list($index, $gpid) = each($arrayGROUPS["LDAP"])) {
            $Hash = HashUsersFromGPID($gpid);
            if (count($Hash) == 0) {
                WLOG("[QUERY]: ufdbguard_checks({$id}) GPID:{$gpid} store no user...");
                continue;
            }
            while (list($a, $b) = each($Hash)) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "USER= {$b}\n";
                }
                $FINAL[] = $b;
            }
        }
    }
    if ($GLOBALS["output"]) {
        echo "\nResults\n**********************************\n# # # # # # # # # # # # # # # # # # # # # #\n" . count($FINAL) . " item(s)\n# # # # # # # # # # # # # # # # # # # # # #\n";
    }
    if (count($FINAL) == 0) {
        WLOG("[QUERY]: ufdbguard_checks({$id}) no user...");
        return;
    }
    while (list($a, $Member) = each($FINAL)) {
        $Member = trim($Member);
        if ($Member == null) {
            continue;
        }
        $Member = str_replace(" ", "%20", $Member);
        $FINAL2[] = $Member;
    }
    echo @implode($FINAL2, "\n") . "\n";
}
Пример #3
0
function ufdbguard_checks($id)
{
    LoadSettings();
    if ($GLOBALS["VERBOSE"]) {
        $GLOBALS["output"] = true;
        echo "OPEN: /etc/squid3/ufdb.groups.{$id}.db\n";
    }
    $arrayGROUPS = unserialize(@file_get_contents("/etc/squid3/ufdb.groups.{$id}.db"));
    $FINAL = array();
    $Hash = array();
    if (isset($arrayGROUPS["EXT-LDAP"])) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Found:EXT-LDAP\n";
        }
        $extn_ldap = new ldap_extern();
        while (list($index, $DNS) = each($arrayGROUPS["EXT-LDAP"])) {
            if ($GLOBALS["VERBOSE"]) {
                echo "DN:{$DNS}\n";
            }
            $rr = $extn_ldap->HashUsersFromGroupDN($DNS);
            if ($GLOBALS["output"]) {
                echo "{$DNS} return " . count($rr) . " users\n";
            }
            while (list($a, $b) = each($rr)) {
                $b = trim($b);
                if ($b == null) {
                    continue;
                }
                echo "USER= {$b}\n";
                $MemberArray[$a] = $a;
            }
            while (list($a, $b) = each($MemberArray)) {
                $FINAL[] = $a;
            }
        }
    }
    if (isset($arrayGROUPS["EXTLDAP"])) {
        while (list($index, $CONFS) = each($arrayGROUPS["EXTLDAP"])) {
            $rr = external_ldap_members($CONFS["DN"], $CONFS["CONF"]);
            if ($GLOBALS["output"]) {
                echo "{$CONFS["DN"]} return " . count($rr) . " users\n";
            }
            while (list($a, $b) = each($rr)) {
                echo "USER= {$b}\n";
                $MemberArray[$a] = $a;
            }
        }
        while (list($a, $b) = each($MemberArray)) {
            $FINAL[] = $a;
        }
    }
    if (isset($arrayGROUPS["AD"])) {
        while (list($index, $DNenc) = each($arrayGROUPS["AD"])) {
            $DN = base64_decode($DNenc);
            if ($GLOBALS["VERBOSE"]) {
                echo "DN, {$DN}\n";
            }
            $ldapExt = new external_acl_squid_ldap();
            $members = $ldapExt->AdLDAP_MembersFromGroup($DN);
            if ($GLOBALS["VERBOSE"]) {
                echo "DN, {$DN} -> " . count($members) . "\n";
            }
            while (list($a, $b) = each($members)) {
                $Hash[$b] = $b;
            }
        }
        while (list($a, $b) = each($Hash)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "USER= {$b}\n";
            }
            $FINAL[] = $b;
        }
    }
    if (isset($arrayGROUPS["LDAP"])) {
        while (list($index, $gpid) = each($arrayGROUPS["LDAP"])) {
            $Hash = HashUsersFromGPID($gpid);
            if (count($Hash) == 0) {
                WLOG("[QUERY]: ufdbguard_checks({$id}) GPID:{$gpid} store no user...");
                continue;
            }
            while (list($a, $b) = each($Hash)) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "USER= {$b}\n";
                }
                $FINAL[] = $b;
            }
        }
    }
    if ($GLOBALS["output"]) {
        echo "\nResults\n**********************************\n# # # # # # # # # # # # # # # # # # # # # #\n" . count($FINAL) . " item(s)\n# # # # # # # # # # # # # # # # # # # # # #\n";
    }
    if (count($FINAL) == 0) {
        WLOG("[QUERY]: ufdbguard_checks({$id}) no user...");
        return;
    }
    while (list($a, $Member) = each($FINAL)) {
        $Member = trim($Member);
        if ($Member == null) {
            continue;
        }
        $Member = str_replace(" ", "%20", $Member);
        $FINAL2[] = $Member;
    }
    echo @implode($FINAL2, "\n") . "\n";
}