예제 #1
0
function ASSP()
{
    CleanFile();
    if (is_dir("/usr/share/assp/files")) {
        @file_put_contents("/usr/share/assp/files/nodelay.txt", @implode("\n", $GLOBALS["ASSP"]));
        shell_exec("/usr/share/artica-postfix/bin/artica-install --reload-assp");
    }
}
예제 #2
0
if (!$GLOBALS["FORCE"]) {
    if ($md5Local == $md5Tampon) {
        if ($GLOBALS["VERBOSE"]) {
            echo " --> {$md5Local} == {$md5Tampon}, abort\n";
        }
        die;
    }
}
@unlink($cache_file);
@file_put_contents($cache_file, $md5Tampon);
writelogs("LOCAL:{$md5Local} !== REMOTE:{$md5Tampon}", "MAIN", __FILE__, __LINE__);
write_syslog("integrity of dhcpd.leases has been modified ( from {$md5Local} to {$md5Tampon}), analyze the leases", basename(__FILE__));
if ($GLOBALS["VERBOSE"]) {
    echo " --> CleanFile()\n";
}
CleanFile();
if ($GLOBALS["VERBOSE"]) {
    echo " --> /var/lib/dhcp3/dhcpd.leases\n";
}
$datas = @file_get_contents("/var/lib/dhcp3/dhcpd.leases");
$md5 = md5($datas);
if (!preg_match_all("#lease\\s+(.+?)\\s+{(.+?)\\}#is", $datas, $re)) {
    if ($GLOBALS["VERBOSE"]) {
        echo " --> Unable to preg_match\n";
    }
    events("Unable to preg_match", "main", __LINE__);
    die;
}
$dhcp = new dhcpd();
$unix = new unix();
$GLOBALS["nmblookup"] = $unix->find_program("nmblookup");
예제 #3
0
function TestConfig(){
	
	if(!isset($GLOBALS["SNORT_PATH"])){$unix=new unix();$GLOBALS["SNORT_PATH"]=$unix->find_program("snort");}
	if(!is_file($GLOBALS["SNORT_PATH"])){echo "Starting......: Snort Daemon snort, no such binary\n";return; }
	$results=array();
	exec("{$GLOBALS["SNORT_PATH"]} -T -c /etc/snort/snort.conf 2>&1",$results);
	while (list ($index, $line) = each ($results) ){	
		
		if(preg_match("#ERROR:\s+(.+?)\(([0-9]+)\)\s+Unknown rule option#",$line,$re)){
			echo "Starting......: Snort Daemon \"$line\"\n";
			echo "Starting......: Snort Daemon \"Unknown rule option\" error detected file {$re[1]} line {$re[2]} remove it\n";
			CleanFile($re[1],$re[2]);
		}		
		
		if(preg_match("#ERROR:\s+(.+?)\(([0-9]+)\)\s+=>.+?does not take an argument#",$line,$re)){
			echo "Starting......: Snort Daemon \"$line\"\n";
			echo "Starting......: Snort Daemon \"does not take an argument\" error detected file {$re[1]} line {$re[2]} remove it\n";
			CleanFile($re[1],$re[2]);
		}

		if(preg_match("#Snort successfully loaded all rules#",$line)){
			echo "Starting......: Snort Daemon testing config success\n";
		}
		
		if(preg_match("#successfully validated the configuration#",$line)){
			echo "Starting......: Snort Daemon testing config success\n";
		}
		
	}
	
}