python-demo/simple.py

45 lines
991 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@File : simple.py
@Author : lichao
@Date : 2024/11/25 16:39
@Software : PyCharm
"""
import requests
import string
def gen_combos():
chars = string.ascii_lowercase + string.digits
combos = []
for char1 in chars:
for char2 in chars:
for char3 in chars:
combos.append(char1 + char2 + char3)
return combos
def find(base_url, combos):
for combo in combos:
url = f"{base_url}{combo}.de"
print(combo, end="")
try:
response = requests.get(url)
if "is free and available for registration." in response.text:
print(".de 可注册")
else:
print()
except requests.RequestException as e:
print(e)
def main():
base_url = "https://webwhois.denic.de/?lang=en&query="
combos = gen_combos()
find(base_url, combos)
if __name__ == "__main__":
main()