From 28ec0423dcce8cf7e6ca76c84e3d1ad955ff6bf2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 24 Jul 2023 23:58:15 +0200 Subject: [PATCH] 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 --- blocks_empty.db | Bin 40960 -> 40960 bytes fba/commands.py | 3 +++ fba/helpers/blacklist.py | 1 + fba/models/instances.py | 15 +++++++++++++++ templates/views/infos.html | 5 +++++ 5 files changed, 24 insertions(+) diff --git a/blocks_empty.db b/blocks_empty.db index 9561b71031290f936888cc21d583f4d1d4601852..56402d54ba71f2357e5bd878168aea5b00311035 100644 GIT binary patch delta 157 zcmZoTz|?SnX@ayM3j+fK7ZAgM|3n>Qc@_pe?}@zJMGTy5z6|^kobLRZY`%Q?d^TJK z-1eNeH#VMU)(=u9W=T#LPS;O)kyN?ws08EPRWYPHk*F#>8aEHo1^bZF36WoQVL| Cy(nh@ delta 103 zcmZoTz|?SnX@ayMGXnzy7ZAgM-$Wf_d1eMZ?}@y8ix@aL-5K~JINkX*xr_Mn`E0lf zxa~P_Zx$3d$+6j;Q=5sa)t!Z1Twb2BD|T}@+j6GKdYqC>hHR4y`P4S2@XeVB0P6@9 A`v3p{ 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%} -- 2.39.5