Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue that could cause some contact points to be missing from ASN lookup #50

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


## Unreleased
### Fixed
- issue introduced in 1.5.1 that could cause some contact points to be lost


## 1.5.1
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Unreleased:
added: []
fixed: []
fixed:
- issue introduced in 1.5.1 that could cause some contact points to be lost
changed: []
deprecated: []
removed: []
Expand Down
12 changes: 8 additions & 4 deletions rdap/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def _parse(self):
emails = set()
org_name = ""
org_address = ""
org_name_final = False
org_address_final = False

for ent in self._data.get("entities", []):
vcard = self._parse_vcard(ent)
Expand All @@ -113,10 +115,14 @@ def _parse(self):
handle_url = self._rdapc.get_entity_url(handle)

if "registrant" in roles:
if "fn" in vcard:
if "fn" in vcard and not org_name_final:
org_name = vcard["fn"]
if "adr" in vcard:
if "org" in kind:
org_name_final = True
if "adr" in vcard and not org_address_final:
org_address = vcard["adr"]
if "org" in kind:
org_address_final = True

# check nested entities
for nent in ent.get("entities", []):
Expand All @@ -135,8 +141,6 @@ def _parse(self):
except RdapHTTPError:
if not self._rdapc.config.get("ignore_recurse_errors"):
raise
if "org" in kind:
break

