angr.knowledge_plugins.patterns¶
User-authored fuzzy patterns, kept with the knowledge base so they outlive a session.
A stored pattern is a KnownPattern
plus how it is to be applied: whether it is switched on, and the similarity an
occurrence must reach before it is outlined. Patterns are keyed by name; call
names are unique too, since an outlined call is looked up by its target.
- class angr.knowledge_plugins.patterns.PatternStats¶
Bases:
objectWhat the outliner pass saw of one pattern in one function when it last ran there.
- class angr.knowledge_plugins.patterns.StoredPattern¶
Bases:
objectOne fuzzy pattern and its application settings.
- pattern: KnownPattern
- min_similarity: float = 0.8¶
an occurrence is outlined only at this similarity or above (see search.TemplateMatch)
- require_verified: bool = True¶
outline only occurrences that pass the pattern’s structural match (constants, captures); off, similarity alone decides, as it does for discovered patterns
- created_at: float
- classmethod from_dict(data)¶
- Return type:
- Parameters:
- class angr.knowledge_plugins.patterns.Patterns¶
Bases:
KnowledgeBasePluginThe fuzzy patterns of a knowledge base, by pattern name.
- __init__(kb)¶
- Parameters:
kb (KnowledgeBase)
- record_stats(func_addr, stats)¶
Replace what is known about
func_addr: the outliner pass saw exactly these patterns.- Return type:
- Parameters:
func_addr (int)
stats (dict[str, PatternStats])
- stats(func_addr, name)¶
The outliner pass’s numbers for a pattern in a function, or None if it did not search for that pattern there when it last ran.
- Return type:
- Parameters:
- add(pattern, *, enabled=True, min_similarity=0.8, origin_func=None, require_verified=True, replace=False)¶
Store
pattern. Refuses a name or call name already taken unlessreplace.- Return type:
- Parameters:
- store(stored)¶
Put a StoredPattern back, keeping its settings (a loader’s entry point).
- Return type:
- Parameters:
stored (StoredPattern)
- enabled_patterns()¶
- Return type: