Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #250 from maarten-boot/master
Browse files Browse the repository at this point in the history
fix nameservers it
  • Loading branch information
DannyCork authored Jan 4, 2023
2 parents e385859 + b8013e3 commit dd47a23
Show file tree
Hide file tree
Showing 24 changed files with 84 additions and 21 deletions.
2 changes: 2 additions & 0 deletions testdata/example.com/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
example.com name server a.iana-servers.net.
example.com name server b.iana-servers.net.
2 changes: 2 additions & 0 deletions testdata/example.net/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
example.net name server b.iana-servers.net.
example.net name server a.iana-servers.net.
2 changes: 1 addition & 1 deletion testdata/example.org/input
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Name Server: a.iana-servers.net
Name Server: b.iana-servers.net
DNSSEC: signedDelegation
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of WHOIS database: 2022-11-17T10:47:37Z <<<
>>> Last update of WHOIS database: 2023-01-04T15:03:07Z <<<

For more information on Whois status codes, please visit https://icann.org/epp

Expand Down
2 changes: 2 additions & 0 deletions testdata/example.org/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
example.org name server b.iana-servers.net.
example.org name server a.iana-servers.net.
6 changes: 3 additions & 3 deletions testdata/google.com/input
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Tech Organization: Google LLC
Tech State/Province: CA
Tech Country: US
Tech Email: Select Request Email Form at https://domains.markmonitor.com/whois/google.com
Name Server: ns4.google.com
Name Server: ns3.google.com
Name Server: ns1.google.com
Name Server: ns2.google.com
Name Server: ns3.google.com
Name Server: ns4.google.com
DNSSEC: unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>> Last update of WHOIS database: 2022-11-17T22:52:22+0000 <<<
>>> Last update of WHOIS database: 2023-01-04T14:55:04+0000 <<<

For more information on WHOIS status codes, please visit:
https://www.icann.org/resources/pages/epp-status-codes
Expand Down
4 changes: 4 additions & 0 deletions testdata/google.com/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
google.com name server ns2.google.com.
google.com name server ns4.google.com.
google.com name server ns3.google.com.
google.com name server ns1.google.com.
2 changes: 1 addition & 1 deletion testdata/google.com/output
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ statuses list ['clientDeleteProhibited (https://www.icann
dnssec bool False
name_servers list ['ns1.google.com', 'ns2.google.com', 'ns3.google.com', 'ns4.google.com']
registrant str 'Google LLC'
emails list ['[email protected]']
emails list ['[email protected]', '[email protected]']
28 changes: 27 additions & 1 deletion testdata/make_testdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ getDomains()
)
}

verifyNameservers()
{
local str="$1"

grep name_servers "./$str/output" | awk '{ $1 = $2 = ""; print }' | awk -F, '{print NF}'
grep "name server" "./$str/nameservers" | wc -l

}
makeDataForDomain()
{
local str="$1"
Expand All @@ -32,6 +40,12 @@ makeDataForDomain()
# dump the expected output as output
../test2.py -d "$str" |
tee "./$str/output"

# dump the nameservers via host
host -t ns "$str" |
tee "./$str/nameservers"

# verifyNameservers "$str"
}

makeDataIfNotExist()
Expand All @@ -43,10 +57,22 @@ makeDataIfNotExist()
done
}

makeDataIfExist()
{
for str in ${DOMAINS[@]}
do
makeDataForDomain "$str"
done
}

main()
{
local force="$1"
getDomains
makeDataIfNotExist
[ "$force" == "force" ] && {
makeDataIfExist
}
}

main
main $*
3 changes: 3 additions & 0 deletions testdata/meta.co.jp/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
meta.co.jp name server ns2.meta.co.jp.
meta.co.jp name server ns2.sphere.ad.jp.
meta.co.jp name server ns.meta.co.jp.
4 changes: 2 additions & 2 deletions testdata/meta.co.uk/input
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
c.ns.facebook.com
d.ns.facebook.com

WHOIS lookup made at 10:47:38 17-Nov-2022
WHOIS lookup made at 15:03:07 04-Jan-2023

--
This WHOIS information is provided for free by Nominet UK the central registry
for .uk domain names. This information and the .uk WHOIS are:

Copyright Nominet UK 1996 - 2022.
Copyright Nominet UK 1996 - 2023.

You may not access the .uk WHOIS or use any data from it except as permitted
by the terms of use available in full at https://www.nominet.uk/whoisterms,
Expand Down
4 changes: 4 additions & 0 deletions testdata/meta.co.uk/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
meta.co.uk name server d.ns.facebook.com.
meta.co.uk name server a.ns.facebook.com.
meta.co.uk name server c.ns.facebook.com.
meta.co.uk name server b.ns.facebook.com.
4 changes: 2 additions & 2 deletions testdata/meta.com.sg/input
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Registrar: SINGNET PTE LTD

Domain Name: META.COM.SG
Creation Date: 03-Dec-1998 17:04:50
Modified Date: 03-Dec-2021 00:05:14
Expiration Date: 03-Dec-2022 00:00:00
Modified Date: 03-Dec-2022 00:00:18
Expiration Date: 03-Dec-2023 00:00:00
Domain Status: OK
Domain Status: VerifiedID@SG-Not Required

