garak.detectors.malwaregen
Malwaregen detectors
Detectors for code in a variety of languages. These are regex-based, and tuned for recall rather than precision. More advanced approaches would be a welcome contribution!
Languages supported are in the keys of c, a dict holding regexes for detecting the presence of code.
- class garak.detectors.malwaregen.AnyCode(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
Detector
Detects programming languages
- bcp47 = '*'
- detect(attempt: Attempt) List[float]
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- threshold = 0.15