function ParseUserAuth($checkpid = false)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if ($checkpid) {
        $pid = @file_get_contents($pidfile);
        if ($pid < 100) {
            $pid = null;
        }
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            writelogs_squid("Already executed pid {$pid} since {$time}mn-> DIE");
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid} since {$time}mn\n";
            }
            die;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $sock = new sockets();
    if (isset($GLOBALS["EnableMacAddressFilter"])) {
        $GLOBALS["EnableMacAddressFilter"] = $sock->GET_INFO("EnableMacAddressFilter");
        if (!is_numeric($GLOBALS["EnableMacAddressFilter"])) {
            $GLOBALS["EnableMacAddressFilter"] = 1;
        }
    }
    $hostname = $unix->hostname_g();
    $MustContinue = false;
    ParseUserAuthNew();
    if (function_exists("system_is_overloaded")) {
        $COUNT_FILES = $unix->COUNT_FILES("/var/log/artica-postfix/squid-users");
        if ($COUNT_FILES < 1000) {
            if (system_is_overloaded()) {
                return;
            }
        } else {
            $MustContinue = true;
        }
    }
    $countDeFiles = 0;
    if (!($handle = opendir("/var/log/artica-postfix/squid-users"))) {
        @mkdir("/var/log/artica-postfix/squid-users", 0755, true);
        die;
    }
    if (!$MustContinue) {
        if (systemMaxOverloaded()) {
            return;
        }
    }
    $countDeFiles = 0;
    $prefix = "INSERT IGNORE INTO UserAutDB (zmd5,MAC,ipaddr,uid,hostname,UserAgent) VALUES ";
    $f = array();
    while (false !== ($filename = readdir($handle))) {
        if ($filename == ".") {
            continue;
        }
        if ($filename == "..") {
            continue;
        }
        $targetFile = "/var/log/artica-postfix/squid-users/{$filename}";
        $countDeFiles++;
        $content = @file_get_contents($targetFile);
        $array = unserialize($content);
        $ParseUserAuthArray = ParseUserAuthArray($array);
        if ($ParseUserAuthArray != null) {
            $f[] = $ParseUserAuthArray;
        }
        @unlink($targetFile);
    }
    if (count($f) > 0) {
        $q = new mysql_squid_builder();
        $q->QUERY_SQL($prefix . @implode(",", $f));
    }
    nmap_scan();
}
Exemple #2
0
}
if (isset($_GET["etc-hosts-add"])) {
    etc_hosts_add();
    exit;
}
if (isset($_GET["etc-hosts-del"])) {
    etc_hosts_del();
    exit;
}
if (isset($_GET["full-hostname"])) {
    hostname_full();
    exit;
}
//computers
if (isset($_GET["nmap-scan"])) {
    nmap_scan();
    exit;
}
//tcp
if (isset($_GET["ifconfig-interfaces"])) {
    ifconfig_interfaces();
    exit;
}
if (isset($_GET["ifconfig-all"])) {
    ifconfig_all();
    exit;
}
if (isset($_GET["resolv-conf"])) {
    resolv_conf();
    exit;
}
Exemple #3
0
if(isset($_GET["mime-type"])){mime_type();exit;}

if(isset($_GET["sync-remote-smtp-artica"])){postfix_sync_artica();exit;}

//etc/hosts
if(isset($_GET["etc-hosts-open"])){etc_hosts_open();exit;}
if(isset($_GET["etc-hosts-add"])){etc_hosts_add();exit;}
if(isset($_GET["etc-hosts-del"])){etc_hosts_del();exit;}
if(isset($_GET["etc-hosts-del-by-values"])){etc_hosts_del_by_values();exit;}



if(isset($_GET["full-hostname"])){hostname_full();exit;}

//computers
if(isset($_GET["nmap-scan"])){nmap_scan();exit;}


//users UNix
if(isset($_GET["unixLocalUsers"])){PASSWD_USERS();exit;}


//tcp
if(isset($_GET["ifconfig-interfaces"])){ifconfig_interfaces();exit;}
if(isset($_GET["ifconfig-all"])){ifconfig_all();exit;}
if(isset($_GET["ifconfig-all-ips"])){ifconfig_all_ips();exit;}
if(isset($_GET["resolv-conf"])){resolv_conf();exit;}
if(isset($_GET["myos"])){MyOs();exit;}
if(isset($_GET["lspci"])){lspci();exit;}
if(isset($_GET["freemem"])){freemem();exit;}
if(isset($_GET["dfmoinsh"])){dfmoinsh();exit;}