#!/usr/bin/env python3 """ Suspicious prompt patterns Source: Chapter_15_Data_Leakage_and_Extraction Category: data_extraction """ import argparse import sys # Advanced pattern detection class AdvancedPatternDetector: def __init__(self): # Patterns that suggest extraction attempts self.extraction_indicators = { 'system_prompt_fishing': [ 'what are you', 'your instructions', 'your guidelines', 'repeat everything above', 'system message' ], 'completion_attacks': [ 'api_key =', 'password:', 'secret =', 'credential:', 'token =' ], 'pii_fishing': [ 'email address', 'phone number', 'social security', 'credit card', 'example of real' ] } def detect_attack_type(self, prompt: str) -> List[str]: detected_attacks = [] prompt_lower = prompt.lower() for attack_type, indicators in self.extraction_indicators.items(): for indicator in indicators: if indicator in prompt_lower: detected_attacks.append(attack_type) break return detected_attacks def main(): """Command-line interface.""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--verbose", "-v", action="store_true", help="Verbose output") args = parser.parse_args() # TODO: Add main execution logic pass if __name__ == "__main__": main()