Beispiel #1
0
 function testSystemUserManager()
 {
     $UserManager = new SystemUserManager();
     $Shell = ShellFactory::GetShellInstance();
     $User = $UserManager->GetUserByName("cptestuser");
     if ($User instanceof SystemUser) {
         $User->Delete();
     }
     // Create user
     $res = $UserManager->Create("cptestuser", "cptestuser");
     $this->assertTrue($res, "Test system user created");
     $this->assertTrue(is_a($res, "SystemUser"), "Returned user is an instance of SystemUser class");
     // Delete user
     $User = $UserManager->GetUserByName("cptestuser");
     $res = $User->Delete();
     $this->assertTrue($res, "Test system user deletedion did not return shell errors");
     $this->assertFalse($Shell->ExecuteRaw("cat /etc/passwd|grep cptestuser"), "User cptestuser not exists");
     // System users list
     $res = $UserManager->GetList();
     $this->assertTrue(is_array($res) && count($res) > 0, "System users list length more than 0");
     $this->assertTrue(is_a($res[0], "SystemUser"), "Returned user 0 is an instance of SystemUser class");
     // Create again
     $User = $UserManager->Create("cptestuser", "cptestuser");
     $this->assertTrue(is_a($User, "SystemUser"), "Returned user is an instance of SystemUser class");
     // Cahnge and get password
     $old = $User->GetPwdHash();
     $User->SetPassword("fuckaz");
     $this->assertFalse($User->GetPwdHash() == $old, "PwdHash is correct");
     // Cahnge shell
     $res = $User->SetShell("/bin/bash");
     $this->assertTrue($Shell->QueryRaw("cat /etc/passwd|grep ^{$User->Username}|grep -c bash") == 1, "{$User->Username}'s shell is bash");
     $User = $UserManager->GetUserByName("cptestuser");
     $User->Delete();
 }
Beispiel #2
0
        function testFactory() 
        {
			
			$Shell = ShellFactory::GetShellInstance();
			$this->assertTrue(is_a($Shell, "Shell") || is_a($Shell, "WinShell"), 
			"ShellFactory::GetShellInstance returned Shell or WinShell instance");
							
        }
Beispiel #3
0
 function __construct()
 {
     parent::__construct();
     $this->Shell = ShellFactory::GetShellInstance();
     $this->Validator = Core::GetValidatorInstance();
     $this->OpenSSL = CF_ENV_OPENSSL;
     $this->SSLRoot = CF_ENV_HOMEROOT . "/" . CF_ENV_HOMENAME . "/" . CF_ENV_SSLROOT;
     $this->Date = date("j-n-Y");
 }
 public function Connect($host, $port = 161, $community = "public", $timeout = 2, $retries = 0, $SNMP_VALUE_PLAIN = false)
 {
     $this->Host = $host;
     $this->Port = $port;
     $this->Community = $community;
     $this->Shell = ShellFactory::GetShellInstance();
     $this->Timeout = $timeout;
     $this->Retries = $retries;
     $this->SNMPValuePlain = $SNMP_VALUE_PLAIN;
     $this->logger = Logger::getLogger(__CLASS__);
 }
 /**
  * @ignore
  *
  */
 function __construct()
 {
     parent::__construct();
     $this->Shell = ShellFactory::GetShellInstance();
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $this->IsWindows = true;
     } elseif (strtoupper(PHP_OS) === 'FREEBSD') {
         $this->IsFreeBSD = true;
     } else {
         $this->IsLinux = true;
     }
 }
 public function OnStartForking()
 {
     $db = Core::GetDBInstance();
     // Get pid of running daemon
     $pid = @file_get_contents(CACHEPATH . "/" . __CLASS__ . ".Daemon.pid");
     $this->Logger->info("Current daemon process PID: {$pid}");
     // Check is daemon already running or not
     if ($pid) {
         $Shell = ShellFactory::GetShellInstance();
         // Set terminal width
         putenv("COLUMNS=400");
         // Execute command
         $ps = $Shell->QueryRaw("ps ax -o pid,ppid,command | grep ' 1' | grep {$pid} | grep -v 'ps x' | grep DBQueueEvent");
         $this->Logger->info("Shell->QueryRaw(): {$ps}");
         if ($ps) {
             // daemon already running
             $this->Logger->info("Daemon running. All ok!");
             return true;
         }
     }
     $this->ThreadArgs = array(1);
 }
Beispiel #7
0
 /**
  * plot graphic
  *
  * @param string $filename
  * @param string $start
  * @param string $end
  * 
  * @see http://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html
  */
 public function Plot($filename, $start = false, $end = false, $args = array())
 {
     // add end timestamp
     if ($end) {
         array_push($args, "--end");
         array_push($args, $end);
     }
     // Add start timestamp
     if ($start) {
         array_push($args, "--start");
         array_push($args, $start);
     }
     // Set X-grid style
     if ($this->XGridStyle) {
         array_push($args, "--x-grid");
         array_push($args, $this->XGridStyle);
     }
     // Set X-grid style
     if ($this->YGridStyle) {
         array_push($args, "--y-grid");
         array_push($args, $this->YGridStyle);
     }
     // Set graphic style
     if ($this->Title) {
         array_push($args, "--title");
         array_push($args, $this->Title);
     }
     array_push($args, "--width");
     array_push($args, $this->Width);
     array_push($args, "--height");
     array_push($args, $this->Height);
     array_push($args, "--font-render-mode");
     array_push($args, "normal");
     foreach ($this->Fonts as $font) {
         if ($font != "") {
             array_push($args, "--font");
             array_push($args, $font);
         }
     }
     $args = array_merge($args, $this->Args);
     foreach ($args as $arg) {
         if (substr($arg, 0, 1) != '-') {
             $arg = "'{$arg}'";
         }
         $query_string .= "{$arg} ";
     }
     $Shell = ShellFactory::GetShellInstance();
     $retval = $Shell->QueryRaw("{$this->RRDToolPath} graph '{$filename}' {$query_string} 2>&1");
     if (!$retval || substr($retval, 0, 6) == 'ERROR:') {
         throw new Exception(sprintf(_("Cannot plot graph: %s"), substr($retval, 6)));
     }
     return true;
 }
 /**
  * Local Transport constructor
  * @ignore
  */
 public function __construct()
 {
     $this->Shell = ShellFactory::GetShellInstance();
 }
		/**
		 * Constructor
		 *
		 */
		function __construct()
		{
			parent::__construct();
			
			$this->SystemStats = Core::GetInstance("SystemStats");
			
			$this->Shell = ShellFactory::GetShellInstance();
			
			$this->UserAddPath = (defined("CF_USERADD_PATH")) ? CF_USERADD_PATH : self::USERADD_PATH;
			$this->ChpasswdPath = (defined("CF_CHPASSWD_PATH")) ? CF_CHPASSWD_PATH : self::CHPASSWD_PATH;
			
			$this->SkelDir = (defined("CF_SKEL_DIR")) ? CF_SKEL_DIR : false;
			
			$this->UserGroup = (defined("CF_USER_GROUP")) ? CF_USER_GROUP : self::USER_GROUP;
			
			$this->ShellPath = (defined("CF_SHELL_PATH")) ? CF_SHELL_PATH : self::SHELL_PATH;
		}
