mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-02-06 06:55:00 +00:00
Update fediverse.py
This commit is contained in:
parent
c272efe8b1
commit
58e7322555
|
@ -39,6 +39,8 @@ try:
|
|||
except Exception as e:
|
||||
logger.error("[*] Invalid configuration", exc_info=e)
|
||||
|
||||
# bad reputation domains
|
||||
bad_domains = ["krsw-wiki.org", "midokuriserver.github.io"]
|
||||
|
||||
class Fediverse(Extension):
|
||||
def __init__(self):
|
||||
|
@ -71,6 +73,10 @@ class Fediverse(Extension):
|
|||
if error_rate > 0.2: # it is a binary data
|
||||
return False
|
||||
|
||||
# check if the text contains any of the bad domains
|
||||
if bool(re.search(r"https://(" + "|".join(re.escape(domain) for domain in bad_domains) + ")", text)):
|
||||
return False
|
||||
|
||||
# check ID with K-Anonymity strategy
|
||||
pattern = r"\b(?:(?<=\/@)|(?<=acct:))([a-zA-Z0-9]{10})\b"
|
||||
matches = list(set(re.findall(pattern, text)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user