Example #1
0
 /**
  * Wrap the regDomain/getRegisteredDomain function
  *
  * @param unknown $domain        	
  * @return unknown|Ambigous <NULL, string, unknown, mixed>
  */
 private function getRegisteredDomain($hostname)
 {
     $registeredDomain = getRegisteredDomain($hostname);
     if ($registeredDomain === NULL) {
         return $hostname;
     }
     return $registeredDomain;
 }
Example #2
0
 public function store_links_out()
 {
     $myurl = $this->url;
     @($mydomain = getRegisteredDomain(parse_url($myurl, PHP_URL_HOST)));
     $linksout = array();
     $all_links = $this->html->find("a");
     foreach ($all_links as $link) {
         $href = $link->href;
         @($nextdomain = getRegisteredDomain(parse_url($href, PHP_URL_HOST)));
         if ($nextdomain != "" && $nextdomain != $mydomain) {
             array_push($linksout, $href);
         }
     }
     return $linksout;
 }
Example #3
0
 * the License.  You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </@LICENSE>
 *
 * Florian Sager, 25.07.2008, sager@agitos.de, http://www.agitos.de
 */
require_once "effectiveTLDs.inc.php";
require_once "regDomain.inc.php";
if ($_SERVER["argc"] < 2) {
    print "test-regDomain.php <(fully-qualified-domain-name )+>\n";
    exit;
}
// strip subdomains from every signing domain
// char dom[] = "sub2.sub.registered.nom.ad";
$argc = $_SERVER["argc"];
$argv = $_SERVER["argv"];
for ($i = 1; $i < $argc; $i++) {
    $registeredDomain = getRegisteredDomain($argv[$i], $tldTree);
    if ($registeredDomain === NULL) {
        printf("error: %s\n", $argv[$i]);
    } else {
        printf("%s\n", $registeredDomain);
    }
}
 static function registeredDomain($domain)
 {
     return getRegisteredDomain($domain);
 }
 /**
  * Given a hostname, test if it has open ports
  *
  * @param string $hostname        	
  */
 private function talkToMailServer($connectionString)
 {
     $this->logger->trace('talkToMailServer()');
     $stream = $this->createStream($connectionString, $this->connectionTimeout);
     if ($stream) {
         $serverName = PostmanUtils::postmanGetServerName();
         @stream_set_timeout($stream, $this->readTimeout);
         // see http://php.net/manual/en/transports.inet.php#113244
         // see http://php.net/stream_socket_enable_crypto
         $result = $this->readSmtpResponse($stream);
         if ($result) {
             $this->reportedHostname = $result;
             $this->reportedHostnameDomainOnly = getRegisteredDomain($this->reportedHostname);
             $this->logger->trace(sprintf('comparing %s with %s', $this->reportedHostnameDomainOnly, $this->hostnameDomainOnly));
             $this->mitm = true;
             // MITM exceptions
             if ($this->reportedHostnameDomainOnly == 'google.com' && $this->hostnameDomainOnly == 'gmail.com') {
                 $this->mitm = false;
             } elseif ($this->reportedHostnameDomainOnly == 'hotmail.com' && $this->hostnameDomainOnly == 'live.com') {
                 $this->mitm = false;
             } elseif ($this->reportedHostnameDomainOnly == $this->hostnameDomainOnly) {
                 $this->mitm = false;
             }
             $this->debug(sprintf('domain name: %s (%s)', $this->reportedHostname, $this->reportedHostnameDomainOnly));
             $this->sendSmtpCommand($stream, sprintf('EHLO %s', $serverName));
             $this->readSmtpResponse($stream);
             if ($this->checkStartTls) {
                 $this->sendSmtpCommand($stream, 'STARTTLS');
                 $this->readSmtpResponse($stream);
                 $starttlsSuccess = @stream_socket_enable_crypto($stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
                 if ($starttlsSuccess) {
                     $this->startTls = true;
                     $this->secure = true;
                     $this->sendSmtpCommand($stream, sprintf('EHLO %s', $serverName));
                     $this->readSmtpResponse($stream);
                 } else {
                     $this->error('starttls failed');
                 }
             }
             fclose($stream);
             $this->debug('return true');
             return true;
         } else {
             fclose($stream);
             $this->debug('return false');
             return false;
         }
     } else {
         return false;
     }
 }