IDAPython for IDA 7.5

This commit is contained in:
Arnaud Diederen
2020-05-27 14:34:02 +02:00
parent fc05f78e37
commit 604de9cfad
177 changed files with 102110 additions and 53038 deletions
+7 -6
View File
@@ -26,6 +26,7 @@ import ida_name
import ida_netnode
import ida_segment
import ida_strlist
import ida_struct
import ida_ua
import ida_xref
@@ -359,14 +360,14 @@ def StructMembers(sid):
@note: This will not return 'holes' in structures/stack frames;
it only returns defined structure members.
"""
m = idc.get_first_member(sid)
if m == -1:
sptr = ida_struct.get_struc(sid)
if sptr is None:
raise Exception("No structure with ID: 0x%x" % sid)
while (m != ida_idaapi.BADADDR):
name = idc.get_member_name(sid, m)
for m in sptr.members:
name = idc.get_member_name(sid, m.soff)
if name:
yield (m, name, idc.get_member_size(sid, m))
m = idc.get_next_offset(sid, m)
size = ida_struct.get_member_size(m)
yield (m.soff, name, size)
def DecodePrecedingInstruction(ea):
+4 -23
View File
@@ -1087,7 +1087,7 @@ def gen_file(filetype, path, ea1, ea2, flags):
-1 if an error occurred
OFILE_EXE: 0-can't generate exe file, 1-ok
"""
f = ida_diskio.fopenWT(path)
f = ida_diskio.fopenWB(path)
if f:
retval = ida_loader.gen_file(filetype, f, ea1, ea2, flags)
@@ -1787,13 +1787,9 @@ def find_binary(ea, flag, searchstr, radix=16, from_bc695=False):
#----------------------------------------------------------------------------
def process_config_line(directive):
"""
Parse one or more ida.cfg config directives
@param directive: directives to process, for example: PACK_DATABASE=2
@note: If the directives are erroneous, a fatal error will be generated.
The settings are permanent: effective for the current session and the next ones
Obsolete. Please use ida_idp.process_config_directive().
"""
return eval_idc('process_config_line("%s")' % ida_kernwin.str2user(directive))
return eval_idc('process_config_directive("%s")' % ida_kernwin.str2user(directive))
# The following functions allow you to set/get common parameters.
@@ -5675,22 +5671,7 @@ define_exception = ida_dbg.define_exception
EXC_BREAK = 0x0001 # break on the exception
EXC_HANDLE = 0x0002 # should be handled by the debugger?
def get_reg_value(name):
"""
Get register value
@param name: the register name
@note: The debugger should be running. otherwise the function fails
the register name should be valid.
It is not necessary to use this function to get register values
because a register name in the script will do too.
@return: register value (integer or floating point)
"""
return ida_dbg.get_reg_val(name)
get_reg_value = ida_dbg.get_reg_val
def set_reg_value(value, name):
"""
+8 -1
View File
@@ -1,4 +1,6 @@
import sys
import ida_pro
import ida_funcs
import ida_lumina
@@ -9,12 +11,17 @@ import idautils
dquot_escaped_str = ida_pro.str2user
if sys.version_info.major >= 3:
int_types = [int]
else:
int_types = [int, long]
def escaped_bytestr(bts):
return "".join(map(lambda b: "\\x%02X" % ord(b), bts))
class func_md_t:
def __init__(self, pfn, retrieve=True):
if type(pfn) in [int, long]:
if type(pfn) in int_types:
pfn = ida_funcs.get_func(pfn)
self.pfn_ea = pfn.start_ea
self.func_info = ida_lumina.func_info_t()