From: Roland Häder Date: Mon, 24 Jul 2023 21:58:15 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=28ec0423dcce8cf7e6ca76c84e3d1ad955ff6bf2;p=fba.git Continued: - added column `obfuscated_blocks` to save count of (still) obfuscated blocks - also exposed it in infos.html view - blacklisted gitpod.io as this domain floods `instances` table --- diff --git a/blocks_empty.db b/blocks_empty.db index 9561b71..56402d5 100644 Binary files a/blocks_empty.db and b/blocks_empty.db differ diff --git a/fba/commands.py b/fba/commands.py index 7b9849d..cbdc603 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -1573,6 +1573,9 @@ def recheck_obfuscation(args: argparse.Namespace) -> int: "reason" : block["reason"], }) + logger.debug("Settings obfuscated=%d for row[domain]='%s' ...", obfuscated, row["domain"]) + instances.set_obfuscated_blocks(row["domain"], obfuscated) + logger.info("domain='%s' has %d obfuscated domain(s)", row["domain"], obfuscated) if obfuscated == 0 and len(blocking) > 0: logger.info("Block list from domain='%s' has been fully deobfuscated.", row["domain"]) diff --git a/fba/helpers/blacklist.py b/fba/helpers/blacklist.py index 891a337..4f7a1a6 100644 --- a/fba/helpers/blacklist.py +++ b/fba/helpers/blacklist.py @@ -33,6 +33,7 @@ _blacklist = { "localhost.run" : "Floods federation tables with fake nodes", "loca.lt" : "Floods federation tables with fake nodes", "grid.tf" : "Floods federation tables with fake nodes", + "gitpod.io" : "Floods federation tables with fake nodes", "ngrok.io" : "Testing/developing instances shouldn't be part of public instances", "ngrok.app" : "Testing/developing instances shouldn't be part of public instances", "ngrok-free.app" : "Testing/developing instances shouldn't be part of public instances", diff --git a/fba/models/instances.py b/fba/models/instances.py index 5f7af45..2549ed3 100644 --- a/fba/models/instances.py +++ b/fba/models/instances.py @@ -51,6 +51,8 @@ _pending = { "total_peers" : {}, # Found total blocks "total_blocks" : {}, + # Obfuscated domains + "obfuscated_blocks" : {}, # Last fetched instances "last_instance_fetch": {}, # Last updated @@ -408,6 +410,19 @@ def set_total_blocks(domain: str, blocks: list): _set_data("total_blocks", domain, len(blocks)) logger.debug("EXIT!") +def set_obfuscated_blocks(domain: str, obfuscated: int): + logger.debug("domain='%s',obfuscated=%d - CALLED!", domain, obfuscated) + domain_helper.raise_on(domain) + + if not isinstance(obfuscated, int): + raise ValueError(f"Parameter obfuscated[]='{type(blocks)}' is not of type 'int'") + elif obfuscated < 0: + raise ValueError(f"Parameter obfuscated={obfuscated} is not valid") + + # Set timestamp + _set_data("obfuscated_blocks", domain, obfuscated) + logger.debug("EXIT!") + def set_nodeinfo_url(domain: str, url: str): logger.debug("domain='%s',url='%s' - CALLED!", domain, url) domain_helper.raise_on(domain) diff --git a/templates/views/infos.html b/templates/views/infos.html index 90b40e4..c2bf44c 100644 --- a/templates/views/infos.html +++ b/templates/views/infos.html @@ -59,6 +59,11 @@ {{instance['total_blocks']}} + + Obfuscated blocks: + {{instance['obfuscated_blocks']}} + + Has obfuscated block list: {% if instance['has_obfuscation']%}Yes{%elif not instance['has_obfuscation']%}No{%else%}-{%endif%}