Skip to content

Commit

Permalink
fix: IDA version < 9.0 get bits
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Nov 22, 2024
1 parent 06a6fa6 commit a628f6b
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions LazyIDA.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def check_fmt_function(name, addr):
break
elif name.endswith(("snprintf", "fnprintf")):
if op in ("mov", "lea") and (dst.endswith(("rdx", "[esp+8]", "R2")) or
dst.endswith("edx") and BITS== 64):
dst.endswith("edx") and BITS == 64):
break
elif name.endswith(("sprintf", "fprintf", "dprintf", "printf_chk")):
if op in ("mov", "lea") and (dst.endswith(("rsi", "[esp+4]", "R1")) or
Expand Down Expand Up @@ -475,15 +475,24 @@ def init(self):
global ARCH
global BITS
ARCH = idaapi.ph_get_id()

if idaapi.inf_is_64bit():
BITS = 64
elif idaapi.inf_is_32bit_exactly():
BITS = 32
elif idaapi.idaapi.inf_is_16bit():
BITS = 16

if idaapi.IDA_SDK_VERSION >= 900:
if idaapi.inf_is_64bit():
BITS = 64
elif idaapi.inf_is_32bit_exactly():
BITS = 32
elif idaapi.idaapi.inf_is_16bit():
BITS = 16
else:
raise ValueError
else:
raise ValueError
info = idaapi.get_inf_structure()
if info.is_64bit():
BITS = 64
elif info.is_32bit():
BITS = 32
else:
BITS = 16

print("LazyIDA (v1.0.0.3) plugin has been loaded.")

Expand Down

0 comments on commit a628f6b

Please sign in to comment.