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


Python pythonwhois.get_whois方法代码示例

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


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

示例1: whois

# 需要导入模块: import pythonwhois [as 别名]
# 或者: from pythonwhois import get_whois [as 别名]
def whois(self, ctx, domain:str):
        """Gets whois information on a domain"""
        try:
            info = pythonwhois.get_whois(domain)
        except pythonwhois.shared.WhoisException:
            await ctx.send(Language.get("information.root_server_not_found", ctx))
            return
        except KeyError:
            await ctx.send(Language.get("information.failed_domain_lookup", ctx))
            return
        if info["contacts"]["registrant"] is None:
            await ctx.send(embed=discord.Embed(title=Language.get("information.domain_available_title", ctx), description=Language.get("information.domain_available_description", ctx).format(domain), color=0x00FF00))
            return
        fields = {Language.get("information.registrar", ctx):info["registrar"][0], Language.get("information.registered_on", ctx):format_time(info["creation_date"][0]), Language.get("information.expires_on", ctx):format_time(info["expiration_date"][0]), Language.get("information.last_updated", ctx):format_time(info["updated_date"][0]), Language.get("information.name_servers", ctx):", ".join(info["nameservers"])}
        embed = make_list_embed(fields)
        embed.title = Language.get("information.domain_unavailable", ctx)
        embed.color = 0xFF0000
        await ctx.send(embed=embed) 
开发者ID:ZeroEpoch1969,项目名称:RubyRoseBot,代码行数:20,代码来源:information.py

示例2: query_whois

# 需要导入模块: import pythonwhois [as 别名]
# 或者: from pythonwhois import get_whois [as 别名]
def query_whois(self, query):

        try:

            whois_result = get_whois(domain=query)

            if "raw" in whois_result:

                if "No match" in str(whois_result["raw"][0]):
                    return None

                else:
                    return whois_result

            else:

                return None

        except UnicodeDecodeError, e:

            self.logger.debug(e)
            return None 
开发者ID:anilyuk,项目名称:punydomaincheck,代码行数:24,代码来源:domain.py

示例3: whois

# 需要导入模块: import pythonwhois [as 别名]
# 或者: from pythonwhois import get_whois [as 别名]
def whois(text):
    """<domain> -- Does a whois query on <domain>."""
    domain = text.strip().lower()

    try:
        data = pythonwhois.get_whois(domain, normalized=True)
    except pythonwhois.shared.WhoisException:
        return "Invalid input."
    info = []

    # We suppress errors here because different domains provide different data fields
    with suppress(KeyError):
        info.append("\x02Registrar\x02: {}".format(data["registrar"][0]))

    with suppress(KeyError):
        info.append("\x02Registered\x02: {}".format(data["creation_date"][0].strftime("%d-%m-%Y")))

    with suppress(KeyError):
        info.append("\x02Expires\x02: {}".format(data["expiration_date"][0].strftime("%d-%m-%Y")))

    info_text = ", ".join(info)
    return "{} - {}".format(domain, info_text) 
开发者ID:CloudBotIRC,项目名称:CloudBot,代码行数:24,代码来源:whois.py

示例4: findwhois

# 需要导入模块: import pythonwhois [as 别名]
# 或者: from pythonwhois import get_whois [as 别名]
def findwhois():
	os.system('clear') 
	CORE_STRING = colored("[web_whois]", 'blue')
       	TARGET = raw_input(CORE_STRING + " Website> ")
	domains = [TARGET]
	for dom in domains:
		details = pythonwhois.get_whois(dom)
	        print details['contacts']['registrant'] 
开发者ID:StreetSec,项目名称:Gloom-Framework,代码行数:10,代码来源:whois.py

示例5: check_whois_domains

# 需要导入模块: import pythonwhois [as 别名]
# 或者: from pythonwhois import get_whois [as 别名]
def check_whois_domains(domains):
    # TODO - Check apex domains once instead of for each domain stored (the same apex domain may appear several times)
    for domain in domains:
        details = pythonwhois.get_whois(domain.apex_domain)
        if details.get('status') is None:
            print("[!] Domain available for registering: {}".format(domain.apex_domain))
            domain.available = True
        else:
            print("[i] Domain registered: {}".format(domain.apex_domain))
            domain.available = False
    return domains 
开发者ID:0xbharath,项目名称:domains-from-csp,代码行数:13,代码来源:csp_parser.py

示例6: run

# 需要导入模块: import pythonwhois [as 别名]
# 或者: from pythonwhois import get_whois [as 别名]
def run(self, domain, filename):

        if filename is not None:
            file = open(filename, 'a')
            print("File opened\n"
              "Getting information and writing it on the file..")
            whois = pformat(pythonwhois.get_whois(domain))
            file.write(whois)
            file.close()
        else:
            "Getting information.."
            pprint(pythonwhois.get_whois(domain)) 
开发者ID:ffmancera,项目名称:pentesting-multitool,代码行数:14,代码来源:whois_utility.py

示例7: chk_whois

# 需要导入模块: import pythonwhois [as 别名]
# 或者: from pythonwhois import get_whois [as 别名]
def chk_whois(domain):
    #   *** .ca is not working, check more ***
    email = ns = createdate = expirationdate = updateddate = registrar = registrant = tel = ''
    w = dict(email=email, registrar=registrar, registrant=registrant, tel=tel, ns=ns, createdate=createdate, expirationdate=expirationdate, updateddate=updateddate)
    
    if chk_domain(domain):
        hostname, secondLD = chk_hostname(domain)
        try:
            #   find whois for second-level domain
            msg = 'parsing whois data of: %s ... ' % (secondLD)
            #logging.info(msg)
            ans = pythonwhois.get_whois(secondLD, True)
        except:
            return w
        if ans['contacts'].has_key('admin'):
            if ans['contacts']['admin'] is not None:
                if ans['contacts']['admin'].has_key('email'):
                    if ans['contacts']['admin']['email'] is not None:
                        email = ans['contacts']['admin']['email']
        if ans['contacts'].has_key('registrant'):
            if ans['contacts']['registrant'] is not None:
                if ans['contacts']['registrant'].has_key('name'):
                    if ans['contacts']['registrant']['name'] is not None:
                        registrant = ans['contacts']['registrant']['name']
                if ans['contacts']['registrant'].has_key('phone'):
                    if ans['contacts']['registrant']['phone'] is not None:
                        tel = ans['contacts']['registrant']['phone']
        if ans.has_key('registrar'):
            if ans['registrar'] is not None:
                registrar = ans['registrar']
            if type(ans['registrar']) is list:
                registrar = ans['registrar'][0]
        if ans.has_key('nameservers'):
            if ans['nameservers'] is not None:
                ns = ans['nameservers'][0]
        if ans.has_key('creation_date'):
            if ans['creation_date'] is not None:
                createdate = ans['creation_date']
        if ans.has_key('expiration_date'):
            if ans['expiration_date'] is not None:
                expirationdate = ans['expiration_date']
        if ans.has_key('updated_date'):
            if ans['updated_date'] is not None:
                updateddate = ans['updated_date']
        if createdate == '' and updateddate != '':
            createdate = updateddate
        w = dict(email=email, registrar=registrar.encode('utf-8'), registrant=registrant.encode('utf-8'), tel=tel, ns=ns, createdate=createdate, expirationdate=expirationdate, updateddate=updateddate)
    else:
        msg = '[*] no whois record: %s ...' % (domain)
        logging.info(msg)
    return w 
开发者ID:maltelligence,项目名称:maltelligence,代码行数:53,代码来源:dnsutils.py


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