-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path4l.py
More file actions
61 lines (48 loc) · 1.5 KB
/
4l.py
File metadata and controls
61 lines (48 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import requests
import xmltodict
import time
import xml.etree.ElementTree as ET
import json
from itertools import permutations
from itertools import product
from itertools import combinations_with_replacement
from string import ascii_lowercase
import random
def check_domain(domain):
available = False
payload = {'key': ApiKey,
'command': 'search',
'domain0': domain,
'show_price': '1'
}
try:
response = requests.get(URL, payload)
print(response.text)
available = '<Available>yes</Available' in response.text
except requests.exceptions.RequestException as e:
print(e)
return available
def register_domain(domain):
answer = ""
payload = {'key': ApiKey,
'command': 'register',
'domain': domain,
'duration': '1'
}
try:
response = requests.get(URL, payload)
answer = response.text
except requests.exceptions.RequestException as e:
answer = "e"
return (answer)
# Production
URL = "https://api.dynadot.com/api3.xml"
ApiKey = "DYNADOT_API_KEY" # Change this to your dynadot API key
tld = "com" # TLD to search for
while True:
name = ''.join(random.choice(ascii_lowercase) for i in range(4))
domain = str(name) + "." + str(tld)
check = check_domain(domain)
if check:
print("Buying domain" + domain)
register_domain(domain)