/** * Check whether the site is behind the Sucuri CloudProxy network. * * @param boolean $verbose Return an array with the hostname, address, and status, or not. * @return boolean Either TRUE or FALSE if the site is behind CloudProxy. */ public static function is_behind_cloudproxy($verbose = false) { $http_host = self::get_top_level_domain(); if (self::execute_dns_lookups()) { $host_by_addr = @gethostbyname($http_host); $host_by_name = @gethostbyaddr($host_by_addr); $status = (bool) preg_match('/^cloudproxy[0-9]+\\.sucuri\\.net$/', $host_by_name); } else { $status = false; $host_by_addr = '::1'; $host_by_name = 'localhost'; } /* * If the DNS reversion failed but the CloudProxy API key is set, then consider * the site as protected by a firewall. A fake key can be used to bypass the DNS * checking, but that is not something that will affect us, only the client. */ if ($status === false && SucuriScanAPI::getCloudproxyKey()) { $status = true; } if ($verbose) { return array('http_host' => $http_host, 'host_name' => $host_by_name, 'host_addr' => $host_by_addr, 'status' => $status); } return $status; }