• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pythonwhois.get_whois函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RunWhoIS

    def RunWhoIS(self):
        '''
        Run the Whois CLI Command
        '''
        self.wass.CurrentTask = "Whois"
        # Setup the logging, we are about to use it in wasslib.WassCommon.Common !!!!!
        self.wass.WhoisWassLog = self.wass.CurrentTask + "_" + self.wass.TargetDomain + "_" + self.wass.ReportDate + ".log"
        self.wass.WhoisTargetXMLReport = self.wass.CurrentTask + "_" + self.wass.TargetDomain + "_" + self.wass.ReportDate + ".xml"
        self.wass.WassGetVersion._GetWhoisVersion()
        self.wass.WassLogging.CreateLogfile(self.wass.WhoisWassLog)
        self.wass.WassCommon.printInfo()

        # Get the Dynamic parameters
        self.wass.WassCommon.getDynamic()
        self.wass.WhoisTargetIPXMLReport = self.wass.CurrentTask + "_" + self.wass.TargetIP + "_" + self.wass.ReportDate + ".xml"
        self.wass.WassLogging.info("############### Whois WASS Run Starting ###############")
        # Dont do a Whois lookup if the IP Address of the target is Private
        if (self.wass.TargetIPType == True):
            self.wass.WassLogging.info("The IP Address is a private one so we don't do the Whois Lookup")
        else:
            self.wass.WassLogging.info("The IP Address is a public one so we do the Whois Lookup")
            self.wass.WassLogging.info("The Whois query for the Domain is: %s " % self.wass.TldDomainName)
            self.wass.WassLogging.info("The Whois query for the IP Address is: %s " % self.wass.TargetIP)

            emailBody = "This is the result email for the " + self.wass.CurrentTask + " run against: " + self.wass.TargetDomain
            emailBody += "\n\nFollowing is the Whois Lookup for the Top Level Domain Name:\n\n"
            tlDomain = pythonwhois.net.get_whois_raw(self.wass.TldDomainName)

            self.wass.WassXML.createWhoisXML(pythonwhois.get_whois(self.wass.TldDomainName), self.wass.TldDomainName, self.wass.WhoisTargetXMLReport)

            for line in tlDomain:
                emailBody += line

            emailBody += "\n\nFollowing is the Whois lookup on the IP Address:\n\n"

            tlDomain = pythonwhois.net.get_whois_raw(self.wass.TargetIP)
            self.wass.WassXML.createWhoisXML(pythonwhois.get_whois(self.wass.TargetIP), self.wass.TargetIP, self.wass.WhoisTargetIPXMLReport)
            for line in tlDomain:
                emailBody += line

            self.wass.WassLogging.infoNoFormatting(emailBody)

            if (self.wass.SendEmail):
                self.wass.WassCommon.SendEMail(emailBody)

        self.wass.WassLogging.info("############### Whois WASS Run Done ###############")
        finalResultDir = self.wass.WassCommon.createResultDir()
        self.wass.WassCommon.moveResultFile(self.wass.WhoisTargetXMLReport, finalResultDir)
        self.wass.WassCommon.moveResultFile(self.wass.WhoisTargetIPXMLReport, finalResultDir)
        self.wass.WassCommon.printInfo()
        #Now we need to stop the current logging so we can copy the log file into the result directory for the current run
        self.wass.WassLogging.stopLogging()
        self.wass.WassCommon.moveLogFile(self.wass.WhoisWassLog, finalResultDir)
开发者ID:TomStageDK,项目名称:WASS,代码行数:53,代码来源:whois.py


示例2: query_pinyin_domains

def query_pinyin_domains(limit=10000):
    '''获取词频前 10000 的拼音词'''
    c = conn.cursor()

    c.execute(
        'SELECT rowid, pinyin, frequency, last_updated FROM pinyin_domains WHERE expiry_date_com IS NULL ORDER BY frequency DESC LIMIT 10000')

    for row in c.fetchall():

        available_com = ''
        available_cn = ''

        # 打印 ID
        print row[0]

        if not row[1]:
            break

        # 拼合 COM 域名和 CN 域名
        pinyin = row[1]
        domain_com = pinyin + '.com'
        domain_cn = pinyin + '.cn'

        # 查询 Whois
        print domain_com
        try:
            w_com = pythonwhois.get_whois(domain_com, True)
        except:
            w_com = None

        if is_available(w_com):
            available_com = domain_com
        else:
            expiry_date_com = get_expiry_date(w_com)

        # 查询 Whois
        print domain_cn
        try:
            w_cn = pythonwhois.get_whois(domain_cn, True)
        except:
            w_cn = None

        if is_available(w_cn):
            available_cn = domain_cn
        else:
            expiry_date_cn = get_expiry_date(w_cn)

        # 更新数据库记录, 状态、有效期
        sql = 'UPDATE "main"."pinyin_domains" SET "available_com"="{1}", "expiry_date_com"="{2}", "available_cn"="{3}", "expiry_date_cn"="{4}", "last_updated"="{5}" WHERE rowid={0}'.format(
            row[0], available_com, expiry_date_com, available_cn, expiry_date_cn, time.time())
        c.execute(sql)
        conn.commit()
