From: Roland Häder Date: Sat, 20 May 2023 07:04:54 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=289f78ef7f0fb040e2387df9f5d5825610275b64;p=fba.git Continued: - some instances reported others with '@' in it which isn't correct for a domain name/host IP --- 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: