Whether you just want to see the route, ping response or speed to your home from our network or maybe you just want to check connectivity to a server located in another colocation facility. Whatever it may be we hope these tools help.
Speedtest.net Mini requires at least version 8 of Flash. Please update your client.
//-{{{ /** * Revision 1.9, March 9, 2007. * * Network Query Tool (NQT) is a PHP5 implementation of common network * lookup and name resolution tools. The purpose of NQT is to provide a * clean and secure web interface to network utilities like whois, ping, * and traceroute. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * For full documentation about Network Query Tool, please visit *
'; } } /** * A method to enable/disable the debugging capability. Debugging is disabled * by default and most users will not need it. **/ public function enableDebug($bool = false) { if (!is_bool($bool)) { $this->setError(self::$NQT_BOOLEAN_EXPECTED); return false; } $this->debug = $bool; } /** * A method to test whether or not a given port on the currently set host is * open. This does not implement any sort of protocol check, it just determines * whether or not the port is accepting connections. * * @param int $port The port number to test. * @return bool True if the port is open, false if not. **/ private function isRemotePortOpen($port) { /* Check for bogus port */ if (!is_numeric($port) || $port < 1 || $port > 65535) { $this->setError(self::$NQT_INVALID_PORT); return false; } return @fsockopen($this->getAddr(), $port) ? true : false; } /** * A method to attempt a ping to the currently set host. This is not a native * implementation of ping (yet) - it requires that a ping binary lives in * userspace (set the $PING_PATH property to the location for your system). * * @param int $numPings The number of pings, defaults to 5 * @return string The output of the ping, or false on error. **/ public function doPing($numPings = 5) { if (!file_exists(self::$PING_PATH)) { $this->setError(self::$NQT_BOGUS_PATH); return false; } /* Ensure that we have a legitimate IP address to ping. */ if (!$this->isValidHostAddr($this->getAddr())) { $this->debug('ping() has an invalid IP address.'); return false; } $ip = $this->getAddr(); /* Figure out whether we're on a unix or a Windows box, and call ping with the appropriate argument. This is not tested under Windows... */ if ($this->system == 'UNIX') { $this->debug('ping() is on a unix host, running: ' . self::$PING_PATH . ' -c' . $numPings . ' ' . $ip); $ping = escapeshellcmd(self::$PING_PATH . ' -c ' . $numPings . ' ' . $ip); return `$ping`; } $ping = escapeshellcmd(self::$PING_PATH . ' -n ' . $numPings . ' ' . $ip); return `$ping`; } /** * A method to attempt a traceroute to the currently set host. This is not a * native implementation of traceroute (yet) - it requires that a traceroute * binary lives in userspace (set the $TRACEROUTE_PATH property to the location * for your system). * * @return mixed The output of the traceroute, or false on error. **/ public function doTraceroute() { if (!file_exists(self::$TRACEROUTE_PATH)) { $this->setError(self::$NQT_BOGUS_PATH); return false; } /* Ensure that we have a legitimate IP address to traceroute to */ if (!$this->isValidHostAddr($this->getAddr())) { $this->debug('traceroute() has an invalid IP address.'); return false; } $ip = $this->getAddr(); $tr = escapeshellcmd(self::$TRACEROUTE_PATH . ' ' . $ip); return `$tr`; } /** * A method to return the RIR WHOIS data for an IP address. This method * expects a valid IP address to be set as the current IP, and accepts * an optional RIR WHOIS server parameter. If the IP address is invalid * or for some reason the info cannot be determined, this method * returns false and the error is set; otherwise it returns the WHOIS data. * * Currently auto-recognized RIRs are ARIN, RIPE, APNIC, JPNIC, LACNIC, * AFRINIC, and registro.br. * * @param string $whoisServer The RIR WHOIS server to use. * @return mixed A string containing WHOIS data for an IP address, * or false if the WHOIS cannot be completed. **/ public function doRirWhois($whoisServer = '') { /* Check for null or bogus IP */ if (is_null($this->getAddr()) || !$this->isValidHostAddr($this->getAddr())) { $this->setError(self::$NQT_INVALID_ADDR); return false; } /* If a WHOIS server was specified, ensure it's valid. */ if ($whoisServer == '') { $whoisServer = 'whois.arin.net'; $this->debug('doRirWhois() has a WHOIS server of whois.arin.net'); } else { if ($this->resolveHost($whoisServer) == $whoisServer || $this->resolveHost($whoisServer) == false) { $this->setError(self::$NQT_INVALID_HOST); return false; } } /* Connect to the WHOIS server and try to fetch the record */ if (!$sock = @fsockopen($whoisServer, 43, $e, $e, $this->getTimeout())) { $this->debug('doRirWhois() could not connect to ' . $whoisServer); $this->setError(self::$NQT_CONNECT_FAILED); return false; } fwrite($sock, $this->ipAddr . "\r\n"); while (!feof($sock)) { $buf .= fgets($sock, 10240); if (feof($sock)) break; } if (trim($buf) == '') { $this->debug('doRirWhois() got a blank response from ' . $whoisServer); return false; } /* @TODO Follow recognized redirects to other servers */ /* foreach (self::$RIR_MAP as $rir) { if (preg_match('/' . $rir['grepText'] . '/mis', $buf)) { $this->debug('doRirWhois() redirected to RIR: ' . $rir['rirName']); return $this->doRirWhois($rir['rirServer']); } } */ return $buf; } /** * A method to return the WHOIS information for the currently set hostname. * If the hostname is invalid or WHOIS data can't be retrieved, we return * false (and the error will be set). The optional $whoisServer parameter * allows for recursive/nested WHOIS lookups; you generally should not pass * this parameter. * * @return mixed A string containing the whois data for a TLD, * or false if the WHOIS cannot be completed. **/ public function doWwwWhois($whoisServer = '') { /* Check for null or bogus host */ if (is_null($this->getHost()) || !$this->isValidHostName($this->getHost())) { $this->setError(self::$NQT_INVALID_HOST); return false; } /* Check for subdomains (not supported), and if one is found, strip it down to the base TLD. */ if (substr_count($this->getHost(), '.') > 1) { $hostPartsArray = explode('.', $this->getHost()); $whoisTarget = $hostPartsArray[count($hostPartsArray) - 2] . '.' . $hostPartsArray[count($hostPartsArray) - 1]; $this->debug('doWwwWhois() found subdomain; chopping to TLD: ' . $whoisTarget); } else { $whoisTarget = $this->getHost(); } /* Connect to the root WHOIS server and query on this host. For purposes of recursion, we accept a passed-in WHOIS server. */ if ($whoisServer == '') { if ($this->getWhoisServerForHost($whoisTarget) === false) { $this->debug('doWwwWhois() could not get WHOIS server for ' . $whoisTarget); return false; } $whoisServer = $this->getWhoisServerForHost($whoisTarget); $this->debug('host is ' . $whoisTarget); $this->debug('wwwWhois() has a whois server of: ' . $whoisServer); } if (!$sock = @fsockopen($whoisServer, 43, $e, $e, $this->getTimeout())) { $this->setError(self::$NQT_CONNECT_FAILED); return false; } fwrite($sock, $whoisTarget . "\r\n\r\n"); while (!feof($sock)) { $buf .= fgets($sock, 10240); } if (preg_match('/Whois Server: (.*)/i', $buf, $matches)) { return $this->doWwwWhois($matches[1]); } /* Get rid of disclaimers and bloat - EXPERIMENTAL */ if (self::$SAVE_BANDWIDTH) { $this->debug('doWwwWhois() attempting to glob disclaimers out of WHOIS'); if (preg_match('/the data(.*)domain availability/mis', $buf)) { /* Tucows */ $buf = preg_replace('/the data(.*)domain availability./mis', '', $buf); $this->debug('doWwwWhois() found and removed Tucows disclaimer.'); } if (preg_match('/NOTICE: The expiration.*at any time./', $buf)) { /* Verislime */ $buf = preg_replace('/NOTICE: The expiration.*at any time./mis', '', $buf); $this->debug('doWwwWhois() found and removed Verisign disclaimer.'); } if (preg_match('|NOTICE AND TERMS(.*)AboutUs(.*)|mis', $buf)) { /* Netsol _on top of_ Verislime */ $buf = preg_replace('|NOTICE AND TERMS(.*)AboutUs(.*)|mis', '', $buf); $this->debug('doWwwWhois() found and removed Network Solutions disclaimer.'); } if (preg_match('/NOTICE: Access to.*abide by this policy./', $buf)) { /* CORE */ $buf = preg_replace('/NOTICE: Access to.*abide by this policy./mis', '', $buf); $this->debug('doWwwWhois() found and removed CORE disclaimer.'); } } /* Trim multiple newlines */ while(preg_match("/[\r\n]{3}/mis", $buf)) { $buf = preg_replace("/[\r\n]{3}/mis", "\n\n", $buf); } return $buf; } /** * A method to determine and return the WHOIS server responsible for a * given TLD. * * @param string $host The hostname/domain name for which to determine * the WHOIS server. * @return string The WHOIS server responsible for this host. * If this particular TLD is not supported by NQT, * an empty string is returned and the error is set. **/ public function getWhoisServerForHost($host) { if (!$this->isValidHostName($host)) { $this->debug('getWhoisServerForHost() has an invalid host.'); $this->setError(self::$NQT_INVALID_HOST); return false; } /* Determine the WHOIS server based upon the TLD. Because this is such a large list, we use a switch statement instead of a static class variable "map." */ switch(strtolower(strstr($host, '.'))) { case '.com': case '.net': case '.edu': return 'whois.crsnic.net'; case '.org': return 'whois.corenic.net'; case '.ac': return 'whois.nic.ac'; case '.aero': return 'whois.aero'; case '.am': return 'whois.amnic.net'; case '.as': return 'whois.nic.as'; case '.at': return 'whois.nic.at'; case '.au': case '.com.au': case '.net.au': case '.org.au': case '.asn.au': case 'id.au': return 'whois.ausregistry.net'; case '.be': return 'whois.dns.be'; case '.biz': return 'whois.nic.biz'; case '.br': return 'whois.nic.br'; case '.ca': return 'whois.cira.ca'; case '.cc': return 'ccwhois.verisign-grs.com'; case '.cd': return 'whois.cd'; case '.ch': return 'whois.nic.ch'; case '.cl': return 'nic.cl'; case '.cn': return 'whois.cnnic.net.cn'; case '.coop': return 'whois.nic.coop'; case '.cx': return 'whois.nic.cx'; case '.cz': return 'whois.nic.cz'; case '.de': return 'whois.denic.de'; case '.dk': return 'whois.dk-hostmaster.dk'; case '.edu': return 'whois.educause.net'; case '.ee': return 'myristaja.eenet.ee'; case '.fi': return 'whois.ficora.fi'; case '.fr': return 'whois.afnic.fr'; case '.gov': return 'nic.gov'; case '.hk': return 'whois.hkdnr.net.hk'; case '.hu': return 'whois.nic.hu'; case '.ie': return 'whois.domainregistry.ie'; case '.il': return 'whois.isoc.org.il'; case '.in': return 'whois.inregistry.net'; case '.info': return 'whois.afilias.net'; case '.int': return 'whois.iana.org'; case '.is': return 'whois.isnic.is'; case '.is': return 'aten.isnic.is'; case '.it': return 'whois.nic.it'; case '.jp': return 'whois.jprs.jp'; case '.kr': return 'whois.krnic.net'; case '.la': return 'whois2.afilias-grs.net'; case '.li': return 'whois.nic.ch'; case '.lt': return 'ns.litnet.lt'; case '.lu': return 'whois.dns.lu'; case '.mil': return 'is-1.nic.mil'; case '.museum': return 'whois.museum'; case '.mx': return 'whois.nic.mx'; case '.name': return 'whois.nic.name'; case '.nl': return 'whois.domain-registry.nl'; case '.no': return 'whois.norid.no'; case '.nu': return 'whois.worldnames.net'; case '.nu': return 'whois.nic.nu'; case '.nz': return 'whois.srs.net.nz'; case '.nz': return 'srs-ak.srs.net.nz'; case '.pl': return 'whois.dns.pl'; case '.pt': return 'whois.dns.pt'; case '.pt': return 'online.dns.pt'; case '.pt': return 'hercules.dns.pt'; case '.ro': return 'whois.rotld.ro'; case '.ru': return 'whois.ripn.net'; case '.se': return 'ext.nic-se.se'; case '.sg': return 'aphrodite.nic.net.sg'; case '.si': return 'whois.arnes.si'; case '.sh': return 'whois.nic.sh'; case '.sk': return 'whois.sk-nic.sk'; case '.su': return 'whois.ripn.net'; case '.tf': return 'whois.nic.tf'; case '.th': return 'whois.thnic.net'; case '.to': return 'whois.tonic.to'; case '.tr': return 'whois.nic.tr'; case '.tv': return 'tvwhois.verisign-grs.com'; case '.tw': return 'whois.twnic.net'; case '.ua': return 'whois.net.ua'; case '.uk': return 'whois.nic.uk'; case '.us': return 'whois.nic.us'; case '.ws': return 'whois.worldsite.ws'; case '.al': case '.az': case '.ba': case '.bg': case '.by': case '.cy': case '.eg': case '.es': case '.fo': case '.gb': case '.ge': case '.gr': case '.hr': case '.lv': case '.ma': case '.md': case '.mk': case '.mt': case '.sm': case '.tn': case '.ua': case '.va': return 'whois.ripe.net'; default: /* Well shit! Maybe there is a new gTld that we don't know about. */ $domain = str_replace('.', '', strstr($host, '.')); $whoisServer = gethostbyname($domain . '.whois-servers.net'); if ($whoisServer == $domain) { $this->setError(self::$NQT_TLD_UNSUPPORTED); return false; } return $whoisServer; } } /** * A method to resolve a hostname to IP or vice versa, whichever was passed * in as the target when this object was created. * * @param string $host The host or IP address to resolve. * * @return mixed A string containing the resolved address/hostname, * or false if an error occurred. **/ public function doResolveHost() { if (preg_match('|[a-zA-Z]|', $this->getTarget())) { return $this->resolveHost($this->getTarget()); } return $this->resolveAddr($this->getTarget()); } public function doCheckPort($portNumber) { if (!$this->isValidHostAddr($this->getAddr())) { return false; } return $this->isRemotePortOpen($portNumber); } /** * A method to perform DNS lookups via the DiG binary. This currently only * works on Unix hosts. A native implementation that works on any platform * is planned for future development. * * @return mixed If unix, the results of `dig any hostname`; * if Windows or the path to dig is invalid, false * and the error is set. **/ public function doDig() { if (!file_exists(self::$DIG_PATH)) { $this->debug('doDig() has an invalid path to the dig binary.'); $this->setError(self::$NQT_BOGUS_PATH); return false; } /* Make sure we're a unix host. */ if (!preg_match('/unix/i', $this->system)) { $this->debug('doDig() does not work on Windows systems at this time.'); $this->setError(self::$NQT_UNIX_ONLY); return false; } /* dig takes a hostname, not an IP address */ if (!$this->isValidHostName($this->getHost())) { $this->debug('doDig() requires a valid hostname.'); $this->setError(self::$NQT_INVALID_HOST); return false; } $this->debug('doDig() working...'); $dig = escapeshellcmd(self::$DIG_PATH . ' any ' . $this->getHost()); return `$dig`; } //}}}Methods } //}}} class NetworkQueryTool ?>

