Hi
i have problem using parse_binpat_str
pattern = idaapi.compiled_binpat_vec_t()
start_ea = idaapi.get_screen_ea()
bin_str= "0F A3 0A 08"
if not ida_bytes.parse_binpat_str(pattern, start_ea, bin_str, 16, idaapi.BIN_SEARCH_CASE):
idaapi.msg(f"β Error: Failed to parse binary pattern {bin_str}\n")
is there any other way to search for binary string?
1 Like
Milanek
2
Adding
print(len(pattern))
print(pattern[0].bytes)
print(pattern[0].mask)
after your code prints
1
b'\x0f\xa3\n\x08'
b''
So it was parsed successfully.
You might want to change the last parameter though. It should be one of the PBSENC_xxx constants or index of the encoding you want to use.
1 Like
igor
3
I think you can use ida_bytes.find_bytes
if you have a fixed byte sequence.
2 Likes
Self promotion:
I have written some code that will make your life easier when writing scripts. Maybe this will help you?
1 Like
Thanks Igor
I done it with ida_bytes.find_bytes
another question:
before i use
inf = idaapi.get_inf_structure()
is_be = inf.is_be()
to check big/litlle endian, but now this not work
1 Like