w w w . w d . c h a t
🗣 Wd提问
批量域名查询工具
🤖 Ai回答
以下是一个基于Python的批量域名查询工具示例代码,使用`whois`库获取域名注册信息:

python
import whois
import csv
import time
from datetime import datetime

def query_domain_info(domain):
try:
w = whois.whois(domain)
return {
'domain_name': w.domain_name,
'registrar': w.registrar,
'creation_date': w.creation_date,
'expiration_date': w.expiration_date,
'updated_date': w.updated_date,
'name_servers': w.name_servers,
'status': w.status,
'emails': w.emails,
'registrant_organization': w.org if hasattr(w, 'org') else 'N/A'
}
except Exception as e:
return {'error': f'查询失败: {str(e)}'}

def batch_query_domains(domain_list, output_file='domain_results.csv'):
results = []

with open(domain_list, 'r') as f:
domains = [line.strip() for line in f if line.strip()]

for domain in domains:
print(f正在查询: {domain})
result = query_domain_info(domain)
result['domain'] = domain
results.append(result)
time.sleep(1) 避免查询频率过高

保存为CSV文件
with open(output_file, 'w', newline='', encoding='utf8') as f:
fieldnames = ['domain', 'domain_name', 'registrar', 'creation_date',
'expiration_date', 'updated_date', 'name_servers', 'status',
'emails', 'registrant_organization', 'error']

writer = csv.DictWriter(f, fieldnames=fieldnames)
writer.writeheader()
for row in results:
writer.writerow(row)

print(f查询完成,结果已保存至 {output_file})

if __name__ == __main__:
domain_list_file = 'domains_to_check.txt' 包含域名列表的文本文件
batch_query_domains(domain_list_file)

使用说明:

1、安装依赖:
bash
pip install pythonwhois

2、准备域名列表文件(domains_to_check.txt):

example.com
google.com
github.com
yourdomain.com

3、运行脚本:
bash
python domain_checker.py

功能特点:
支持批量域名查询
自动保存为CSV格式
包含域名状态、注册商、过期时间等信息
自动添加查询间隔避免IP封锁

输出示例(CSV文件内容):

domain,domain_name,registrar,creation_date,expiration_date,updated_date,name_servers,status,emails,registrant_organization,error
example.com,EXAMPLE.COM,MarkMonitor Inc.,20230515 10:30:00,20240515 10:30:00,20230516 08:20:00,['NS1234.BIZ.NS', 'NS4567.CO.NS'],'clientDeleteProhibited https://icann.org/eppclientDeleteProhibited',admin@example.com,Example Organization,Inc.,

注意事项:
1、部分域名可能返回不完整信息(.cn等特殊域名)
2、请遵守各域名注册商的查询限制
3、可修改`time.sleep(1)`调整查询间隔
4、建议使用代理IP进行大规模查询
5、需要处理可能的反爬机制

扩展建议:
添加代理支持
集成WHOIS查询API(如WhoisXML API)
添加域名年龄计算功能
可视化界面(使用Tkinter或Web框架)
增加域名可用性判断功能
支持多线程查询加速

如果需要更专业的解决方案,可以考虑使用商业API服务:
1、WhoisIC (https://www.whois.ic)
2、DomainTools (https://www.domaintools.com)
3、Aliyun Domain WHOIS (https://whois.aliyun.com)
4、AWS Route 53 Domain Registration
0
📍
IP地址 112.170.7.35
🔍
搜索次数 4
提问时间 2025-01-13 20:16:58

📣 商家广告

广东过滤器

广东过滤器

万能查询网站

万能查询网站

域名评估

域名评估

🛒 域名购买

热门提问

🌐 域名评估

最新挖掘

🖌 热门作画

🤝 关于我们

🗨 加入群聊
💬选择任意群聊,与同好交流分享

🔗 友情链接

🧰

站长工具

📢

温馨提示

本站所有 ❓️ 问答 由Ai自动创作,内容仅供参考,若有误差请用"联系"里面信息通知我们人工修改或删除。

👉

技术支持

本站由 🟢 豌豆Ai 提供技术支持,使用的最新版: 《豌豆Ai站群搜索引擎系统 V.25.10.25》 搭建本站。

上一篇 339395 339396 339397 下一篇