當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。