]> git.mxchange.org Git - fba.git/blobdiff - fba/helpers/blacklist.py
Continued:
[fba.git] / fba / helpers / blacklist.py
index 3aa89c0e095fae966288409f17722e84808a7b5d..d2426b0b7887f52ab2976ac24e4782ee8ccd749d 100644 (file)
@@ -22,43 +22,40 @@ logging.basicConfig(level=logging.INFO)
 logger = logging.getLogger(__name__)
 
 # Don't check these, known trolls/flooders/testing/developing
-blacklist = [
-    # Floods federation with fake nodes as "research" project
-    "activitypub-troll.cf",
-    "activitypub-proxy.cf",
-    # Similar troll
-    "gab.best",
-    # Similar troll
-    "4chan.icu",
-    # Flooder (?)
-    "social.shrimpcam.pw",
-    "mastotroll.netz.org",
-    "lhr.life",
-    "localhost.run",
-    "loca.lt",
-    # Testing/developing installations
-    "ngrok.io",
-    "ngrok.app",
-    "ngrok-free.app",
-    "misskeytest.chn.moe",
-    "netlify.app",
-    # block flooder
-    "everyoneattack.com",
-    # CSRF
-    "hexbear.net", # See script in /instances
-]
+_blacklist = {
+    "activitypub-troll.cf": "Floods federation with fake nodes as \"research\" project",
+    "activitypub-proxy.cf": "Floods federation with fake nodes as \"research\" project",
+    "gab.best"            : "Floods federation tables with fake nodes",
+    "4chan.icu"           : "Floods federation tables with fake nodes",
+    "social.shrimpcam.pw" : "Floods federation tables with fake nodes",
+    "mastotroll.netz.org" : "Floods federation tables with fake nodes",
+    "lhr.life"            : "Floods federation tables with fake nodes",
+    "localhost.run"       : "Floods federation tables with fake nodes",
+    "loca.lt"             : "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",
+    "misskeytest.chn.moe" : "Testing/developing instances shouldn't be part of public instances",
+    "netlify.app"         : "Testing/developing instances shouldn't be part of public instances",
+    "everyoneattack.com"  : "Floods federation tables with fake nodes",
+    "hexbear.net"         : "Is a Lemmy instance with malicious JavaScript code (shell commands)",
+}
 
 def is_blacklisted(domain: str) -> bool:
     logger.debug("domain='%s' - CALLED!", domain)
     domain_helper.raise_on(domain)
 
     blacklisted = False
-    logger.debug("Checking %d blacklist entries ...", len(blacklist))
-    for peer in blacklist:
-        logger.debug("Checking peer='%s' ...", peer)
-        if peer in domain:
+    logger.debug("Checking %d blacklist entries ...", len(_blacklist))
+    for blocked in _blacklist:
+        logger.debug("Checking blocked='%s' ...", blocked)
+        if blocked in domain:
             logger.debug("domain='%s' is blacklisted.", domain)
             blacklisted = True
 
     logger.debug("blacklisted='%s' - EXIT!", blacklisted)
     return blacklisted
+
+def get_all() -> dict:
+    logger.debug("_blacklist()=%d - CALLED!", len(_blacklist))
+    return _blacklist