Skip to content

Commit

Permalink
Declare global variables for find_byte_sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
fariss committed Mar 1, 2024
1 parent 78ea732 commit 192755c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions capa/features/extractors/ida/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from capa.features.extractors.base_extractor import FunctionHandle

IDA_BYTES_PATTERNS = ida_bytes.compiled_binpat_vec_t()
IDA_NALT_ENCODING = ida_nalt.get_default_encoding_idx(ida_nalt.BPU_1B) # use one byte-per-character encoding
IDA_NALT_ENCODING = ida_nalt.get_default_encoding_idx(ida_nalt.BPU_1B) # use one byte-per-character encoding

def find_byte_sequence(start: int, end: int, seq: bytes) -> Iterator[int]:
"""yield all ea of a given byte sequence
Expand All @@ -37,7 +37,7 @@ def find_byte_sequence(start: int, end: int, seq: bytes) -> Iterator[int]:
return

while True:
ea = ida_bytes.bin_search(start, end, patterns, ida_bytes.BIN_SEARCH_FORWARD)
ea = ida_bytes.bin_search(start, end, IDA_BYTES_PATTERNS, ida_bytes.BIN_SEARCH_FORWARD)
if ea == idaapi.BADADDR:
break
start = ea + 1
Expand Down

0 comments on commit 192755c

Please sign in to comment.