This repository has been archived by the owner on Feb 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 136
/
exampleExtend.py
executable file
·120 lines (101 loc) · 2.96 KB
/
exampleExtend.py
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/python3
import whois
Verbose = True
"""
initial testing had errors for these
we DONT have xn--3ds443g 在线 (online)
we DONT have xn--45q11c 八卦 (gossip)
we DONT have xn--czru2d 商城 (mall)
we DONT have xn--fiq228c5hs 中文网 (website)
we DONT have xn--hxt814e 网店 (webshop)
"""
def t1(domain: str, text: str) -> None:
print(f"{text}: {domain}")
try:
d = whois.query(domain)
if d:
print(d.__dict__)
else:
print(d)
except Exception as e:
print(domain, e)
def xMain() -> None:
aDictToTestOverride = {
"si": { # changing a existing one
"domain_name": r"domain:\s+(.+)",
"status": r"status:\s+(.+)",
"registrar": r"registrar:\s+(.+)",
"name_servers": r"nameserver:\s*(.+)",
"creation_date": r"created:\s+(.+)",
"expiration_date": None,
"updated_date": None,
"registrant_country": None,
},
"mk": { # defining a non existant one, meanwhile this is now supported so the test is meaningless
"extend": "com",
"domain_name": r"domain:\s+(.+)",
"status": r"status:\s+(.+)",
"registrar": r"registrar:\s+(.+)",
"name_servers": r"nserver:\s*(.+)",
"creation_date": r"registered:\s+(.+)",
"expiration_date": r"expire:\s+(.+)",
"updated_date": r"changed:\s+(.+)",
"registrant_country": None,
"registrant": r"registrant:\s+(.+)",
},
}
domains = [
"google.si",
"google.mk",
]
for domain in domains:
t1(domain, "BEFORE")
whois.mergeExternalDictWithRegex(aDictToTestOverride)
for domain in domains:
t1(domain, "AFTER")
xMain()
"""
% Domain Information over Whois protocol
%
% Whoisd Server Version: 3.9.0
% Timestamp: Fri Nov 25 16:49:33 2022
domain: google.mk
registrant: UNET-R11
admin-c: UNET-C12
nsset: UNET-NS191
registrar: UNET-REG
registered: 13.05.2008 14:00:00
changed: 17.04.2014 12:50:32
expire: 13.05.2023
contact: UNET-R11
org: Google LLC
name: Google LLC
address: Amphiteatre Parkway 1600
address: Mountain View
address: 94043
address: US
phone: +1.6502530000
fax-no: +1.6502530000
e-mail: [email protected]
registrar: UNET-REG
created: 25.03.2014 11:48:02
changed: 29.09.2021 16:26:23
contact: UNET-C12
name: Mark Monitor Inc.
address: 3540 East Longwing Lane Suite 300
address: Meridian
address: 83646
address: US
phone: +1.2083895740
e-mail: [email protected]
registrar: UNET-REG
created: 25.03.2014 11:48:00
changed: 19.11.2019 16:47:01
nsset: UNET-NS191
nserver: ns2.google.com
nserver: ns1.google.com
tech-c: UNET-C12
registrar: UNET-REG
created: 17.04.2014 12:50:22
changed: 17.04.2014 21:02:14
"""