Python 工具whois查询

whois 网站查询

站长之家: http://whois.chinaz.com/

全球WHOIS查询:https://www.whois365.com/cn/

爱站:http://www.aizhan.com/

阿里云:https://whois.aliyun.com/whois/domain/

查询whois信息 python 脚本

#首先我们要导入requests模块和bs4模块里的BeautifulSoup和time模块
import requests
import time
from bs4 import BeautifulSoup

#设置好开始时间点
strat=time.time()

class G:
    rb1=None
    rb2=None
    rb3=None
def chax():
    #询问用户要查询的域名
    lid=input('请输入你要查询的域名:')
    #设置浏览器头过反爬
    head={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
    #设置好url
    url="http://site.ip138.com/{}/".format(lid)
    urldomain="http://site.ip138.com/{}/domain.htm".format(lid)
    url2="http://site.ip138.com/{}/beian.htm".format(lid)
    url3="http://site.ip138.com/{}/whois.htm".format(lid)
    #打开网页
    rb=requests.get(url,headers=head)
    G.rb1=requests.get(urldomain,headers=head)
    G.rb2=requests.get(url2,headers=head)
    G.rb3=requests.get(url3,headers=head)
    #获取内容并用html的方式返回
    gf=BeautifulSoup(rb.content,'html.parser')
    print('[+]IP解析记录')
    #读取内容里的p标签
    for x in gf.find_all('p'):
      #使用text的内容返回
      link=x.get_text()
      print(link)

chax()


gf1=BeautifulSoup(G.rb1.content,'html.parser')
print('[+]子域名查询')
for v in gf1.find_all('p'):
  link2=v.get_text()
  print(link2)
gf2=BeautifulSoup(G.rb2.content,'html.parser')
print('[+]备案查询')
for s  in gf2.find_all('p'):
  link3=s.get_text()
  print(link3)
gf3=BeautifulSoup(G.rb3.content,'html.parser')
print('[+]whois查询')
for k in gf3.find_all('p'):
  link4=k.get_text()
  print(link4)
end=time.time()
print('查询耗时:',end-strat)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 一、查企业查信用 1、信用中国 查询内容:工商注册企业和个人、行政许可和处罚 网址:http://www.cred...
    钦玄阅读 14,258评论 1 12
  • @@@时间 2013-12-24 14:50:00** 博客园-原创精华区 原文 http://www.cn...
    苏文星阅读 5,283评论 0 7
  • 1学习生涯 , 在平台期保持进步, 最早学习设计的生涯中,是跟在师傅的后面学,每天帮师傅打杂一些下手,耳...
    大雄___阅读 2,350评论 1 5
  • 本系列文章力求用最简洁的语言整理出操作系统的知识框架,帮助求职的同学对操作系统的知识做一个梳理。 1. 操作系统的...
    saviochen阅读 4,386评论 1 7
  • 【0224我在悦读】萧萧 第9次打卡 书名:《活法》 作者:稻盛和夫 篇目:第三章 金句:磨砺心志的六项精进 00...
    萧萧姐阅读 1,616评论 0 0

友情链接更多精彩内容