]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 24 Jul 2023 21:58:15 +0000 (23:58 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 24 Jul 2023 21:58:15 +0000 (23:58 +0200)
- 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
fba/commands.py
fba/helpers/blacklist.py
fba/models/instances.py
templates/views/infos.html

index 9561b71031290f936888cc21d583f4d1d4601852..56402d54ba71f2357e5bd878168aea5b00311035 100644 (file)
Binary files a/blocks_empty.db and b/blocks_empty.db differ
index 7b9849d393ae2ec1979fbaf6616286e4ef317458..cbdc60374286b7745002b3db29d9fb1f741f4ad2 100644 (file)
@@ -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"])
index 891a337ee7a0f018b861cea8020c51fbaa9e63a5..4f7a1a685cd8edc33126de9fdc61afae7a32c9d9 100644 (file)
@@ -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",
index 5f7af4529fef7aac9365800f53af6eb927dd1d15..2549ed364897d8ea0c530b295e78836643e12885 100644 (file)
@@ -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)
index 90b40e4921045ab51872e418c462bdf46e1ef25a..c2bf44c00e7ad00541a5e0ea7fccef88eb651261 100644 (file)
         <td>{{instance['total_blocks']}}</td>
     </tr>
 
+    <tr>
+        <td>Obfuscated blocks:</td>
+        <td>{{instance['obfuscated_blocks']}}</td>
+    </tr>
+
     <tr>
         <td>Has obfuscated block list:</td>
         <td>{% if instance['has_obfuscation']%}Yes{%elif not instance['has_obfuscation']%}No{%else%}-{%endif%}</td>