def
find_callrealfunc(
self
):
encodings
=
[
0xDE
,
0x43
,
0x20
,
0x8B
]
codelist
=
ida_bytes.get_bytes(
self
.func_start,
0x1000
)
self
.callrealfunc
=
hex
(codelist.find(bytes(encodings))
+
self
.func_start
-
8
)
for
i
in
range
(
self
.func_start,
self
.func_start
+
0x1000
,
4
):
for
csins
in
md.disasm(ida_bytes.get_bytes(i,
4
,
0
), i):
if
csins.mnemonic
=
=
'bl'
:
if
hex
(
int
(csins.op_str.replace(
'#'
, ''),
16
))
=
=
self
.callrealfunc:
self
.callrealfunclable
=
csins.address
print
(
"callrealfunclable: "
+
hex
(
self
.callrealfunclable))
return
def
patch_callrealfunc(
self
):
ref_addrs
=
[]
ref_addr
=
ida_xref.get_first_cref_to(
self
.callrealfunclable)
while
ref_addr !
=
ida_idaapi.BADADDR:
ref_addrs.append(ref_addr)
ref_addr
=
ida_xref.get_next_cref_to(
self
.callrealfunclable, ref_addr)