mirror of
https://github.com/mandiant/capa.git
synced 2025-12-22 15:16:22 -08:00
tests: demonstrate a bit more depth to namespace matching
This commit is contained in:
@@ -226,7 +226,7 @@ def test_match_namespace():
|
|||||||
rule:
|
rule:
|
||||||
meta:
|
meta:
|
||||||
name: CreateFile API
|
name: CreateFile API
|
||||||
namespace: file/create
|
namespace: file/create/CreateFile
|
||||||
features:
|
features:
|
||||||
- api: CreateFile
|
- api: CreateFile
|
||||||
''')),
|
''')),
|
||||||
@@ -260,6 +260,9 @@ def test_match_namespace():
|
|||||||
assert 'CreateFile API' in matches
|
assert 'CreateFile API' in matches
|
||||||
assert 'file-create' in matches
|
assert 'file-create' in matches
|
||||||
assert 'filesystem-any' in matches
|
assert 'filesystem-any' in matches
|
||||||
|
assert capa.features.MatchedRule('file') in features
|
||||||
|
assert capa.features.MatchedRule('file/create') in features
|
||||||
|
assert capa.features.MatchedRule('file/create/CreateFile') in features
|
||||||
|
|
||||||
features, matches = capa.engine.match(capa.engine.topologically_order_rules(rules),
|
features, matches = capa.engine.match(capa.engine.topologically_order_rules(rules),
|
||||||
{capa.features.insn.API('WriteFile'): {1}},
|
{capa.features.insn.API('WriteFile'): {1}},
|
||||||
|
|||||||
Reference in New Issue
Block a user