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",
- # Similar troll
- "gab.best",
- # Similar troll
- "4chan.icu",
- # Flooder (?)
- "social.shrimpcam.pw",
- # Flooder (?)
- "mastotroll.netz.org",
- # Testing/developing installations
- "ngrok.io",
- "ngrok-free.app",
- "misskeytest.chn.moe",
- # block flooder
- "everyoneattack.com",
- # responds with very long reply
- "grossard.fr",
-]
+_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(%d)='%s' - CALLED!", len(domain), domain)
+ logger.debug("domain='%s' - CALLED!", domain)
domain_helper.raise_on(domain)
blacklisted = False
- for peer in blacklist:
- logger.debug(f"Checking peer='{peer}' ...")
- if peer in domain:
- logger.debug(f"domain='{domain}' is blacklisted.")
+ 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(f"blacklisted='{blacklisted}' - EXIT!")
+ logger.debug("blacklisted='%s' - EXIT!", blacklisted)
return blacklisted
+
+def get_all() -> dict:
+ logger.debug("_blacklist()=%d - CALLED!", len(_blacklist))
+ return _blacklist