rules: add support for arch flavors of Number and Offset features

closes #210
This commit is contained in:
William Ballenthin
2020-08-03 16:28:47 -06:00
parent c982c2d04e
commit b81b5e5993
10 changed files with 244 additions and 87 deletions

View File

@@ -444,3 +444,15 @@ def test_match_namespace():
assert "WriteFile API" in matches
assert "file-create" not in matches
assert "filesystem-any" in matches
def test_render_number():
assert str(capa.features.insn.Number(1)) == "number(0x1)"
assert str(capa.features.insn.Number(1, arch=ARCH_X32)) == "number/x32(0x1)"
assert str(capa.features.insn.Number(1, arch=ARCH_X64)) == "number/x64(0x1)"
def test_render_offset():
assert str(capa.features.insn.Offset(1)) == "offset(0x1)"
assert str(capa.features.insn.Offset(1, arch=ARCH_X32)) == "offset/x32(0x1)"
assert str(capa.features.insn.Offset(1, arch=ARCH_X64)) == "offset/x64(0x1)"