From 2b112d534406d4f4a5447133e43c59d10b120f78 Mon Sep 17 00:00:00 2001 From: Alarig Le Lay Date: Sat, 27 Jul 2024 14:28:43 +0200 Subject: [PATCH] Giving a hint to find the registrar RDAP server if the TLD has no RDAP server Signed-off-by: Alarig Le Lay --- check_domain_expiration_rdap.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/check_domain_expiration_rdap.py b/check_domain_expiration_rdap.py index ab173b8..b89e6f1 100755 --- a/check_domain_expiration_rdap.py +++ b/check_domain_expiration_rdap.py @@ -41,7 +41,7 @@ def find_rdap_server(domain): # no rdap on tld except IndexError: raise nagiosplugin.CheckError( - f'The TLD {tld} does not have an RDAP server' + f'The TLD {tld} does not have an RDAP server, try forcing the registrar server with --server. It can be found on https://www.iana.org/assignments/registrar-ids/registrar-ids.xhtml' ) _log.debug(f'The used RDAP server is {url}') @@ -124,10 +124,11 @@ def expiration(domain, server): elif isinstance(raw_expiration[0], str): import csv # fetch csv - iana_registrars_csv = session.get( + iana_registrars_req = session.get( 'https://www.iana.org/assignments/registrar-ids/registrar-ids-1.csv', timeout=120 - ).content.decode('utf-8') + ) + iana_registrars_csv = iana_registrars_req.content.decode('utf-8') # parse csv registrar_rdap_found = False for registrar_row in csv.reader( @@ -148,7 +149,7 @@ def expiration(domain, server): ) if not(registrar_rdap_found): raise nagiosplugin.CheckError( - f'The registrar {raw_expiration[0]} is not fond from {iana_registrars_csv.url}' + f'The registrar {raw_expiration[0]} is not found from {iana_registrars_req.url}' ) else: