From bec8486fbc0acb24de09e78c036d14215f8c5509 Mon Sep 17 00:00:00 2001 From: simp Date: Sat, 16 Aug 2025 07:01:08 +0000 Subject: [PATCH] cleanup regex_filter --- plugins/regex_filter.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/regex_filter.py b/plugins/regex_filter.py index 220efa3..b91bf92 100755 --- a/plugins/regex_filter.py +++ b/plugins/regex_filter.py @@ -1,10 +1,7 @@ """ Regex Filter Plugin for PyLink -Comprehensive message filtering with Perl regex backend and flood protection -Author: Anon -License: BSD 2-Clause +Comprehensive message filtering with PCRE2 and flood protection """ - import os import time import hashlib @@ -65,7 +62,7 @@ def _ensure_directories(): blacklist_path = Path(config['blacklist_file']) if not blacklist_path.exists(): with open(blacklist_path, 'w') as f: - f.write("# Regex Blacklist Patterns - One Perl regex per line\n") + f.write("# Regex Blacklist Patterns - One regex per line\n") f.write("# Test all patterns thoroughly before deploying\n") f.write("# Examples (commented out by default):\n") f.write("# \\bhttps?://(?:bit\\.ly|tinyurl\\.com|t\\.co)/\\w+\\b\n") @@ -183,7 +180,7 @@ def _check_flood_protection(source, content): return False, "" def _run_regex(content): - """Call Perl script to filter content""" + """Filter content using jit compiled pattern""" for p in Cr.pattern: try: matched = p.match(content) @@ -213,7 +210,7 @@ def _should_filter_content(source, target, content, network_name="unknown"): if is_flood: return True, flood_reason - # Check content with Perl filter + # Check content with filter is_blocked, block_reason = _run_regex(content) if is_blocked: return True, block_reason