From 289f78ef7f0fb040e2387df9f5d5825610275b64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 20 May 2023 09:04:54 +0200 Subject: [PATCH] Continued: - some instances reported others with '@' in it which isn't correct for a domain name/host IP --- fba.py | 11 +++++++++++ fetch_instances.py | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/fba.py b/fba.py index 2237e34..18f2b70 100644 --- a/fba.py +++ b/fba.py @@ -128,6 +128,13 @@ def update_last_seen(last_seen: int, blocker: str, blocked: str, block_level: st sys.exit(255) def block_instance(blocker: str, blocked: str, reason: str, block_level: str, first_added: int, last_seen: int): + if blocker.find("@") > 0: + print("WARNING: Bad blocker:", blocker) + raise + elif blocked.find("@") > 0: + print("WARNING: Bad blocked:", blocked) + raise + print("--- New block:", blocker, blocked, reason, block_level, first_added, last_seen) try: c.execute( @@ -147,6 +154,10 @@ def block_instance(blocker: str, blocked: str, reason: str, block_level: str, fi sys.exit(255) def add_instance(domain: str): + if domain.find("@") > 0: + print("WARNING: Bad domain name:", domain) + raise + print("--- Adding new instance:", domain) try: c.execute( diff --git a/fetch_instances.py b/fetch_instances.py index fd13b25..f9e3836 100644 --- a/fetch_instances.py +++ b/fetch_instances.py @@ -8,11 +8,14 @@ def fetch_instances(domain: str): peerlist = fba.get_peers(domain) if (peerlist is None): - print("FATAL: CANNOT FETCH PEERS:", domain) + print("ERROR: Cannot fetch peers:", domain) return for instance in peerlist: instance = instance.lower() + if instance.find("@") > 0: + print("WARNING: Bad instance name,domain:", instance, domain) + continue blacklisted = False for domain in fba.blacklist: -- 2.39.5