Example #1
0
function extract_subdomains($domain)
{
    $subdomains = $domain;
    $domain = extract_domain($subdomains);
    $subdomains = rtrim(strstr($subdomains, $domain, true), '.');
    return $subdomains;
}
Example #2
0
 function import_url_list($url_list, $report_id)
 {
     $report_id = intval($report_id);
     if (!$this->state || $report_id <= 0) {
         return false;
     }
     $query = '';
     foreach ($url_list as $ftp_list_item) {
         list($url, $ftp_client) = $ftp_list_item;
         $domain = trim(extract_domain($url));
         if (strlen($domain)) {
             $query .= ",('" . mysql_real_escape_string($domain) . "')";
         }
     }
     if (strlen($query)) {
         $result = mysql_query('INSERT IGNORE INTO pony_domainlist (url_domain) VALUES ' . substr($query, 1), $this->db_link);
         if (!$result) {
             return false;
         }
     }
     $query_values = '';
     foreach ($url_list as $ftp_list_item) {
         list($url, $ftp_client) = $ftp_list_item;
         $url = trim($url);
         $ftp_client = trim($ftp_client);
         if (!strlen($url) || !strlen($ftp_client)) {
             continue;
         }
         $hash = mixed_sha1($url);
         if (str_begins($url, 'rdp://')) {
             $url_type = 'rdp';
         } elseif (str_begins($url, 'http://') || str_begins($url, 'https://')) {
             $url_type = 'http';
         } elseif (str_begins($url, 'sftp://')) {
             $url_type = 'ssh';
             $url = 'ftp://' . substr($url, strlen('sftp://'));
         } else {
             $url_type = 'ftp';
         }
         if (!strlen($query_values)) {
             $query_values .= 'VALUES';
         }
         $query_values .= sprintf("('%s','%s','%s','%s','%s','%s',IFNULL((SELECT domain_id FROM `pony_domainlist` WHERE url_domain='%s'), '0')),", mysql_real_escape_string($report_id), mysql_real_escape_string($url), mysql_real_escape_string($url_type), mysql_real_escape_string($hash), mysql_real_escape_string($ftp_client), mysql_real_escape_string(mysql_now_date()), mysql_real_escape_string(extract_domain($url)));
     }
     $query_values = substr($query_values, 0, -1);
     if (strlen($query_values)) {
         $query = "INSERT DELAYED IGNORE INTO pony_ftp (report_id, url, url_type, url_hash, ftp_client, import_time, domain_id) " . $query_values;
         $result = mysql_query($query, $this->db_link);
         if (!$result) {
             return false;
         }
     }
     return true;
 }
Example #3
0
 protected function _search_without_upc($upc, $api_data, $search_url)
 {
     $ret = array();
     $product = $this->Products->get_product_details($upc);
     if (!empty($product[0]['id'])) {
         $lookup_url = $this->Market->get_product_lookup_url($product[0]['id'], $api_data['id']);
         if ($lookup_url) {
             if (extract_domain($lookup_url) !== extract_domain($search_url)) {
                 log_message('error', 'Warning: Sticky ' . $api_data['name'] . ' spider is using a lookup URL with a different domain than the search URL: ' . $lookup_url);
             }
             try {
                 $ret = $this->sticky_api->getProductDetails($lookup_url);
             } catch (Exception $e) {
                 log_message('error', $e->getMessage(), 'Sticky "' . $api_data['name'] . '" spider exception searching by URL: ' . $lookup_url . ' for UPC: ' . $upc);
             }
         }
     }
     return $ret;
 }
Example #4
0
 /**
  * Just the domain name, without trailing delimeter.
  * @return string
  */
 public function domain()
 {
     return extract_domain($this->_text, $this->options());
 }
Example #5
0
    }
    $domain = $argv[1];
} else {
    if (!isset($_REQUEST['domain'])) {
        throw new MissingDomainArgumentException();
    }
    $domain = $_REQUEST['domain'];
}
$domain = extract_domain($domain);
if ($domain === false) {
    throw new InvalidDomainSuffixException();
}
$client = new SoapClient(BEIAN_WSDL_URL);
$key = ISP_PASSWORD;
$rand = randstr(20);
$params = array('ispID' => ISP_ID, 'userName' => ISP_USERNAME, 'randVal' => $rand, 'pwdHash' => base64_encode(md5($key . $rand, true)), 'hashAlgorithm' => 0, 'queryConditionType' => 0, 'queryCondition' => extract_domain($domain));
$response = $client->__soapCall("isp_querybeianstatus", array($params));
if (!$response || !$response->return) {
    throw new UnknownException();
}
$return = str_replace('GBK', 'UTF-8', $response->return);
$return = simplexml_load_string($return);
if (!$return) {
    throw new InvalidXMLPayloadException();
}
if (intval($return->msg_code) !== 0) {
    throw new MIITSOAPException($return->msg);
}
$ret = array('success' => true, 'domain' => $domain, 'status' => intval($return->StatusInfo->Bazt) == 0);
if ($ret['status']) {
    $ret = array_merge($ret, array('name' => (string) $return->StatusInfo->Wzmc, 'icp_subject' => (string) $return->StatusInfo->Ztbah, 'icp_site' => (string) $return->StatusInfo->Wzbah));
Example #6
0
function extract_subdomains($domain)
{
    $domain = rtrim(remove_first(preg_replace('(^https?://)', '', $domain), '//'), '/');
    $subdomains = $domain;
    $domain = extract_domain($subdomains);
    $subdomains = rtrim(strstr($subdomains, $domain, true), '.');
    return $subdomains;
}
Example #7
0
 /**
  * Assume an email address from SMTP settings
  *
  * @param array $smtp
  * @return String
  */
 public function get_smtp_email(array $smtp)
 {
     if (empty($smtp['username'])) {
         return FALSE;
     }
     if (valid_email($smtp['username'])) {
         return $smtp['username'];
     }
     if (empty($smtp['host'])) {
         return FALSE;
     }
     // The username is not an email address so we need to build it
     $domain = extract_domain($smtp['host']);
     $username = array_pop(explode('\\', $smtp['username']));
     return $username . '@' . $domain;
 }
Example #8
0
				        // L'entree n'est pas une adresse ip
					if ( is_ip( gethostbyname($result[$loop]) ) == "true" ) {
						$domains_list[$i] = $result[$loop];$i++;
					}
				}
			}  else {
			// $result[$loop] comporte des slash => Transfert dans $urls_list[$loop] si le domain est valide
				// Verification validite
				if ( is_ip( extract_domain($result[$loop]) ) == "true" ) {
				        // L'entree est une adresse ip
					if ( gethostbyaddr( extract_domain($result[$loop]) ) != $result[$loop] ) {
						$urls_list[$j] = $result[$loop];$j++;
					}
				} else {
				        // L'entree n'est pas une adresse ip
					if ( is_ip( gethostbyname( extract_domain($result[$loop]) ) ) == "true" ) {
						$urls_list[$j] = $result[$loop];$j++;
					}
				}
			}
		}
		if ( count($domains_list) !=0 ) {
			echo "<h4>Les domaines ci-dessous sont </h4>\n";
			// Lecture du fichier domains
			$file_domains=read_black_list ("domains");
			// Recherche si les elements de $domains_list sont presents dans $file_domains
			// et constitution des fichiers domains et domains.diff
			$fp=@fopen($path2bl."domains.diff","w");
			$fp1=@fopen($path2bl."domains","a");
			for ( $loop=0; $loop < count($domains_list); $loop++ ) {
				if ( @in_array ($domains_list[$loop], $file_domains) )