开发者ID:bopo,项目名称:domaindiscoverer,代码行数:52,代码来源:domain_discoverer.py


示例3: _whois_search

 def _whois_search(self, domain):
     # TODO - fix this
     try: 
         results = pythonwhois.get_whois(domain)
         emails = pythonwhois.get_whois(domain)
     except: return pd.DataFrame()
     emails = filter(None, results['contacts'].values())
     emails = pd.DataFrame(emails)
     emails['domain'] = domain
     for index, row in emails.iterrows():
         name = FullContact()._normalize_name(row['name'])
         email = row.email.strip()
         pattern = EmailGuessHelper()._find_email_pattern(name, row.email)
         emails.ix[index, 'pattern'] = pattern
     CompanyEmailPatternCrawl()._persist(emails, "whois_search")
开发者ID:john2x,项目名称:clearspark,代码行数:15,代码来源:sources.py


示例4: contact

def contact(domain):
        domain = remove_www(domain)
        whois = pythonwhois.get_whois(domain)
        result = whois['contacts']
	for key, value in result.items():
		admin = value
		return admin        		
开发者ID:mohtork,项目名称:madaya-whois,代码行数:7,代码来源:madaya.py


示例5: enter_callback

    def enter_callback(self, widget, entry, lblResult):
        try:
            domainName = entry.get_text()
            lblResult.set_text("Checking...")
            domainArr = domainName.split('.')
            if domainArr[0] == "www" or  domainArr[0] == "http://www":
                domainName = ""
                for (i, item) in enumerate(domainArr):
                    if(i == 0):continue;
                    if(i > 1): domainName += "."
                    domainName += domainArr[i]

            w = pythonwhois.get_whois(domainName)
            result = "Domain : %s \n" % domainName
            if w["contacts"]["registrant"] is None:
                result += "\nDomain Is Available"
            else:
                result += "Registrant : %s \n" % w["contacts"]["registrant"]["name"]
                result += "Created at : %s \n" % w["creation_date"][0].strftime("%d/%m/%Y")
                result += "Expired at : %s \n" % w["expiration_date"][0].strftime("%d/%m/%Y")
        except pythonwhois.shared.WhoisException:
            lblResult.set_text("An Error Occurred!: Please check the domain!")
        except :
            lblResult.set_text("An Error Occurred!: Please check the domain!")
        else:
            lblResult.set_text(result)
开发者ID:kodpix,项目名称:checkDomain,代码行数:26,代码来源:check.py


示例6: _who_is

def _who_is(domain, queue):
    try:
        who = pythonwhois.get_whois(domain)
        queue.put([domain, who['raw'][0].replace('\n', ' ').replace('\r', ' ')])
    except (SocketError, WhoisException):
        # we don't know - write a question mark to the queue for this domain
        queue.put([domain, '?'])
开发者ID:InfoSecResearcherJSL,项目名称:WHOIS_NETOOLS20160210,代码行数:7,代码来源:domainr.py


示例7: get_whois

 def get_whois(self, domain):
     """ Fetch whois data for the given domain."""
     try:
         whois = pythonwhois.get_whois(domain)
     except:
         whois = "Timed Out/Not Found Blah!!!!"
     return whois # check for normalizations
开发者ID:JonasPed,项目名称:rumal,代码行数:7,代码来源:whoisplugin.py


示例8: domain_info

def domain_info(domain):
    """Get as much information as possible for a given domain name."""
    domain = get_registered_domain(domain)
    result = pythonwhois.get_whois(domain)
    registrar = []
    if 'registrar' in result and len(result['registrar']) > 0:
        registrar = result['registrar'][0]
    nameservers = result.get('nameservers', [])
    days_until_expires = None
    expires = None
    if 'expiration_date' in result:
        if (isinstance(result['expiration_date'], list)
                and len(result['expiration_date']) > 0):
            expires = result['expiration_date'][0]
            if isinstance(expires, datetime.datetime):
                days_until_expires = (expires - datetime.datetime.now()).days
                expires = utils.get_time_string(time_obj=expires)
            else:
                days_until_expires = (utils.parse_time_string(expires) -
                                      datetime.datetime.now()).days
    return {
        'name': domain,
        'whois': result['raw'],
        'registrar': registrar,
        'nameservers': nameservers,
        'days_until_expires': days_until_expires,
        'expiration_date': expires,
    }
开发者ID:gondoi,项目名称:satori,代码行数:28,代码来源:dns.py


示例9: whois

    def whois(self):
        if not self.values:
            return "The Doctor"
            
        url = self.values[0] 
        results = pythonwhois.get_whois(url)

        print results

        try:
            r = results['contacts']['registrant']
            expires = results['expiration_date'].pop(0).strftime('%m/%d/%Y') 
            order = [
                'name',
                'street',
                'city',
                'state',
                'postalcode',
                'country',
                'phone',
                'email',
            ]
            output = []
            for entry in order:
                output.append(r[entry])

            reformat = ', '.join(output)
            return '%s: Registered by %s. Expires %s' % (url, reformat, expires)
        except:
            return 'No results, or parsing failure.'
开发者ID:jsbronder,项目名称:MongoBot,代码行数:30,代码来源:reference.py


示例10: whois_host

def whois_host(phenny, input):
	if whois_available:
		domain = input.group(2)
		result = pythonwhois.get_whois(domain, normalized=True)
		
		if result is not None:
			if len(result) <= 2:
				phenny.say("The domain \x0304%s\x03 does not seem to exist." % domain)
			else:
				try:
					registrar = result["registrar"][0]
				except KeyError, e:
					registrar = "unknown registrar"
				
				try:
					creation_date = result['creation_date'][0].isoformat()
				except KeyError, e:
					creation_date = "unknown"
				
				try:
					expiration_date = result['expiration_date'][0].isoformat()
				except KeyError, e:
					expiration_date = "unknown"
				
				try:
					holder = "%s (%s)" % (result["contacts"]["registrant"]["name"], result["contacts"]["registrant"]["organization"])
				except Exception, e:
					try:
						holder = result["contacts"]["registrant"]["name"]
					except Exception, e:
						try:
							holder = result["contacts"]["registrant"]["organization"]
						except Exception, e:
							holder = "unknown"
开发者ID:joepie91,项目名称:phenny,代码行数:34,代码来源:ipinfo.py


示例11: whoisweb

def whoisweb():
    print(''+R+'Example - example.com')
    h = raw_input(''+T+'' + color.UNDERLINE + 'Website>' + color.END)
    domains = [h]
    for dom in domains:
        details = pythonwhois.get_whois(dom)
        print details['contacts']['registrant'] 
开发者ID:PythonExtraction,项目名称:Trity,代码行数:7,代码来源:whoisweb.py


示例12: do_live_query

    def do_live_query(self, obj, config):
        try:
            results = pythonwhois.get_whois(obj.domain)
        except pythonwhois.shared.WhoisException as e:
            self._error("Unable to find WHOIS information. %s" % str(e))
            return

        contacts = results.get('contacts', {})
        for contact_type in contacts.keys():
            # If not provided it defaults to None.
            if not contacts[contact_type]:
                continue
            for k, v in contacts[contact_type].iteritems():
                self._add_result("Live: " + contact_type + " Contact", v, {'Key': k})

        for ns in results.get('nameservers', []):
            self._add_result('Live: Nameservers', ns, {'Key': 'Nameserver'})

        for registrar in results.get('registrar', []):
            self._add_result('Live: Registrar', registrar, {'Key': 'Registrar'})

        for key in ['creation_date', 'expiration_date', 'updated_date']:
            for date in results.get(key, []):
                if date:
                    self._add_result('Live: Dates', date, {'Key': key})
开发者ID:bushalo,项目名称:crits_services,代码行数:25,代码来源:__init__.py


示例13: get_whois_data

def get_whois_data(domain,return_type):
	try:
		whois = pythonwhois.get_whois(domain.strip())
	except:
		return 0
	try:
		creation_date = whois['creation_date']
		updated_date = whois['updated_date']
		expiry_date = whois['expiration_date']
		organisation = str(whois['contacts']['registrant']['organization'])
		name = str(whois['contacts']['registrant']['name'])
		email = str(whois['contacts']['registrant']['email'])
		phone = str(whois['contacts']['registrant']['phone'])
		street = str(whois['contacts']['registrant']['street'])
		city = str(whois['contacts']['registrant']['city'])
		postcode = str(whois['contacts']['registrant']['postalcode'])
		country = str(whois['contacts']['registrant']['country'])
	except:
		return 0
	if return_type == 1:
		return (domain.strip(),creation_date[0].strftime('%m/%d/%Y %H:%M'),updated_date[0].strftime('%m/%d/%Y %H:%M'),expiry_date[0].strftime('%m/%d/%Y %H:%M'),organisation,name,email,phone,street,city,postcode,country)
	else:
		data_list = OrderedDict([('Creation Date',creation_date[0].strftime('%m/%d/%Y %H:%M')), 
					 ('Updated Date',updated_date[0].strftime('%m/%d/%Y %H:%M')),
					 ('Expiration Date',expiry_date[0].strftime('%m/%d/%Y %H:%M')),
					 ('Organisation', organisation),
					 ('Name', name),
					 ('Email', email),
					 ('Phone', phone),
					 ('Street', street),
					 ('City', city),
					 ('Postcode', postcode),
					 ('Country',country)
					])
		return data_list