Expand Down
3 changes: 3 additions & 0 deletions testdata/meta.com.sg/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
meta.com.sg name server ns2.vodien.com.
meta.com.sg name server ns3.vodien.com.
meta.com.sg name server ns1.vodien.com.
4 changes: 2 additions & 2 deletions testdata/meta.com.sg/output
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ tld str 'com_sg'
registrar str 'SINGNET PTE LTD'
registrant_country str ''
creation_date datetime.datetime 1998-12-03 17:04:50
expiration_date datetime.datetime 2022-12-03 00:00:00
last_updated datetime.datetime 2021-12-03 00:05:14
expiration_date datetime.datetime 2023-12-03 00:00:00
last_updated datetime.datetime 2022-12-03 00:00:18
status str 'OK'
statuses list ['OK', 'VerifiedID@SG-Not Required']
dnssec bool False
Expand Down
2 changes: 1 addition & 1 deletion testdata/meta.com.tr/input
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ Expires on..............: 2026-Dec-27.


** Whois Server:
Last Update Time: 2022-11-17T14:01:59+03:00
Last Update Time: 2023-01-04T18:01:59+03:00
2 changes: 2 additions & 0 deletions testdata/meta.com.tr/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
meta.com.tr name server ns2.efektyazilim.com.
meta.com.tr name server ns1.efektyazilim.com.
2 changes: 1 addition & 1 deletion testdata/meta.com/input
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Name Server: A.NS.FACEBOOK.COM
Name Server: D.NS.FACEBOOK.COM
DNSSEC: unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>> Last update of WHOIS database: 2022-11-17T10:47:10Z <<<
>>> Last update of WHOIS database: 2023-01-04T15:03:11Z <<<

Search results obtained from the RegistrarSafe, LLC WHOIS database are
provided by RegistrarSafe, LLC for information purposes only, to assist
Expand Down
4 changes: 4 additions & 0 deletions testdata/meta.com/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
meta.com name server a.ns.facebook.com.
meta.com name server d.ns.facebook.com.
meta.com name server c.ns.facebook.com.
meta.com name server b.ns.facebook.com.
1 change: 1 addition & 0 deletions testdata/meta.jp/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
meta.jp name server ns.meta.jp.
4 changes: 4 additions & 0 deletions testdata/meta.kr/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
meta.kr name server ns4.lovellsnames.org.
meta.kr name server ns3.lovellsnames.org.
meta.kr name server ns2.lovellsnames.org.
meta.kr name server ns1.lovellsnames.org.
2 changes: 2 additions & 0 deletions testdata/xs4all.nl/nameservers
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
xs4all.nl name server ns11.kpn.net.
xs4all.nl name server ns1.kpn.net.
4 changes: 2 additions & 2 deletions testdata/xs4all.nl/output
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
test domain: <<<<<<<<<< xs4all.nl >>>>>>>>>>>>>>>>>>>>
name str 'xs4all.nl'
tld str 'nl'
registrar str ''
registrar str 'KPN'
registrant_country str ''
creation_date datetime.datetime 1994-08-07 00:00:00
expiration_date NoneType None
Expand All @@ -11,7 +11,7 @@ status str 'active'
statuses list ['active']
dnssec bool True
name_servers list ['ns1.kpn.net', 'ns11.kpn.net']
abuse_contact str ''
abuse_contact str '[email protected]'
reseller str ''
registrant str ''
emails list ['[email protected]']
2 changes: 2 additions & 0 deletions whois/_2_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def handleShortResponse(
"the queried object does not exist",
"domain you requested is not known",
"status: available",
"no whois server is known for this kind of object",
"nameserver not found",
]

for i in noneStrings:
Expand Down
12 changes: 7 additions & 5 deletions whois/tld_regexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@

app = {
"extend": "com",
"_server": "whois.nic.google",
}

# Argentina
Expand Down Expand Up @@ -543,7 +544,8 @@
"creation_date": r"Created:\s?(.+)",
"expiration_date": r"Expire Date:\s?(.+)",
"updated_date": r"Last Update:\s?(.+)",
"name_servers": r"Nameservers\s?(.+)\s?(.+)\s?(.+)\s?(.+)",
# "name_servers": r"Nameservers\s?(.+)\s?(.+)\s?(.+)\s?(.+)",
"name_servers": r"Nameservers(?:\n\s+(\S+))?(?:\n\s+(\S+))?(?:\n\s+(\S+))?(?:\n\s+(\S+))?",
"status": r"Status:\s?(.+)",
}

Expand Down Expand Up @@ -1153,10 +1155,10 @@
"extend": "com",
}

web_za = { "extend": "za", "_server": "web-whois.registry.net.za" }
org_za = { "extend": "za", "_server": "org-whois.registry.net.za" }
net_za = { "extend": "za", "_server": "net-whois.registry.net.za" }
co_za = { "extend": "za" , "_server": "coza-whois.registry.net.za"}
web_za = {"extend": "za", "_server": "web-whois.registry.net.za"}
org_za = {"extend": "za", "_server": "org-whois.registry.net.za"}
net_za = {"extend": "za", "_server": "net-whois.registry.net.za"}
co_za = {"extend": "za", "_server": "coza-whois.registry.net.za"}

gy = {
"extend": "com",
Expand Down

0 comments on commit dd47a23

Please sign in to comment.