MCPcopy Create free account
hub / github.com/SpecterOps/DeepPass2 / load_patterns

Method load_patterns

utils/nprules.py:24–31  ·  view source on GitHub ↗

Load all regex patterns from a JSONL file.

(self, jsonl_file)

Source from the content-addressed store, hash-verified

22 return None
23
24 def load_patterns(self, jsonl_file):
25 """Load all regex patterns from a JSONL file."""
26 patterns = []
27 with open(jsonl_file, 'r', encoding='utf-8') as file:
28 for line in file:
29 rule = json.loads(line.strip())
30 patterns.append({'name': rule['name'], 'id': rule['id'], 'pattern': self.compile_pattern(rule['pattern'])}) # Precompile regex
31 return patterns
32
33 async def check_document(self, document):
34 """Check document against regex rules asynchronously."""

Callers 1

__init__Method · 0.95

Calls 1

compile_patternMethod · 0.95

Tested by

no test coverage detected