Beispiel #10
0
 /**
  * System UserConstructor
  *
  * @param integer $uid
  */
 function __construct($uid)
 {
     parent::__construct();
     $this->Shell = ShellFactory::GetShellInstance();
     $this->SystemStats = Core::GetInstance("SystemStats");
     $this->UserAddPath = defined("CF_USERADD_PATH") ? CF_USERADD_PATH : self::USERADD_PATH;
     $this->ChpasswdPath = defined("CF_CHPASSWD_PATH") ? CF_CHPASSWD_PATH : self::CHPASSWD_PATH;
     $this->UserDelPath = defined("CF_USERDEL_PATH") ? CF_USERDEL_PATH : self::USERDEL_PATH;
     $this->UserModPath = defined("CF_USERMOD_PATH") ? CF_USERMOD_PATH : self::USERMOD_PATH;
     $this->PassFilePath = defined("CF_PASSWORD_FILE_PATH") ? CF_PASSWORD_FILE_PATH : self::PASSWORD_FILE_PATH;
     if (!is_readable("/etc/passwd")) {
         Core::RaiseError(_("/etc/passwd not readable"));
     }
     // Get user details
     $res = $this->Shell->QueryRaw("cat /etc/passwd | grep ':[\\*x]:{$uid}:'");
     $rowarr = explode(":", $res);
     $this->Username = $rowarr[0];
     $this->UID = $rowarr[2];
     $this->GID = $rowarr[3];
     $this->Home = $rowarr[5];
     $this->ShellPath = $rowarr[6];
     // get password
     $this->GetPwdHash();
 }
		/**
		* Constructor
		* @access public
		* @return array Mounts
		*/
		function __construct($key = null)
		{
			parent::__construct();
			// Smarty needed to parse lic file template
			$this->Smarty = Core::GetSmartyInstance();
			// Shell needed for ifconfig
			$this->Shell = ShellFactory::GetShellInstance();
			if ($key == null)
			{
				$this->AlgoVersion = 1;
				$this->LicKey = "BK7CqbqDuwPGvHQ,Jx:ErJh4";
			}
			else
			{
				$this->AlgoVersion = 2;
				$this->LicKey = $key;
			};
			
			$this->LicTypes = array("ip", "mac", "domain", "named", "trial");
		}
Beispiel #12
0
    	/**
    	 * RWHois constructor
    	 * @ignore
    	 *
    	 */
    	function __construct()
    	{     
    	    $this->Shell = ShellFactory::GetShellInstance();
    	    
			$this->RWhoisPath = (defined("CF_RWHOIS_PATH")) ? CF_RWHOIS_PATH : self::RWHOIS_PATH;
    	}
Beispiel #13
0
 /**
  * Reload named - issue rndc reload
  * @access public
  * @param string $zone Zone name (undotted domain name)
  * @return bool Operation status
  */
 public function ReloadRndc()
 {
     $Shell = ShellFactory::GetShellInstance();
     return $Shell->Execute("{$this->Rndc}", array("reload"));
 }
Beispiel #14
0
<?php

