[Python] 纯文本查看 复制代码
import random
from requests import post
class YMCHECK:
def __init__(self):
self.randCode = ''
self.url = 'https://www.ename.net/domain/domainAjax'
def getCom(self):
self.randCode = ''
codeList = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','6','3','5','7','8','9','0']
""" 这里循环次数就是域名的位数,默认4位 """
for i in range(4):
Num = random.randint(0, len(codeList)-1)
self.randCode += codeList[Num]
self.randCode +='.com' # 这里可以加规则,进行筛选,可以筛选后缀和其他规则。
header = {
'Origin':'https://www.ename.net',
'Referer':'https://www.ename.net/domain',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',
'X-Requested-With':'XMLHttpRequest'
}
datas = {
'choseType': '1',
'domain': self.randCode,
'key': '807a589630ea9ba867cd0f83594b0836',
'time':'1543559128'
}
res = post(self.url,headers = header,data=datas)
# 返回数据 ====>>> {"result":{"iwkk.com":{"code":1,"md5":"3b6abbf210e53e5cbfca1c1ed62673f5","domain":"iwkk.com"}},"code":100}
ress = res.json()
result = ress.get('result')
res_code = result.get(self.randCode)
if res_code.get('code')==0:
return self.randCode
if __name__ == '__main__':
p = YMCHECK()
for i in range(10):
a = p.getCom()
if a:
print(a)