function StartBubble()
{
    $q = new mysql();
    if (!$q->test_mysql_connection()) {
        echo "Starting......: " . date("H:i:s") . " Postfix Bubble Mysql is not ready aborting...\n";
        return;
    }
    $ip = new iptables_exec();
    $ip->buildrules();
}
}
if ($argv[1] == "--patterns") {
    BuildPatterns();
    echo "\n";
    die;
}
if ($argv[1] == "--clean-db") {
    CleanDB();
    echo "\n";
    die;
}
//exec.dansguardian.compile.php --patterns
echo "\n";
echo "Starting......: Dansguardian reconfigure settings\n";
$q = new mysql();
if (!$q->test_mysql_connection()) {
    echo "Starting......: Dansguardian Mysql error\n";
    die;
}
$q->CheckTable_dansguardian();
LoadGlobal_exceptionsitelist();
$dans = new dansguardian();
$dans->SaveSettings();
$cmd = LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.web-community-filter.php --patterns{$GLOBALS["cmdlineadd"]}";
events("MAIN:: {$cmd}");
system($cmd);
HtmlTemplate();
BuildPersonalCategories();
bannedsitelist_userdefined();
weightedphraselist_userdefined();
BuildRules();
function metaevents_client_scan($uuid)
{
    $unix = new unix();
    $sock = new sockets();
    $q = new mysql();
    if (!$q->test_mysql_connection()) {
        return;
    }
    $ArticaMetaStorage = $sock->GET_INFO("ArticaMetaStorage");
    if ($ArticaMetaStorage == null) {
        $ArticaMetaStorage = "/home/artica-meta";
    }
    $destdir = "{$ArticaMetaStorage}/{$uuid}/META_EVENTS";
    $files = $unix->DirFiles($destdir);
    if (!$q->FIELD_EXISTS("meta_admin_mysql", "zmd5", "artica_events")) {
        meta_events("Patching meta_admin_mysql");
        $meta = new mysql_meta();
        $q->QUERY_SQL("DROP TABLE `meta_admin_mysql`", "artica_events");
        $meta->create_table_meta_admin_mysql();
    }
    while (list($filename, $ARRAY) = each($files)) {
        $sourcefile = "{$destdir}/{$filename}";
        $destfile = "{$destdir}/{$filename}.sql";
        meta_events("{$uuid}: Uncompress {$sourcefile}...");
        $unix->uncompress($sourcefile, $destfile);
        if (!is_file($destfile)) {
            continue;
        }
        $q->QUERY_SQL(@file_get_contents($destfile), "artica_events");
        if (!$q->ok) {
            meta_events("{$uuid}:{$q->mysql_error}");
            @unlink($destfile);
            continue;
        }
        @unlink($sourcefile);
        @unlink($destfile);
    }
}
예제 #4
0
function vsftpd_admin_mysql_check($nopid = false)
{
    $f = array();
    $unix = new unix();
    if ($nopid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = @file_get_contents($pidfile);
        if ($unix->process_exists($pid)) {
            writelogs("Already running pid {$pid}", __FUNCTION__, __FILE__, __LINE__);
            return;
        }
        $t = 0;
    }
    $sock = new sockets();
    $users = new usersMenus();
    $hostname = $unix->hostname_g();
    $BaseWorkDir = "{$GLOBALS["ARTICALOGDIR"]}/vsftpd_admin_mysql";
    if (!is_dir($BaseWorkDir)) {
        return;
    }
    if (!($handle = opendir($BaseWorkDir))) {
        echo "Failed open {$BaseWorkDir}\n";
        return;
    }
    $hostname = $unix->hostname_g();
    $q = new mysql();
    if (!$q->test_mysql_connection()) {
        return;
    }
    $sql = "CREATE TABLE IF NOT EXISTS `artica_events`.`vsftpd_admin_mysql` (\n\t\t`ID` int(11) NOT NULL AUTO_INCREMENT,\n\t\t`zDate` TIMESTAMP NOT NULL ,\n\t\t`content` MEDIUMTEXT NOT NULL ,\n\t\t`hostname` VARCHAR( 255 ),\n\t\t`subject` VARCHAR( 255 ) NOT NULL ,\n\t\t`function` VARCHAR( 60 ) NOT NULL ,\n\t\t`filename` VARCHAR( 50 ) NOT NULL ,\n\t\t`line` INT( 10 ) NOT NULL ,\n\t\t`severity` smallint( 1 ) NOT NULL ,\n\t\t`TASKID` BIGINT UNSIGNED ,\n\t\tPRIMARY KEY (`ID`),\n\t\t  KEY `zDate` (`zDate`),\n\t\t  KEY `subject` (`subject`),\n\t\t  KEY `hostname` (`hostname`),\n\t\t  KEY `function` (`function`),\n\t\t  KEY `filename` (`filename`),\n\t\t  KEY `severity` (`severity`)\n\t\t) ENGINE=MYISAM;";
    $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
        return;
    }
    while (false !== ($filename = readdir($handle))) {
        if ($filename == ".") {
            continue;
        }
        if ($filename == "..") {
            continue;
        }
        $targetFile = "{$BaseWorkDir}/{$filename}";
        if ($unix->file_time_min($targetFile) > 240) {
            @unlink($targetFile);
            continue;
        }
        $array = unserialize(@file_get_contents($targetFile));
        if (!is_array($array)) {
            @unlink($targetFile);
            continue;
        }
        if (!is_numeric($array["TASKID"])) {
            $array["TASKID"] = 0;
        }
        $content = mysql_escape_string2($array["text"]);
        $subject = mysql_escape_string2($array["subject"]);
        $zdate = $array["zdate"];
        $function = $array["function"];
        $file = $array["file"];
        $line = $array["line"];
        $TASKID = $array["TASKID"];
        $severity = $array["severity"];
        $q->QUERY_SQL("INSERT IGNORE INTO `vsftpd_admin_mysql`\n\t\t\t\t(`zDate`,`content`,`subject`,`function`,`filename`,`line`,`severity`,`hostname`) VALUES\n\t\t\t\t('{$zdate}','{$content}','{$subject}','{$function}','{$file}','{$line}','{$severity}','{$hostname}')", "artica_events");
        if (!$q->ok) {
            return;
        }
        @unlink($targetFile);
    }
}
예제 #5
0
function mysql_status()
{
    $q = new mysql();
    if (!$q->test_mysql_connection()) {
        echo " ********* FAILED **************\n";
        echo $q->mysql_error . "\n";
        echo "\n\nType Enter key to exit.\n";
        $answer = trim(strtolower(fgets(STDIN)));
        menu();
    }
    echo "Connecting to MySQL server success\n";
    echo "MySQL Paramaters:\n*******************************\n";
    echo "MySQL username..: {$q->mysql_admin}\n";
    echo "MySQL Password..: {$q->mysql_password}\n";
    echo "MySQL server....: {$q->mysql_server}\n";
    echo "MySQL Port......: {$q->mysql_port}\n";
    echo "MySQL SocketName: {$q->SocketName}\n";
    echo "\n\nType Enter key to continue.\n";
    $answer = trim(strtolower(fgets(STDIN)));
    $GLOBALS["VERBOSE"] = true;
    $q->BuildTables();
    $GLOBALS["VERBOSE"] = false;
    echo "\n\nType Enter key to exit.\n";
    $answer = trim(strtolower(fgets(STDIN)));
    menu();
}