secynic / ipwhois

Retrieve and parse whois data for IPv4 and IPv6 addresses
https://ipwhois.readthedocs.io/en/latest
BSD 2-Clause "Simplified" License
552 stars 121 forks source link

Add an option to specify the "-r" flag when querying RIPE NCC #292

Open wiki-ST47 opened 3 years ago

wiki-ST47 commented 3 years ago

RIPE's Acceptable Use Policy places a limit of 1000 queries "returning personal data sets" per day. This includes any query that returns person or role objects. IP addresses that exceed this limit may be blocked. See for example their policy at https://www.ripe.net/manage-ips-and-asns/db/support/documentation/ripe-database-acceptable-use-policy/why-did-i-receive-an-error-201-access-denied

"Person" and "role" objects are normally returned by default, but RIPE's whois service allows you to decline this using the "-r" flag. As far as I can tell, only RIPE supports/requires this flag. If you do specify this flag, then RIPE will not automatically include referenced objects like "person" or "role", the query will not count towards the 1000/day limit, and you won't get blocked.

I wrote a patch to add this option. It adds a get_recursive option to lookup_whois, which defaults to True. If set to False, and it is a RIPE address, it adds the -r option to the query string.

secynic commented 3 years ago

Thanks. Can you submit a PR to the dev branch for this? I will test more extensively when I get a chance.