Beispiel #1
0
 function network()
 {
     $this->set('title', 'Network');
     $this->expect(is_null($this->get('ERROR')), 'No errors expected at this point', 'ERROR variable is set: ' . $this->get('ERROR.text'));
     $this->expect($this->privateip('127.0.0.59'), 'Localhost identified correctly', 'Localhost detection failed');
     $this->expect($this->privateip('192.168.0.5'), 'Private Network (192.168.0.5) identified correctly', 'Private Network (192.168.0.5) detection failed');
     $this->expect($this->privateip('172.16.3.2'), 'Private Network (172.16.3.2) identified correctly', 'Private Network (172.16.3.2) detection failed');
     $this->expect($this->privateip('10.10.10.10'), 'Private Network (10.10.10.10) identified correctly', 'Private Network (10.10.10.10) detection failed');
     $this->expect(!$this->privateip('4.2.2.1'), 'Public Network (4.2.2.1) identified correctly', 'Public Network (4.2.2.1) detection failed');
     $this->expect(!$this->privateip('169.254.222.111'), 'Public Network (169.254.222.111) identified correctly', 'Public Network (169.254.222.111) detection failed');
     for ($i = 0; $i < 3; $i++) {
         $ping = Net::ping('www.yahoo.com', TRUE, 1);
         $this->expect(!is_bool($ping), 'Ping round-trip time to/from www.yahoo.com: ' . round($ping['avg']) . 'ms', 'No ping reply from www.yahoo.com');
     }
     $this->set('QUIET', TRUE);
     $ping = Net::ping('www.yxy.cc', TRUE, 1);
     $this->expect(is_bool($ping), 'www.yxy.cc: No ping reply expected', 'Huh? Ping reply from www.yay.cc');
     $this->set('QUIET', FALSE);
     $this->expect($result = Net::whois('sourceforge.net'), 'Received response from whois server: <pre>' . $result . '</pre>', 'No response from whois server');
     /*
     $path=Net::traceroute('58.71.0.158',TRUE);
     $this->expect(
     	is_array($path),
     	'Traceroute initiated',
     	'Traceroute failed'
     );
     if (is_array($path))
     	foreach ($path as $node)
     		if (is_bool($node))
     			$this->expect(
     				TRUE,
     				'Traceroute hop skipped'
     			);
     		else
     			$this->expect(
     				TRUE,
     				'Traceroute '.$node['host'].' '.
     					'min: '.$node['min'].'ms '.
     					'avg: '.$node['avg'].'ms '.
     					'max: '.$node['max'].'ms '.
     					'packets: '.$node['packets']
     			);
     */
     echo $this->render('basic/results.htm');
 }