# WORKAROUND APNIC keeps org info in remarks
if "apnic" in self._data.get("port43", ""):
Expand Down
1 change: 1 addition & 0 deletions tests/data/rdap/autnum/205697.expected
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ALOJALIA",
"emails": [
"abuse@alojalia.com",
"alejandro@alojalia.com",
"angel@alojalia.com"
],
Expand Down
1 change: 1 addition & 0 deletions tests/data/rdap/autnum/205726.expected
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Vusam",
"emails": [
"abuse@vusam.com",
"daan.vangorkum@vusam.com",
"support@vusam.com"
],
Expand Down
1 change: 1 addition & 0 deletions tests/data/rdap/autnum/206050.expected
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "elitnet-tr",
"emails": [
"abuse@geoipa.com",
"mehmet@elitnet.net.tr"
],
"org_name": "ELITNET TELEKOMUNIKASYON INTERNET VE ILETISIM HIZ.TIC LTD.STI.",
Expand Down
1 change: 1 addition & 0 deletions tests/data/rdap/autnum/2914.expected
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"abuse@ntt.net",
"ipr@gin.ntt.net",
"massimo@ntt.net",
"peering@ntt.net",
"support@us.ntt.net"
],
"org_name": "NTT America, Inc.",
Expand Down
3 changes: 2 additions & 1 deletion tests/data/rdap/autnum/37271.expected
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"emails": [
"abuse@workonline.africa",
"communications@workonline.africa",
"noc@workonline.africa"
"noc@workonline.africa",
"peterp@workonline.africa"
],
"org_name": "Workonline Communications(Pty) Ltd",
"org_address": "114 West St\nJohannesburg 2196"
Expand Down
4 changes: 3 additions & 1 deletion tests/data/rdap/autnum/49037.expected
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "PG19",
"emails": [
"mikhail.majorov@gmail.com"
"abuse@webrocket.am",
"mikhail.majorov@gmail.com",
"ripe@webrocket.am"
],
"org_name": "PROSTIE RESHENIA LLC, ****************** Routing Policy *******************",
"org_address": "ST. MOVSESA HORENACI, 14/20\n1109\nVAGARSHAPAT\nARMENIA"
Expand Down
8 changes: 7 additions & 1 deletion tests/data/rdap/autnum/8283.expected
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
"name": "COLOCLUE-AS",
"emails": [
"abuse@coloclue.net",
"contact@cybertinus.nl",
"hostmaster@bytepark.net",
"hostmaster@luje.net",
"menno@someones.net",
"ops@coloclue.net",
"routers@coloclue.net"
"ripe@jurrian.vaniersel.net",
"routers@coloclue.net",
"weerd@weirdnet.nl"
],
"org_name": "Netwerkvereniging Coloclue, Netwerkvereniging Coloclue, Amsterdam, Netherlands",
"org_address": "Frans Duwaerstraat 34\n1318 AC\nAlmere\nNETHERLANDS"
Expand Down
1 change: 1 addition & 0 deletions tests/data/rdap/autnum/9269.expected
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "HKBN-AS-AP",
"emails": [
"abuse@hkbn.com.hk",
"abuse@hkbn.net",
"hostmaster@hkbn.com.hk",
"nocsn@hkbn.com.hk"
Expand Down
1 change: 1 addition & 0 deletions tests/data/rdap/entity/BRI2.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
67 changes: 67 additions & 0 deletions tests/data/rdap/entity/SD12478-RIPE.input
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"handle" : "SD12478-RIPE",
"vcardArray" : [ "vcard", [ [ "version", { }, "text", "4.0" ], [ "fn", { }, "text", "Yavuz Selim MALKOC" ], [ "kind", { }, "text", "individual" ], [ "adr", {
"label" : "Sultan Orhan Mah. Ilyasbey Cad, 1812 Sk.\n41400\nKocaeli\nTURKEY"
}, "text", [ "", "", "", "", "", "", "" ] ], [ "tel", {
"type" : "voice"
}, "text", "+902626446663" ] ] ],
"entities" : [ {
"handle" : "mnt-tr-internetten-1",
"vcardArray" : [ "vcard", [ [ "version", { }, "text", "4.0" ], [ "fn", { }, "text", "mnt-tr-internetten-1" ], [ "kind", { }, "text", "individual" ] ] ],
"roles" : [ "registrant" ],
"links" : [ {
"value" : "https://rdap.db.ripe.net/entity/SD12478-RIPE",
"rel" : "self",
"href" : "https://rdap.db.ripe.net/entity/mnt-tr-internetten-1"
}, {
"value" : "http://www.ripe.net/data-tools/support/documentation/terms",
"rel" : "copyright",
"href" : "http://www.ripe.net/data-tools/support/documentation/terms"
} ],
"objectClassName" : "entity"
} ],
"links" : [ {
"value" : "https://rdap.db.ripe.net/entity/SD12478-RIPE",
"rel" : "self",
"href" : "https://rdap.db.ripe.net/entity/SD12478-RIPE"
}, {
"value" : "http://www.ripe.net/data-tools/support/documentation/terms",
"rel" : "copyright",
"href" : "http://www.ripe.net/data-tools/support/documentation/terms"
} ],
"events" : [ {
"eventAction" : "registration",
"eventDate" : "2019-09-27T12:14:59Z"
}, {
"eventAction" : "last changed",
"eventDate" : "2019-09-30T13:41:16Z"
} ],
"rdapConformance" : [ "cidr0", "rdap_level_0", "nro_rdap_profile_0", "redacted" ],
"notices" : [ {
"title" : "Filtered",
"description" : [ "This output has been filtered." ]
}, {
"title" : "Whois Inaccuracy Reporting",
"description" : [ "If you see inaccuracies in the results, please visit:" ],
"links" : [ {
"value" : "https://rdap.db.ripe.net/entity/SD12478-RIPE",
"rel" : "inaccuracy-report",
"href" : "https://www.ripe.net/contact-form?topic=ripe_dbm&show_form=true",
"type" : "text/html"
} ]
}, {
"title" : "Source",
"description" : [ "Objects returned came from source", "RIPE" ]
}, {
"title" : "Terms and Conditions",
"description" : [ "This is the RIPE Database query service. The objects are in RDAP format." ],
"links" : [ {
"value" : "https://rdap.db.ripe.net/entity/SD12478-RIPE",
"rel" : "terms-of-service",
"href" : "http://www.ripe.net/db/support/db-terms-conditions.pdf",
"type" : "application/pdf"
} ]
} ],
"port43" : "whois.ripe.net",
"objectClassName" : "entity"
}
77 changes: 77 additions & 0 deletions tests/data/rdap/entity/WA2477-RIPE.input
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"handle" : "WA2477-RIPE",
"vcardArray" : [ "vcard", [ [ "version", { }, "text", "4.0" ], [ "fn", { }, "text", "WEBROCKET SUPPORT TEAM" ], [ "kind", { }, "text", "group" ], [ "adr", {
"label" : "st. Movsesa Horenaci 14/20, Vagharshapat, Armavir, Armenia, 1101"
}, "text", [ "", "", "", "", "", "", "" ] ], [ "email", {
"type" : "abuse"
}, "text", "abuse@webrocket.am" ] ] ],
"entities" : [ {
"handle" : "WEBROCKET-MNT",
"vcardArray" : [ "vcard", [ [ "version", { }, "text", "4.0" ], [ "fn", { }, "text", "WEBROCKET-MNT" ], [ "kind", { }, "text", "individual" ] ] ],
"roles" : [ "registrant" ],
"links" : [ {
"value" : "https://rdap.db.ripe.net/entity/WA2477-RIPE",
"rel" : "self",
"href" : "https://rdap.db.ripe.net/entity/WEBROCKET-MNT"
}, {
"value" : "http://www.ripe.net/data-tools/support/documentation/terms",
"rel" : "copyright",
"href" : "http://www.ripe.net/data-tools/support/documentation/terms"
} ],
"objectClassName" : "entity"
} ],
"links" : [ {
"value" : "https://rdap.db.ripe.net/entity/WA2477-RIPE",
"rel" : "self",
"href" : "https://rdap.db.ripe.net/entity/WA2477-RIPE"
}, {
"value" : "http://www.ripe.net/data-tools/support/documentation/terms",
"rel" : "copyright",
"href" : "http://www.ripe.net/data-tools/support/documentation/terms"
} ],
"events" : [ {
"eventAction" : "registration",
"eventDate" : "2023-07-01T14:23:57Z"
}, {
"eventAction" : "last changed",
"eventDate" : "2023-07-01T14:33:34Z"
} ],
"rdapConformance" : [ "cidr0", "rdap_level_0", "nro_rdap_profile_0", "redacted" ],
"notices" : [ {
"title" : "Filtered",
"description" : [ "This output has been filtered." ]
}, {
"title" : "Whois Inaccuracy Reporting",
"description" : [ "If you see inaccuracies in the results, please visit:" ],
"links" : [ {
"value" : "https://rdap.db.ripe.net/entity/WA2477-RIPE",
"rel" : "inaccuracy-report",
"href" : "https://www.ripe.net/contact-form?topic=ripe_dbm&show_form=true",
"type" : "text/html"
} ]
}, {
"title" : "Source",
"description" : [ "Objects returned came from source", "RIPE" ]
}, {
"title" : "Terms and Conditions",
"description" : [ "This is the RIPE Database query service. The objects are in RDAP format." ],
"links" : [ {
"value" : "https://rdap.db.ripe.net/entity/WA2477-RIPE",
"rel" : "terms-of-service",
"href" : "http://www.ripe.net/db/support/db-terms-conditions.pdf",
"type" : "application/pdf"
} ]
} ],
"port43" : "whois.ripe.net",
"objectClassName" : "entity",
"redacted" : [ {
"name" : {
"description" : "Personal e-mail information"
},
"reason" : {
"description" : "Personal data"
},
"prePath" : "$.vcardArray[1][?(@[0]=='e-mail')]",
"method" : "removal"
} ]
}
1 change: 1 addition & 0 deletions tests/data/rdap/rdap/entity/PP17-AFRINIC.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rdapConformance":["rdap_level_0","nro_rdap_profile_0"],"notices":[{"title":"ABOUT","description":["This is the AfriNIC RDAP server."],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC","rel":"describedby","href":"https://www.afrinic.net/support/whois-db/reference-manual","hreflang":["en"],"type":"text/html","title":"AFRINIC Database Reference Manual","media":"screen"}]},{"title":"Terms and Conditions","description":["This is the AFRINIC Database query service. The objects are in RDAP format."],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC","rel":"terms-of-service","href":"https://afrinic.net/whois/terms","type":"text/html"}]},{"title":"Whois Inaccuracy Reporting","description":["If you see inaccuracies in the results, please visit: "],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC","rel":"inaccuracy-report","href":"https://www.afrinic.net/support/whois-db/reference-manual","type":"text/html","title":"AFRINIC WHOIS Inaccuracy Report"}]},{"title":"jCard sunset end","description":["2023-12-31T23:59:59Z"],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC","rel":"related","href":"https://www.ietf.org/id/draft-ietf-regext-rdap-jscontact-12.html","type":"text/html","title":"jCard deprecation and replacement with JSContact Card"},{"value":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC","rel":"alternate","href":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC?jscard=1","type":"application/rdap+json","title":"JSContact Card version"}]},{"title":"jCard deprecation end","description":["2022-12-31T23:59:59Z"],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC","rel":"related","href":"https://www.ietf.org/id/draft-ietf-regext-rdap-jscontact-12.html","type":"text/html","title":"jCard deprecation and replacement with JSContact Card"},{"value":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC","rel":"alternate","href":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC?jscard=1","type":"application/rdap+json","title":"JSContact Card version"}]}],"lang":"en","links":[{"value":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC","rel":"self","href":"https://rdap.afrinic.net/rdap/entity/PP17-AFRINIC"}],"handle":"PP17-AFRINIC","status":["active"],"port43":"whois.afrinic.net","vcardArray":["vcard",[["version",{},"text","4.0"],["kind",{},"text","individual"],["fn",{},"text","Peter Peele"],["tel",{"type":"work"},"text","tel:+27-82-064-3322"],["email",{},"text","peterp@workonline.africa"],["adr",{"label":"114 West Street\nSandton\nSouth Africa\nPostal Code 2066"},"text",["114 West Street","Sandton","South Africa","Postal Code 2066","","",""]]]],"objectClassName":"entity"}
1 change: 1 addition & 0 deletions tests/data/rdap/rdap/entity/WOL-AFRINIC.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rdapConformance":["rdap_level_0","nro_rdap_profile_0"],"notices":[{"title":"ABOUT","description":["This is the AfriNIC RDAP server."],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC","rel":"describedby","href":"https://www.afrinic.net/support/whois-db/reference-manual","hreflang":["en"],"type":"text/html","title":"AFRINIC Database Reference Manual","media":"screen"}]},{"title":"Terms and Conditions","description":["This is the AFRINIC Database query service. The objects are in RDAP format."],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC","rel":"terms-of-service","href":"https://afrinic.net/whois/terms","type":"text/html"}]},{"title":"Whois Inaccuracy Reporting","description":["If you see inaccuracies in the results, please visit: "],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC","rel":"inaccuracy-report","href":"https://www.afrinic.net/support/whois-db/reference-manual","type":"text/html","title":"AFRINIC WHOIS Inaccuracy Report"}]},{"title":"jCard sunset end","description":["2023-12-31T23:59:59Z"],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC","rel":"related","href":"https://www.ietf.org/id/draft-ietf-regext-rdap-jscontact-12.html","type":"text/html","title":"jCard deprecation and replacement with JSContact Card"},{"value":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC","rel":"alternate","href":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC?jscard=1","type":"application/rdap+json","title":"JSContact Card version"}]},{"title":"jCard deprecation end","description":["2022-12-31T23:59:59Z"],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC","rel":"related","href":"https://www.ietf.org/id/draft-ietf-regext-rdap-jscontact-12.html","type":"text/html","title":"jCard deprecation and replacement with JSContact Card"},{"value":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC","rel":"alternate","href":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC?jscard=1","type":"application/rdap+json","title":"JSContact Card version"}]}],"lang":"en","links":[{"value":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC","rel":"self","href":"https://rdap.afrinic.net/rdap/entity/WOL-AFRINIC"}],"handle":"WOL-AFRINIC","status":["active"],"port43":"whois.afrinic.net","vcardArray":["vcard",[["version",{},"text","4.0"],["kind",{},"text","group"],["fn",{},"text","Workonline NOC"],["tel",{"type":"work"},"text","tel:+27-21-200-9009"],["email",{},"text","noc@workonline.africa"],["adr",{"label":"114 West St\nJohannesburg 2196\nSouth Africa"},"text",["114 West St","Johannesburg 2196","South Africa","","","",""]]]],"entities":[{"lang":"en","remarks":[{"title":"Remark","description":["Ben Maddison"]}],"links":[{"value":"https://rdap.afrinic.net/rdap/entity/BM15-AFRINIC","rel":"self","href":"https://rdap.afrinic.net/rdap/entity/BM15-AFRINIC"}],"handle":"BM15-AFRINIC","status":["active"],"port43":"whois.afrinic.net","vcardArray":["vcard",[["version",{},"text","4.0"],["kind",{},"text","individual"],["fn",{},"text","Ben Maddison"],["tel",{"type":"work"},"text","tel:+27-21-200-9000"],["email",{},"text","benm@workonline.africa"],["adr",{"label":"114 West St\nJohannesburg 2916\nSouth Africa"},"text",["114 West St","Johannesburg 2916","South Africa","","","",""]]]],"roles":["administrative","technical"],"objectClassName":"entity"},{"lang":"en","links":[{"value":"https://rdap.afrinic.net/rdap/entity/ORG-WCL1-AFRINIC","rel":"self","href":"https://rdap.afrinic.net/rdap/entity/ORG-WCL1-AFRINIC"}],"handle":"ORG-WCL1-AFRINIC","status":["active"],"port43":"whois.afrinic.net","vcardArray":["vcard",[["version",{},"text","4.0"],["kind",{},"text","org"],["fn",{},"text","Workonline Communications(Pty) Ltd"],["tel",{"type":"work"},"text","tel:+27-21-200-9000"],["tel",{"type":"work"},"text","tel:+27-21-200-9009"],["email",{},"text","noc@workonline.africa"],["email",{},"text","abuse@workonline.africa"],["email",{},"text","communications@workonline.africa"],["adr",{"label":"114 West St\nJohannesburg 2196"},"text",["114 West St","Johannesburg 2196","","","","",""]]]],"roles":["organisation"],"objectClassName":"entity"}],"objectClassName":"entity"}
Loading