declare (ticks=1);
define("NO_TEMPLATES", true);
define("NO_SESSIONS", true);
require_once dirname(__FILE__) . "/../src/prepend.inc.php";
CONTEXTS::$APPCONTEXT = APPCONTEXT::CRONJOB;
Core::Load("IO/PCNTL/interface.IProcess.php");
Core::Load("IO/PCNTL");
Core::Load("System/Independent/Shell/ShellFactory");
Core::Load("NET/SNMP");
$fname = basename($argv[0]);
$JobLauncher = new JobLauncher(dirname(__FILE__));
// DBQueueEvent - it is a daemon process so we must skepp this check
if ($JobLauncher->GetProcessName() != 'DBQueueEvent') {
    $Shell = ShellFactory::GetShellInstance();
    // Set terminal width
    putenv("COLUMNS=200");
    // Execute command
    $parent_pid = posix_getppid();
    $ps = $Shell->QueryRaw("ps x -o pid,command | grep -v {$parent_pid} |grep -v " . posix_getpid() . " | grep -v 'ps x' | grep '" . dirname(__FILE__) . "' | grep '\\-\\-{$JobLauncher->GetProcessName()}'");
    if ($ps) {
        $Logger->info("'{$fname} --{$JobLauncher->GetProcessName()}' already running. Exiting.");
        exit;
    }
}
$Logger->info(sprintf("Starting %s cronjob...", $JobLauncher->GetProcessName()));
//$JobLauncher->Launch(CONFIG::$CRON_PROCESSES_NUMBER, 180);
$JobLauncher->Launch(7, 180);
Beispiel #15
0
    	/**
    	 * Whois constructor
    	 * @ignore
    	 *
    	 */
    	function __construct()
    	{    		
			$this->Shell = ShellFactory::GetShellInstance();
    	    
			$this->WhoisBinPath = (defined("CF_WHOIS_BIN_PATH")) ? CF_WHOIS_BIN_PATH : self::WHOIS_BIN_PATH;
			
    		$this->Servers =  array(			    
    							'ac' => array('whois.nic.ac', 'No match'),
    							'ac.cn' => array('whois.cnnic.net.cn', 'no matching record'),
    							'ac.jp' => array('whois.nic.ad.jp', 'No match'),
    							'ac.uk' => array('whois.ja.net', 'No such domain'),
    							'ad.jp' => array('whois.nic.ad.jp', 'No match'),
    							'adm.br' => array('whois.nic.br', 'No match'),
    							'adv.br' => array('whois.nic.br', 'No match'),
    							'aero' => array('whois.information.aero', 'is available'),
    							'ag' => array('whois.nic.ag', 'Not found'),
    							'agr.br' => array('whois.nic.br', 'No match'),
    							'ah.cn' => array('whois.cnnic.net.cn', 'No entries found'),
    							'al' => array('whois.ripe.net', 'No entries found'),
    							'am' => array('whois.amnic.net', 'No match'),
    							'am.br' => array('whois.nic.br', 'No match'),
    							'arq.br' => array('whois.nic.br', 'No match'),
    							'at' => array('whois.nic.at', 'nothing found'),
    							'au' => array('whois.aunic.net', 'No Data Found'),
    							'art.br' => array('whois.nic.br', 'No match'),
    							'as' => array('whois.nic.as', 'Domain Not Found'),
    							'asn.au' => array('whois.aunic.net', 'No Data Found'),
    							'ato.br' => array('whois.nic.br', 'No match'),
    							'av.tr' => array('whois.nic.tr', 'Not found in database'),
    							'az' => array('whois.ripe.net', 'no entries found'),
    							'ba' => array('whois.ripe.net', 'No match for'),
    							'be' => array('whois.geektools.com', 'No such domain'),
    							'bg' => array('whois.digsys.bg', 'does not exist'),
    							'bio.br' => array('whois.nic.br', 'No match'),
    							'biz' => array('whois.biz', 'Not found'),
    							'biz.tr' => array('whois.nic.tr', 'Not found in database'),
    							'bj.cn' => array('whois.cnnic.net.cn', 'No entries found'),
    							'bel.tr' => array('whois.nic.tr', 'Not found in database'),
    							'bmd.br' => array('whois.nic.br', 'No match'),
    							'br' => array('whois.registro.br', 'No match'),
    							'by' => array('whois.ripe.net', 'no entries found'),
    							'ca' => array('whois.cira.ca', 'Status: AVAIL'),
    							'cc' => array('whois.nic.cc', 'No match'),
    							'cd' => array('whois.cd', 'No match'),
    							'ch' => array('whois.nic.ch', 'We do not have an entry'),
    							'cim.br' => array('whois.nic.br', 'No match'),
    							'ck' => array('whois.ck-nic.org.ck', 'No entries found'),
    							'cl' => array('whois.nic.cl', 'no existe'),
    							'cn' => array('whois.cnnic.net.cn', 'No entries found'),
    							'cng.br' => array('whois.nic.br', 'No match'),
    							'cnt.br' => array('whois.nic.br', 'No match'),
    							'com' => array('whois.crsnic.net', 'No match'),
    							'com.au' => array('whois.aunic.net', 'No Data Found'),
    							'com.br' => array('whois.nic.br', 'No match'),
    							'com.cn' => array('whois.cnnic.net.cn', 'No entries found'),
    							'com.eg' => array('whois.ripe.net', 'No entries found'),
    							'com.hk' => array('whois.hknic.net.hk', 'No Match for'),
    							'com.mx' => array('whois.nic.mx', 'Nombre del Dominio'),
    							'com.tr' => array('whois.nic.tr', 'Not found in database'),
    							'com.ru' => array('whois.ripn.ru', 'No entries found'),
    							'com.tw' => array('whois.twnic.net', 'NO MATCH TIP'),
    							'conf.au' => array('whois.aunic.net', 'No entries found'),
    							'co.at' => array('whois.nic.at', 'nothing found'),
    							'co.jp' => array('whois.nic.ad.jp', 'No match'),
    							'co.uk' => array('whois.nic.uk', 'No match for'),
    							'cq.cn' => array('whois.cnnic.net.cn', 'No entries found'),
    							'csiro.au' => array('whois.aunic.net', 'No Data Found'),
    							'cx'	=> array('whois.nic.cx', 'No match'),
    							'cy'	=> array('whois.ripe.net', 'no entries found'),
    							'cz'	=> array('whois.nic.cz', 'No data found'),
    							'de'	=> array('whois.denic.de', 'not found'),
    							'dr.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'dk'	=> array('whois.dk-hostmaster.dk', 'No entries found'),
    							'dz'	=> array('whois.ripe.net', 'no entries found'),
    							'ecn.br'	=> array('whois.nic.br', 'No match'),
    							'ee'	=> array('whois.eenet.ee', 'NOT FOUND'),
    							'edu'	=> array('whois.verisign-grs.net', 'No match'),
    							'edu'	=> array('whois.crsnic.net', 'No match'),
    							'edu.au'	=> array('whois.aunic.net', 'No Data Found'),
    							'edu.br'	=> array('whois.nic.br', 'No match'),
    							'edu.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'eg'	=> array('whois.ripe.net', 'No entries found'),
    							'es'	=> array('whois.ripe.net', 'No entries found'),
    							'esp.br'	=> array('whois.nic.br', 'No match'),
    							'etc.br'	=> array('whois.nic.br', 'No match'),
    							'eti.br'	=> array('whois.nic.br', 'No match'),
    							'eun.eg'	=> array('whois.ripe.net', 'No entries found'),
    							'emu.id.au'	=> array('whois.aunic.net', 'No Data Found'),
    							'eng.br'	=> array('whois.nic.br', 'No match'),
    							'far.br'	=> array('whois.nic.br', 'No match'),
    							'fi'	=> array('whois.ripe.net', 'No entries found'),
    							'fj'	=> array('whois.usp.ac.fj', ''),
    							'fj.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'fm.br'	=> array('whois.nic.br', 'No match'),
    							'fnd.br'	=> array('whois.nic.br', 'No match'),
    							'fo'	=> array('whois.ripe.net', 'no entries found'),
    							'fot.br'	=> array('whois.nic.br', 'No match'),
    							'fst.br'	=> array('whois.nic.br', 'No match'),
    							'fr'	=> array('whois.nic.fr', 'No entries found'),
    							'gb'	=> array('whois.ripe.net', 'No match for'),
    							'gb.com'	=> array('whois.nomination.net', 'No match for'),
    							'gb.net'	=> array('whois.nomination.net', 'No match for'),
    							'g12.br'	=> array('whois.nic.br', 'No match'),
    							'gd.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'ge'	=> array('whois.ripe.net', 'no entries found'),
    							'gen.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'ggf.br'	=> array('whois.nic.br', 'No match'),
    							'gl'	=> array('whois.ripe.net', 'no entries found'),
    							'gr'	=> array('whois.ripe.net', 'no entries found'),
    							'gr.jp'	=> array('whois.nic.ad.jp', 'No match'),
    							'gs'	=> array('whois.adamsnames.tc', 'is not registered'),
    							'gs.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'gov.au'	=> array('whois.aunic.net', 'No Data Found'),
    							'gov.br'	=> array('whois.nic.br', 'No match'),
    							'gov.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'gov.hk'	=> array('whois.hknic.net.hk', 'No Match for'),
    							'gov.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'gob.mx'	=> array('whois.nic.mx', 'Nombre del Dominio'),
    							'gs'	=> array('whois.adamsnames.tc', 'is not registered'),
    							'gz.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'gx.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'he.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'ha.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'hb.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'hi.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'hl.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'hn.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'hm'	=> array('whois.registry.hm', '(null)'),
    							'hk'	=> array('whois.hknic.net.hk', 'No Match for'),
    							'hk.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'hu'	=> array('whois.ripe.net', 'MAXCHARS:500'),
    							'id.au'	=> array('whois.aunic.net', 'No Data Found'),
    							'ie'	=> array('whois.domainregistry.ie', 'no match'),
    							'ind.br'	=> array('whois.nic.br', 'No match'),
    							'imb.br'	=> array('whois.nic.br', 'No match'),
    							'inf.br'	=> array('whois.nic.br', 'No match'),
    							'info'	=> array('whois.afilias.info', 'Not found'),
    							'info.au'	=> array('whois.aunic.net', 'No Data Found'),
    							'info.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'it'	=> array('whois.nic.it', 'No entries found'),
    							'idv.tw'	=> array('whois.twnic.net', 'NO MATCH TIP'),
    							'int'	=> array('whois.iana.org', 'not found'),
    							'is'	=> array('whois.isnic.is', 'No entries found'),
    							'il'	=> array('whois.isoc.org.il', 'No data was found'),
    							'jl.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'jor.br'	=> array('whois.nic.br', 'No match'),
    							'jp'	=> array('whois.nic.ad.jp', 'No match'),
    							'js.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'jx.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'k12.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'ke'	=> array('whois.rg.net', 'No match for'),
    							'kr'	=> array('whois.krnic.net', 'is not registered'),
    							'la'	=> array('whois.nic.la', 'NO MATCH'),
    							'lel.br'	=> array('whois.nic.br', 'No match'),
    							'li'	=> array('whois.nic.ch', 'We do not have an entry'),
    							'lk'	=> array('whois.nic.lk', 'No domain registered'),
    							'ln.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'lt'	=> array('ns.litnet.lt', 'No matches found'),
    							'lu'	=> array('whois.dns.lu', 'No entries found'),
    							'lv'	=> array('whois.ripe.net', 'no entries found'),
    							'ltd.uk'	=> array('whois.nic.uk', 'No match for'),
    							'ma'	=> array('whois.ripe.net', 'No entries found'),
    							'mat.br'	=> array('whois.nic.br', 'No match'),
    							'mc'	=> array('whois.ripe.net', 'No entries found'),
    							'md'	=> array('whois.ripe.net', 'No match for'),
    							'me.uk'	=> array('whois.nic.uk', 'No match for'),
    							'med.br'	=> array('whois.nic.br', 'No match'),
    							'mil'	=> array('whois.nic.mil', 'No match'),
    							'mil.br'	=> array('whois.nic.br', 'No match'),
    							'mil.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'mk'	=> array('whois.ripe.net', 'No match for'),
    							'mn'	=> array('whois.nic.mn', 'Domain not found'),
    							'mo.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'ms'	=> array('whois.adamsnames.tc', 'is not registered'),
    							'mt'	=> array('whois.ripe.net', 'No Entries found'),
    							'mus.br'	=> array('whois.nic.br', 'No match'),
    							'mx'	=> array('whois.nic.mx', 'Nombre del Dominio'),
    							'name'	=> array('whois.nic.name', 'No match'),
    							'name.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'ne.jp'	=> array('whois.nic.ad.jp', 'No match'),
    							'net'	=> array('whois.crsnic.net', 'No match'),
    							'net.au'	=> array('whois.aunic.net', 'No Data Found'),
    							'net.br'	=> array('whois.nic.br', 'No match'),
    							'net.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'net.eg'	=> array('whois.ripe.net', 'No entries found'),
    							'net.hk'	=> array('whois.hknic.net.hk', 'No Match for'),
    							'net.lu'	=> array('whois.dns.lu', 'No entries found'),
    							'net.mx'	=> array('whois.nic.mx', 'Nombre del Dominio'),
    							'net.uk'	=> array('whois.nic.uk', 'No match for '),
    							'net.ru'	=> array('whois.ripn.ru', 'No entries found'),
    							'net.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'net.tw'	=> array('whois.twnic.net', 'NO MATCH TIP'),
    							'nl'	=> array('whois.domain-registry.nl', 'is not a registered domain'),
    							'nm.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'no'	=> array('whois.norid.no', 'no matches'),
    							'no.com'	=> array('whois.nomination.net', 'No match for'),
    							'nom.br'	=> array('whois.nic.br', 'No match'),
    							'not.br'	=> array('whois.nic.br', 'No match'),
    							'ntr.br'	=> array('whois.nic.br', 'No match'),
    							'nu'	=> array('whois.nic.nu', 'NO MATCH for'),
    							'nx.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'nz'	=> array('whois.domainz.net.nz', 'Not Listed'),
    							'plc.uk'	=> array('whois.nic.uk', 'No match for'),
    							'odo.br'	=> array('whois.nic.br', 'No match'),
    							'oop.br'	=> array('whois.nic.br', 'No match'),
    							'or.jp'	=> array('whois.nic.ad.jp', 'No match'),
    							'or.at'	=> array('whois.nic.at', 'nothing found'),
    							'org'	=> array('whois.pir.org', 'NOT FOUND'),
    							'org.au'	=> array('whois.aunic.net', 'No Data Found'),
    							'org.br'	=> array('whois.nic.br', 'No match'),
    							'org.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'org.hk'	=> array('whois.hknic.net.hk', 'No Match for'),
    							'org.lu'	=> array('whois.dns.lu', 'No entries found'),
    							'org.ru'	=> array('whois.ripn.ru', 'No entries found'),
    							'org.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'org.tw'	=> array('whois.twnic.net', 'NO MATCH TIP'),
    							'org.uk'	=> array('whois.nic.uk', 'No match for'),
    							'pk'	=> array('whois.pknic.net', 'is not registered'),
    							'pl'	=> array('whois.ripe.net', 'No information about'),
    							'pol.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'pp.ru'	=> array('whois.ripn.ru', 'No entries found'),
    							'ppg.br'	=> array('whois.nic.br', 'No match'),
    							'pro.br'	=> array('whois.nic.br', 'No match'),
    							'psi.br'	=> array('whois.nic.br', 'No match'),
    							'psc.br'	=> array('whois.nic.br', 'No match'),
    							'pt'	=> array('whois.ripe.net', 'No match for'),
    							'qh.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'qsl.br'	=> array('whois.nic.br', 'No match'),
    							'rec.br'	=> array('whois.nic.br', 'No match'),
    							'ro'	=> array('whois.ripe.net', 'No entries found'),
    							'ru'	=> array('whois.ripn.ru', 'No entries found'),
    							'sc.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'sd.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'se'	=> array('whois.nic-se.se', 'No data found'),
    							'se.com'	=> array('whois.nomination.net', 'No match for'),
    							'se.net'	=> array('whois.nomination.net', 'No match for'),
    							'sg'	=> array('whois.nic.net.sg', 'NO entry found'),
    							'sh'	=> array('whois.nic.sh', 'No match for'),
    							'sh.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'si'	=> array('whois.arnes.si', 'No entries found'),
    							'sk'	=> array('whois.ripe.net', 'no entries found'),
    							'slg.br'	=> array('whois.nic.br', 'No match'),
    							'sm'	=> array('whois.ripe.net', 'no entries found'),
    							'sn.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'srv.br'	=> array('whois.nic.br', 'No match'),
    							'st'	=> array('whois.nic.st', 'No entries found'),
    							'su'	=> array('whois.ripe.net', 'No entries found'),
    							'sx.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'tc'	=> array('whois.adamsnames.tc', 'is not registered'),
    							'tel.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'th'	=> array('whois.nic.uk', 'No entries found'),
    							'tj.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'tm'	=> array('whois.nic.tm', 'No match for'),
    							'tn'	=> array('whois.ripe.net', 'No entries found'),
    							'tmp.br'	=> array('whois.nic.br', 'No match'),
    							'to'	=> array('whois.tonic.to', 'No match'),
    							'tr'	=> array('whois.ripe.net', 'Not found in database'),
    							'trd.br'	=> array('whois.nic.br', 'No match'),
    							'tur.br'	=> array('whois.nic.br', 'No match'),
    							'tv'	=> array('whois.nic.tv', 'MAXCHARS:75'),
    							'tv.br'	=> array('whois.nic.br', 'No match'),
    							'tw'	=> array('whois.twnic.net', 'NO MATCH TIP'),
    							'tw.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'ua'	=> array('whois.ripe.net', 'No entries found'),
    							'uk'	=> array('whois.thnic.net', 'No match for'),
    							'uk.com'	=> array('whois.nomination.net', 'No match for'),
    							'uk.net'	=> array('whois.nomination.net', 'No match for'),
    							'us'	=> array('whois.nic.us', 'Not found'),
    							'va'	=> array('whois.ripe.net', 'No entries found'),
    							'vet.br'	=> array('whois.nic.br', 'No match'),
    							'vg'	=> array('whois.adamsnames.tc', 'is not registered'),
    							'wattle.id.au'	=> array('whois.aunic.net', 'No Data Found'),
    							'web.tr'	=> array('whois.nic.tr', 'Not found in database'),
    							'ws'	=> array('whois.worldsite.ws', 'No match for'),
    							'xj.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'xz.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'yn.cn'	=> array('whois.cnnic.net.cn', 'No entries found'),
    							'yu'	=> array('whois.ripe.net', 'No entries found'),
    							'za'	=> array('whois.frd.ac.za', 'No match for'),
    							'zlg.br'	=> array('whois.nic.br', 'No match'),
    							'zj.cn'	=> array('whois.cnnic.net.cn', 'No entries found')
    		);
    		
        }
Beispiel #16
0
 /**
  * Define connection target
  *
  * @param string $host
  * @param int $port
  * @param string $community
  */
 public function Connect($host, $port = 161, $community = "public", $timeout = false, $retries = false, $SNMP_VALUE_PLAIN = false)
 {
     if (is_null($port)) {
         $port = self::DEFAULT_PORT;
     }
     //$this->Connection = "{$host}:{$port}";
     $this->Connection = "{$host}";
     $this->Community = $community;
     if (!$timeout) {
         $this->Timeout = !defined("SNMP_TIMEOUT") ? self::DEFAULT_TIMEOUT : SNMP_TIMEOUT;
     } else {
         $this->Timeout = $timeout;
     }
     $this->Timeout = $this->Timeout * 100000;
     $this->Retries = $retries ? $retries : self::DEFAULT_RETRIES;
     if ($SNMP_VALUE_PLAIN == true) {
         @snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
     } else {
         @snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
     }
     $this->Shell = ShellFactory::GetShellInstance();
 }
		/**
		 * Clean cache
		 *
		 * @return bool
		 */
		public function Clean()
		{
			$path = "{$this->CacheDir}".DIRECTORY_SEPARATOR."{$this->CacheName}";

			
			// Erase folder
			try 
			{
				
				$Shell = ShellFactory::GetShellInstance();
				if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
					$retval = $Shell->ExecuteRaw("rmdir /s /q {$path}");
				else
				{
					$retval = $Shell->ExecuteRaw("/bin/rm -rf {$path}");
				}
				
				// Failed to exec. Try native way.
				if (!$retval)
				{
					$retval = IOTool::UnlinkRecursive($path);
				}
					
	 			$retval &= !file_exists($path);
			}
			catch(Exception $e)
			{
				self::RaiseWarning("Failed to clear cache. ".$e->__toString());
			}
			
			// Create a new one
			$retval &= @mkdir($path, 0777, true);
			
 			return $retval;
		}