Skip to content

Support for multiple ASNs returned from Cymru #304

@monoidic

Description

@monoidic

I've noticed that occasionally, Cymru will respond to an IP-ASN lookup with multiple ASNs, which will cause get_asn_verbose_dns in ipwhois/net.py to fail, as it only expects a single ASN. An example of such a result:

; <<>> DiG 9.16.1-Ubuntu <<>> TXT 1.40.136.94.origin.asn.cymru.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9503
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;141.40.136.94.origin.asn.cymru.com. IN	TXT

;; ANSWER SECTION:
141.40.136.94.origin.asn.cymru.com. 3404 IN TXT	"20738 20773 | 94.136.40.0/24 | DE | ripencc | 2008-07-17"
141.40.136.94.origin.asn.cymru.com. 3404 IN TXT	"20738 | 94.136.32.0/19 | DE | ripencc | 2008-07-17"

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: E veebr 15 15:54:50 EET 2021
;; MSG SIZE  rcvd: 195

This can cause surprising errors problems with specific DNS configurations (search domain for a domain with default TXT records on subdomains), and fails silently in most other cases while setting the ASN value of the requested IP to i.e '20738 20773', which might be unexpected by any developers using IPWhois.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions