批量查询域名是否被注册,用来注册自己心仪的域名。Python脚本如下:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/10/21 3:46 PM
# @Author : w8ay
# @File : domain.py.py
import requests
from bs4 import BeautifulSoup
import time
from itertools import combinations, permutations
# 查询是否注册
def check(domain):
url = "http://panda.www.net.cn/cgi-bin/check.cgi?area_domain=%s" % domain
html = requests.get(url)
bsj = BeautifulSoup(html.text, "lxml")
onum = bsj.find("original")
if onum != None:
num = onum.get_text()[:3]
if num == '210':
print("%s可以注册" % domain)
elif num == "213":
print("查询超时,请重新查询")
elif num == "211":
print("[x] %s" % domain)
elif num == "212":
print(f"{domain} 无效域名")
else:
print(html.text)
print("出现未知问题")
return num
else:
print("让我哭一会,ip可能被封了")
return None
def search(name, suffix):
domain = name + '.' + suffix
num = check(domain)
if num != None:
if num == '210':
return domain
return False
if __name__ == '__main__':
namepart = ['micro', 'hacking', 'scan']
qians = ['micro', 'hack', 'sec', 'vul', 'vuln', 'pwn', 'bug', 'i', 'poc','src','exp']
hous = ['scan', 'scanner', 'sec', 'hub','con','hunter','sploit','exp']
suffixes = ['com']
domains = []
for suffix in suffixes:
# names = permutations(namepart, 2)
names = []
for qian in qians:
for hou in hous:
names.append(qian + hou)
for name in names:
domains.append((name, suffix))
for domain in domains:
oklist = search(domain[0], domain[1])
time.sleep(0.1)
本文共 65 个字数,平均阅读时长 ≈ 1分钟
评论 (0)