mirror of
https://github.com/vee1e/capa.git
synced 2026-09-01 18:57:15 +00:00
rules: parse operand features
This commit is contained in:
parent
251a4e285f
commit
745cb037d4
1 changed files with 7 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ import uuid
|
|||
import struct
|
||||
import logging
|
||||
import binascii
|
||||
import functools
|
||||
import collections
|
||||
from enum import Enum
|
||||
from typing import Any, Union, Callable, Iterator, Optional, cast
|
||||
|
|
@ -444,6 +445,12 @@ def parse_feature(key: str):
|
|||
return capa.features.common.Namespace
|
||||
elif key == "property":
|
||||
return capa.features.insn.Property
|
||||
elif key.startswith("operand[") and key.endswith("].number"):
|
||||
index = int(key[len("operand[") : -len("].number")])
|
||||
return functools.partial(capa.features.insn.OperandNumber, index)
|
||||
elif key.startswith("operand[") and key.endswith("].offset"):
|
||||
index = int(key[len("operand[") : -len("].offset")])
|
||||
return functools.partial(capa.features.insn.OperandOffset, index)
|
||||
else:
|
||||
raise InvalidRule(f"unexpected statement: {key}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue