|
| 1 | +#!/usr/bin/python3 |
| 2 | +import whois |
| 3 | + |
| 4 | +Verbose = True |
| 5 | + |
| 6 | +""" |
| 7 | +initial testing had errors for these |
| 8 | +we DONT have xn--3ds443g 在线 (online) |
| 9 | +we DONT have xn--45q11c 八卦 (gossip) |
| 10 | +we DONT have xn--czru2d 商城 (mall) |
| 11 | +we DONT have xn--fiq228c5hs 中文网 (website) |
| 12 | +we DONT have xn--hxt814e 网店 (webshop) |
| 13 | +""" |
| 14 | + |
| 15 | + |
| 16 | +def t1(domain: str, text: str): |
| 17 | + print(f"{text}: {domain}") |
| 18 | + try: |
| 19 | + d = whois.query(domain) |
| 20 | + if d: |
| 21 | + print(d.__dict__) |
| 22 | + else: |
| 23 | + print(d) |
| 24 | + except Exception as e: |
| 25 | + print(domain, e) |
| 26 | + |
| 27 | + |
| 28 | +def xMain(): |
| 29 | + aDictToTestOverride = { |
| 30 | + "si": { # changing a existing one |
| 31 | + "domain_name": r"domain:\s+(.+)", |
| 32 | + "status": r"status:\s+(.+)", |
| 33 | + "registrar": r"registrar:\s+(.+)", |
| 34 | + "name_servers": r"nameserver:\s*(.+)", |
| 35 | + "creation_date": r"created:\s+(.+)", |
| 36 | + "expiration_date": None, |
| 37 | + "updated_date": None, |
| 38 | + "registrant_country": None, |
| 39 | + }, |
| 40 | + "mk": { # defining a non existant one, meanwhile this is now supported so the test is meaningless |
| 41 | + "extend": "com", |
| 42 | + "domain_name": r"domain:\s+(.+)", |
| 43 | + "status": r"status:\s+(.+)", |
| 44 | + "registrar": r"registrar:\s+(.+)", |
| 45 | + "name_servers": r"nserver:\s*(.+)", |
| 46 | + "creation_date": r"registered:\s+(.+)", |
| 47 | + "expiration_date": r"expire:\s+(.+)", |
| 48 | + "updated_date": r"changed:\s+(.+)", |
| 49 | + "registrant_country": None, |
| 50 | + "registrant": r"registrant:\s+(.+)", |
| 51 | + }, |
| 52 | + } |
| 53 | + |
| 54 | + domains = [ |
| 55 | + "google.si", |
| 56 | + "google.mk", |
| 57 | + ] |
| 58 | + for domain in domains: |
| 59 | + t1(domain, "BEFORE") |
| 60 | + |
| 61 | + whois.mergeExternalDictWithRegex(aDictToTestOverride) |
| 62 | + |
| 63 | + for domain in domains: |
| 64 | + t1(domain, "AFTER") |
| 65 | + |
| 66 | + |
| 67 | +xMain() |
| 68 | + |
| 69 | +""" |
| 70 | +
|
| 71 | +% Domain Information over Whois protocol |
| 72 | +% |
| 73 | +% Whoisd Server Version: 3.9.0 |
| 74 | +% Timestamp: Fri Nov 25 16:49:33 2022 |
| 75 | +
|
| 76 | +domain: google.mk |
| 77 | +registrant: UNET-R11 |
| 78 | +admin-c: UNET-C12 |
| 79 | +nsset: UNET-NS191 |
| 80 | +registrar: UNET-REG |
| 81 | +registered: 13.05.2008 14:00:00 |
| 82 | +changed: 17.04.2014 12:50:32 |
| 83 | +expire: 13.05.2023 |
| 84 | +
|
| 85 | +contact: UNET-R11 |
| 86 | +org: Google LLC |
| 87 | +name: Google LLC |
| 88 | +address: Amphiteatre Parkway 1600 |
| 89 | +address: Mountain View |
| 90 | +address: 94043 |
| 91 | +address: US |
| 92 | +phone: +1.6502530000 |
| 93 | +fax-no: +1.6502530000 |
| 94 | + |
| 95 | +registrar: UNET-REG |
| 96 | +created: 25.03.2014 11:48:02 |
| 97 | +changed: 29.09.2021 16:26:23 |
| 98 | +
|
| 99 | +contact: UNET-C12 |
| 100 | +name: Mark Monitor Inc. |
| 101 | +address: 3540 East Longwing Lane Suite 300 |
| 102 | +address: Meridian |
| 103 | +address: 83646 |
| 104 | +address: US |
| 105 | +phone: +1.2083895740 |
| 106 | + |
| 107 | +registrar: UNET-REG |
| 108 | +created: 25.03.2014 11:48:00 |
| 109 | +changed: 19.11.2019 16:47:01 |
| 110 | +
|
| 111 | +nsset: UNET-NS191 |
| 112 | +nserver: ns2.google.com |
| 113 | +nserver: ns1.google.com |
| 114 | +tech-c: UNET-C12 |
| 115 | +registrar: UNET-REG |
| 116 | +created: 17.04.2014 12:50:22 |
| 117 | +changed: 17.04.2014 21:02:14 |
| 118 | +
|
| 119 | +
|
| 120 | +""" |
0 commit comments