Example #1
0
function ping($host)
{
    ini_set_verbosed();
    $unix = new unix();
    if ($unix->PingHost($host)) {
        echo "{$host}:TRUE\n";
    } else {
        echo "{$host}:FALSE\n";
    }
}
include_once dirname(__FILE__) . "/ressources/class.system.network.inc";
include_once dirname(__FILE__) . "/ressources/class.dansguardian.inc";
include_once dirname(__FILE__) . "/ressources/class.squid.inc";
include_once dirname(__FILE__) . "/ressources/class.squidguard.inc";
include_once dirname(__FILE__) . "/ressources/class.mysql.inc";
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . "/framework/frame.class.inc";
if (posix_getuid() != 0) {
    die("Cannot be used in web server mode\n\n");
}
if (count($argv) > 0) {
    $imploded = implode(" ", $argv);
    if (preg_match("#--verbose#", $imploded)) {
        $GLOBALS["VERBOSE"] = true;
        $GLOBALS["debug"] = true;
        ini_set_verbosed();
    }
    if (preg_match("#--reload#", $imploded)) {
        $GLOBALS["RELOAD"] = true;
    }
    if (preg_match("#--shalla#", $imploded)) {
        $GLOBALS["SHALLA"] = true;
    }
    if (preg_match("#--catto=(.+?)\\s+#", $imploded, $re)) {
        $GLOBALS["CATTO"] = $re[1];
    }
    if ($argv[1] == "--inject") {
        echo inject($argv[2], $argv[3]);
        exit;
    }
    if ($argv[1] == "--conf") {
Example #3
0
include_once(dirname(__FILE__)."/ressources/class.user.inc");
include_once(dirname(__FILE__)."/ressources/class.groups.inc");
include_once(dirname(__FILE__)."/ressources/class.ldap.inc");
include_once(dirname(__FILE__)."/ressources/class.system.network.inc");
include_once(dirname(__FILE__)."/ressources/class.dansguardian.inc");
include_once(dirname(__FILE__)."/ressources/class.squid.inc");
include_once(dirname(__FILE__)."/ressources/class.squidguard.inc");
include_once(dirname(__FILE__)."/ressources/class.mysql.inc");
include_once(dirname(__FILE__).'/framework/class.unix.inc');
include_once(dirname(__FILE__)."/framework/frame.class.inc");


if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");}
if(count($argv)>0){
	$imploded=implode(" ",$argv);
	if(preg_match("#--verbose#",$imploded)){$GLOBALS["VERBOSE"]=true;$GLOBALS["debug"]=true;ini_set_verbosed(); }
	if(preg_match("#--reload#",$imploded)){$GLOBALS["RELOAD"]=true;}
	if(preg_match("#--shalla#",$imploded)){$GLOBALS["SHALLA"]=true;}
	if(preg_match("#--catto=(.+?)\s+#",$imploded,$re)){$GLOBALS["CATTO"]=$re[1];}
	if($argv[1]=="--inject"){echo inject($argv[2],$argv[3]);exit;}
	if($argv[1]=="--conf"){echo conf();exit;}
	if($argv[1]=="--ufdbguard-compile"){echo UFDBGUARD_COMPILE_SINGLE_DB($argv[2]);exit;}	
	if($argv[1]=="--ufdbguard-dbs"){echo UFDBGUARD_COMPILE_DB();exit;}
	if($argv[1]=="--ufdbguard-miss-dbs"){echo ufdbguard_recompile_missing_dbs();exit;}
	if($argv[1]=="--ufdbguard-recompile-dbs"){echo ufdbguard_recompile_dbs();exit;}
	if($argv[1]=="--ufdbguard-schedule"){ufdbguard_schedule();exit;}
	if($argv[1]=="--list-missdbs"){BuildMissingUfdBguardDBS(false,true);exit;}				
	if($argv[1]=="--cron-compile"){cron_compile();exit;}
	if($argv[1]=="--ufdbguard-status"){print_r(UFDBGUARD_STATUS());exit;}
	
	
Example #4
0
include_once(dirname(__FILE__) . '/ressources/class.users.menus.inc');
include_once(dirname(__FILE__) . '/ressources/class.dhcpd.inc');
include_once(dirname(__FILE__) . '/ressources/class.user.inc');
include_once(dirname(__FILE__) . '/ressources/class.ini.inc');
include_once(dirname(__FILE__) . '/ressources/class.iptables-chains.inc');
include_once(dirname(__FILE__) . '/ressources/class.baseunix.inc');
include_once(dirname(__FILE__) . '/ressources/class.bind9.inc');
include_once(dirname(__FILE__)."/framework/frame.class.inc");
$GLOBALS["ASROOT"]=true;
if($argv[1]=='--bind'){compile_bind();die();}

if(is_array($argv)){
	if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["VERBOSE"]=true;}
	if(preg_match("#--no-reload#",implode(" ",$argv))){$GLOBALS["NORELOAD"]=true;}
	if($GLOBALS["VERBOSE"]){ini_set_verbosed();}
}

BuildDHCP();

function BuildDHCP(){
	$dhcpd=new dhcpd();
	$conf=$dhcpd->BuildConf();
	$confpath=dhcp3Config();
	$unix=new unix();
	@mkdir(dirname($confpath),null,true);
	@file_put_contents($confpath,$conf);
	echo "Starting......: DHCP SERVER saving \"$confpath\" (". strlen($conf)." bytes) done\n";
	
	if(is_dir("/var/lib/dhcp3")){
		shell_exec("/bin/chown -R dhcpd:dhcpd /var/lib/dhcp3");