当前位置: 首页>>代码示例>>Python>>正文


Python whois.query方法代码示例

本文整理汇总了Python中whois.query方法的典型用法代码示例。如果您正苦于以下问题:Python whois.query方法的具体用法?Python whois.query怎么用?Python whois.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在whois的用法示例。


在下文中一共展示了whois.query方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: import whois [as 别名]
# 或者: from whois import query [as 别名]
def run(self, params={}):
        domain = str(params.get(Input.DOMAIN))  # Comes in as unicode - whois library has assert for type on str
        self.logger.info("Getting whois information for %s" % domain)

        if not self.is_valid_domain(domain=domain):
            raise PluginException(cause="Invalid domain as input.",
                                  assistance="Ensure the domain is not prefixed with a protocol.")

        try:
            lookup_results = whois.query(domain, ignore_returncode=1)  # ignore_returncode required for plugin
        except Exception as e:
            self.logger.error("Error occurred: %s" % e)
            raise
        else:
            serializable_results = lookup_results.get_json_serializable()
            serializable_results = insightconnect_plugin_runtime.helper.clean_dict(serializable_results)

            return serializable_results 
开发者ID:rapid7,项目名称:insightconnect-plugins,代码行数:20,代码来源:action.py

示例2: process

# 需要导入模块: import whois [as 别名]
# 或者: from whois import query [as 别名]
def process(self, profile, state, vertex):
        if 'type' not in vertex:
            return { 'error' : "No vertex type defined!" }

        properties = dict()
        neighbors = list()

        if vertex['type'] == "domain":
            try:
                lookup = whois.query(vertex['id'])
                if lookup is not None:
                    for k, v in lookup.__dict__.items():
                        if isinstance(v, set):
                            properties[k] = list(v)
                        else:
                            properties[k] = v
            except Exception as e:
                print("Exception: {0}".format(e))

        return { "properties": properties, "neighbors" : neighbors } 
开发者ID:opendns,项目名称:og-miner,代码行数:22,代码来源:whois.py

示例3: get_info

# 需要导入模块: import whois [as 别名]
# 或者: from whois import query [as 别名]
def get_info(self, domain):
		self.domain = domain
		w = whois.query(self.domain)
		if w is not None:
			self.expiration_date = ""
			self.creation_date = ""
			if w.expiration_date is not None:
				self.expiration_date = str(w.expiration_date.isoformat())
			if w.creation_date is not None:
				self.creation_date = str(w.creation_date.isoformat()) 
开发者ID:david3107,项目名称:squatm3,代码行数:12,代码来源:Whoiser.py

示例4: whois_date_registered

# 需要导入模块: import whois [as 别名]
# 或者: from whois import query [as 别名]
def whois_date_registered(domain):
  try:
    query = whois.query(domain) # silently fails in corporate env, vocally fails behind proxy
  except Exception as e:
    query = None
    pass

  # if query.creation_date == "before aug-1996": query.creation_date = datetime.datetime(1996) # .co.uk edge case
  # elif type(query.creation_date) is not "date": query = None
  return query.creation_date if query else None 
开发者ID:fanmatics,项目名称:metadoc,代码行数:12,代码来源:lookup.py

示例5: main

# 需要导入模块: import whois [as 别名]
# 或者: from whois import query [as 别名]
def main(url):
    with open(LOCALHOST_PATH + DIRECTORY_NAME + '/markup.txt', 'r') as file:
        soup_string = file.read()

    soup = BeautifulSoup(soup_string, 'html.parser')

    status = []
    hostname = get_hostname_from_url(url)

    status.append(having_ip_address(url))
    status.append(url_length(url))
    status.append(shortening_service(url))
    status.append(having_at_symbol(url))
    status.append(double_slash_redirecting(url))
    status.append(prefix_suffix(hostname))
    status.append(having_sub_domain(url))

    dns = 1
    try:
        domain = whois.query(hostname)
    except:
        dns = -1

    status.append(-1 if dns == -1 else domain_registration_length(domain))

    status.append(favicon(url, soup, hostname))
    status.append(https_token(url))
    status.append(request_url(url, soup, hostname))
    status.append(url_of_anchor(url, soup, hostname))
    status.append(links_in_tags(url, soup, hostname))
    status.append(sfh(url, soup, hostname))
    status.append(submitting_to_email(soup))

    status.append(-1 if dns == -1 else abnormal_url(domain, url))

    status.append(i_frame(soup))

    status.append(-1 if dns == -1 else age_of_domain(domain))

    status.append(dns)

    status.append(web_traffic(soup))
    status.append(google_index(url))
    status.append(statistical_report(url, hostname))

    print('\n1. Having IP address\n2. URL Length\n3. URL Shortening service\n4. Having @ symbol\n'
          '5. Having double slash\n6. Having dash symbol(Prefix Suffix)\n7. Having multiple subdomains\n'
          '8. SSL Final State\n8. Domain Registration Length\n9. Favicon\n10. HTTP or HTTPS token in domain name\n'
          '11. Request URL\n12. URL of Anchor\n13. Links in tags\n14. SFH\n15. Submitting to email\n16. Abnormal URL\n'
          '17. IFrame\n18. Age of Domain\n19. DNS Record\n20. Web Traffic\n21. Google Index\n22. Statistical Reports\n')
    print(status)
    return status


# Use the below two lines if features_extraction.py is being run as a standalone file. If you are running this file as
# a part of the workflow pipeline starting with the chrome extension, comment out these two lines.
# if __name__ == "__main__":
#     if len(sys.argv) != 2:
#         print("Please use the following format for the command - `python2 features_extraction.py <url-to-be-tested>`")
#         exit(0)
#     main(sys.argv[1]) 
开发者ID:philomathic-guy,项目名称:Malicious-Web-Content-Detection-Using-Machine-Learning,代码行数:63,代码来源:features_extraction.py


注:本文中的whois.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。