开发者ID:Achromatic-Security,项目名称:Misc-BulkWHOIS,代码行数:35,代码来源:bulk_whois.py


示例14: main

def main():
  messages = ''
  problems = ''
  for domain, exts in domainnames.items():
    for ext in exts:
      d = domain+"."+ext
      try:
        w = pythonwhois.get_whois(d)
        if w:
          if type(w['expiration_date'][0]) is not datetime.date:
            days = (w['expiration_date'][0] - datetime.datetime.utcnow()).days
            for p in periods:
              if days < p:
                messages = messages + "Domain "+d+" will expire in "+str(days)+" days!\n"
          else:
            problems = problems+"No expiration date found for: "+d+"\n"

        else:
          problems = problems+"Domain not found: "+d+"\n"
      except Exception as e:
        problems = problems+d+": "+str(e)+"\n"

  if messages != '' and problems == '':
    for email in emails:
      send_mail(email, messages)

  if problems != '' and messages != '':
    for email in emails:
        send_mail(email, messages+"\n I encountered some problems: \n"+problems)
开发者ID:anzejarni,项目名称:py-domain-checker,代码行数:29,代码来源:domain-checker.py


示例15: whois

def whois(text):
    domain = text.strip().lower()

    whois = pythonwhois.get_whois(domain, normalized=True)

    info = []

    try:
        i = "\x02Registrar\x02: {}".format(whois["registrar"][0])
        info.append(i)
    except:
        pass

    try:
        i = "\x02Registered\x02: {}".format(whois["creation_date"][0].strftime("%d-%m-%Y"))
        info.append(i)
    except:
        pass

    try:
        i = "\x02Expires\x02: {}".format(whois["expiration_date"][0].strftime("%d-%m-%Y"))
        info.append(i)
    except:
        pass

    pprint(whois)

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


示例16: dns_data

def dns_data():
	for row in reader:
		host_addr = d[row][5]
		host_port = d[row][6]
		client_adr = d[row][7]
		client_port = d[row][8]
		proto = d[row][9]
		domain = pythonwhois.get_whois(client_adr)
开发者ID:sd08,项目名称:CSC16,代码行数:8,代码来源:data_capture.py


示例17: whois_domain

def whois_domain(name):
    try:
        query = whois.get_whois(name)
        if 'raw' in query:
            return query['raw'][0].split('<<<')[0].lstrip().rstrip()

    except socket.gaierror as e:
        logging.warning('Whois lookup failed for ' + name)
开发者ID:kernux,项目名称:instarecon,代码行数:8,代码来源:lookup.py


示例18: whois_domain

def whois_domain(name):
    try:
        query = whois.get_whois(name)
        if "raw" in query:
            return query["raw"][0].split("<<<")[0].lstrip().rstrip().encode("utf-8")

    except socket.gaierror as e:
        logging.warning("Whois lookup failed for " + name)
开发者ID:natrix-fork,项目名称:instarecon,代码行数:8,代码来源:lookup.py


示例19: _whois_domain

def _whois_domain(domain):
    result = {}
    try:
        pythonwhois.net.socket.setdefaulttimeout(10)
        result = pythonwhois.get_whois(domain)
    except Exception as e:
        logger.debug("domain whois error: " + domain.encode("utf-8") + " - " + str(e))
        result["error"] = str(e)
    return result
开发者ID:S03D4-164,项目名称:Contra,代码行数:9,代码来源:whois_domain.py


示例20: check

def check(name):
	try:
		data = pythonwhois.get_whois(name)
		if 'expiration_date' in data:
			logger.info('%-20s %s',name, make_red(u'\u00F8'))
		else:
			logger.info('%-20s %s',name, make_green(u'\u0298'))
	except Exception as e:
		logger.info('%-20s %s',name, make_red(u'\u00F8'))
		pass
开发者ID:Hech,项目名称:pchip,代码行数:10,代码来源:pchip.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python iwlibs.Wireless类代码示例发布时间:2022-05-27
下一篇:
Python pythonic_testcase.assert_equals函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap