mirror of
https://github.com/idapython/src
synced 2026-06-08 14:47:00 +00:00
IDAPython for IDA 7.2
This commit is contained in:
@@ -3,6 +3,11 @@ import sys
|
||||
|
||||
${IMPORTS}
|
||||
|
||||
# guerilla-patch a few unfortunate overrides
|
||||
from ida_funcs import set_func_start
|
||||
from ida_funcs import set_func_end
|
||||
from ida_dbg import dbg_can_query
|
||||
|
||||
class idaapi_Cvar(object):
|
||||
def __init__(self):
|
||||
# prevent endless recursion
|
||||
|
||||
+18
-17
@@ -118,29 +118,30 @@ def DataRefsFrom(ea):
|
||||
return refs(ea, ida_xref.get_first_dref_from, ida_xref.get_next_dref_from)
|
||||
|
||||
|
||||
# Xref type names table
|
||||
_ref_types = {
|
||||
ida_xref.fl_U : 'Data_Unknown',
|
||||
ida_xref.dr_O : 'Data_Offset',
|
||||
ida_xref.dr_W : 'Data_Write',
|
||||
ida_xref.dr_R : 'Data_Read',
|
||||
ida_xref.dr_T : 'Data_Text',
|
||||
ida_xref.dr_I : 'Data_Informational',
|
||||
ida_xref.fl_CF : 'Code_Far_Call',
|
||||
ida_xref.fl_CN : 'Code_Near_Call',
|
||||
ida_xref.fl_JF : 'Code_Far_Jump',
|
||||
ida_xref.fl_JN : 'Code_Near_Jump',
|
||||
20 : 'Code_User',
|
||||
ida_xref.fl_F : 'Ordinary_Flow'
|
||||
}
|
||||
|
||||
def XrefTypeName(typecode):
|
||||
"""
|
||||
Convert cross-reference type codes to readable names
|
||||
|
||||
@param typecode: cross-reference type code
|
||||
"""
|
||||
ref_types = {
|
||||
0 : 'Data_Unknown',
|
||||
1 : 'Data_Offset',
|
||||
2 : 'Data_Write',
|
||||
3 : 'Data_Read',
|
||||
4 : 'Data_Text',
|
||||
5 : 'Data_Informational',
|
||||
16 : 'Code_Far_Call',
|
||||
17 : 'Code_Near_Call',
|
||||
18 : 'Code_Far_Jump',
|
||||
19 : 'Code_Near_Jump',
|
||||
20 : 'Code_User',
|
||||
21 : 'Ordinary_Flow'
|
||||
}
|
||||
assert typecode in ref_types, "unknown reference type %d" % typecode
|
||||
return ref_types[typecode]
|
||||
|
||||
assert typecode in _ref_types, "unknown reference type %d" % typecode
|
||||
return _ref_types[typecode]
|
||||
|
||||
def _copy_xref(xref):
|
||||
""" Make a private copy of the xref class to preserve its contents """
|
||||
|
||||
+18
-46
@@ -68,7 +68,6 @@ import time
|
||||
import types
|
||||
import sys
|
||||
|
||||
__X64__ = sys.maxsize > 0xFFFFFFFF
|
||||
__EA64__ = ida_idaapi.BADADDR == 0xFFFFFFFFFFFFFFFFL
|
||||
WORDMASK = 0xFFFFFFFFFFFFFFFF if __EA64__ else 0xFFFFFFFF
|
||||
class DeprecatedIDCError(Exception):
|
||||
@@ -2358,8 +2357,6 @@ def get_next_seg(ea):
|
||||
else:
|
||||
return nextseg.start_ea
|
||||
|
||||
return BADADDR
|
||||
|
||||
|
||||
def get_segm_start(ea):
|
||||
"""
|
||||
@@ -2604,7 +2601,7 @@ def set_segm_addressing(ea, bitness):
|
||||
|
||||
def selector_by_name(segname):
|
||||
"""
|
||||
Get segment by name
|
||||
Get segment selector by name
|
||||
|
||||
@param segname: name of segment
|
||||
|
||||
@@ -3070,53 +3067,28 @@ def set_func_attr(ea, attr, value):
|
||||
FUNCATTR_START = 0 # readonly: function start address
|
||||
FUNCATTR_END = 4 # readonly: function end address
|
||||
FUNCATTR_FLAGS = 8 # function flags
|
||||
FUNCATTR_FRAME = 12 # readonly: function frame id
|
||||
FUNCATTR_FRSIZE = 16 # readonly: size of local variables
|
||||
FUNCATTR_FRREGS = 20 # readonly: size of saved registers area
|
||||
FUNCATTR_ARGSIZE = 24 # readonly: number of bytes purged from the stack
|
||||
FUNCATTR_FPD = 28 # frame pointer delta
|
||||
FUNCATTR_COLOR = 32 # function color code
|
||||
FUNCATTR_OWNER = 12 # readonly: chunk owner (valid only for tail chunks)
|
||||
FUNCATTR_REFQTY = 16 # readonly: number of chunk parents (valid only for tail chunks)
|
||||
FUNCATTR_FRAME = 16 # readonly: function frame id
|
||||
FUNCATTR_FRSIZE = 20 # readonly: size of local variables
|
||||
FUNCATTR_FRREGS = 24 # readonly: size of saved registers area
|
||||
FUNCATTR_ARGSIZE = 28 # readonly: number of bytes purged from the stack
|
||||
FUNCATTR_FPD = 32 # frame pointer delta
|
||||
FUNCATTR_COLOR = 36 # function color code
|
||||
FUNCATTR_OWNER = 16 # readonly: chunk owner (valid only for tail chunks)
|
||||
FUNCATTR_REFQTY = 20 # readonly: number of chunk parents (valid only for tail chunks)
|
||||
|
||||
if __X64__:
|
||||
FUNCATTR_START = 0
|
||||
FUNCATTR_END = 4
|
||||
FUNCATTR_FLAGS = 8
|
||||
FUNCATTR_FRAME = 16
|
||||
FUNCATTR_FRSIZE = 20
|
||||
FUNCATTR_FRREGS = 24
|
||||
FUNCATTR_ARGSIZE = 28
|
||||
FUNCATTR_FPD = 32
|
||||
FUNCATTR_COLOR = 36
|
||||
FUNCATTR_OWNER = 16
|
||||
FUNCATTR_REFQTY = 20
|
||||
|
||||
# Redefining the constants for 64-bit
|
||||
# Redefining the constants for ea64
|
||||
if __EA64__:
|
||||
FUNCATTR_START = 0
|
||||
FUNCATTR_END = 8
|
||||
FUNCATTR_FLAGS = 16
|
||||
FUNCATTR_FRAME = 20
|
||||
FUNCATTR_FRSIZE = 28
|
||||
FUNCATTR_FRREGS = 36
|
||||
FUNCATTR_ARGSIZE = 40
|
||||
FUNCATTR_FPD = 48
|
||||
FUNCATTR_COLOR = 56
|
||||
FUNCATTR_OWNER = 20
|
||||
FUNCATTR_REFQTY = 28
|
||||
if __X64__:
|
||||
FUNCATTR_START = 0
|
||||
FUNCATTR_END = 8
|
||||
FUNCATTR_FLAGS = 16
|
||||
FUNCATTR_FRAME = 24
|
||||
FUNCATTR_FRSIZE = 32
|
||||
FUNCATTR_FRREGS = 40
|
||||
FUNCATTR_ARGSIZE = 48
|
||||
FUNCATTR_FPD = 56
|
||||
FUNCATTR_COLOR = 64
|
||||
FUNCATTR_OWNER = 24
|
||||
FUNCATTR_REFQTY = 32
|
||||
FUNCATTR_FRAME = 24
|
||||
FUNCATTR_FRSIZE = 32
|
||||
FUNCATTR_FRREGS = 40
|
||||
FUNCATTR_ARGSIZE = 48
|
||||
FUNCATTR_FPD = 56
|
||||
FUNCATTR_COLOR = 64
|
||||
FUNCATTR_OWNER = 24
|
||||
FUNCATTR_REFQTY = 32
|
||||
|
||||
_FUNCATTRMAP = {
|
||||
FUNCATTR_START : (True, 'start_ea'),
|
||||
|
||||
+1
-3
@@ -47,8 +47,6 @@ except ImportError as e:
|
||||
print "\t%s" % p
|
||||
raise
|
||||
|
||||
# __EA64__ is set if IDA is running in 64-bit mode
|
||||
__EA64__ = ida_idaapi.BADADDR == 0xFFFFFFFFFFFFFFFFL
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Take over the standard text outputs
|
||||
@@ -86,7 +84,7 @@ def runscript(script):
|
||||
def print_banner():
|
||||
banner = [
|
||||
"Python %s " % sys.version,
|
||||
"IDAPython" + (" 64-bit" if __EA64__ else "") + " v%d.%d.%d %s (serial %d) (c) The IDAPython Team <idapython@googlegroups.com>" % IDAPYTHON_VERSION
|
||||
"IDAPython" + (" 64-bit" if ida_idaapi.__EA64__ else "") + " v%d.%d.%d %s (serial %d) (c) The IDAPython Team <idapython@googlegroups.com>" % IDAPYTHON_VERSION
|
||||
]
|
||||
sepline = '-' * (max([len(s) for s in banner])+1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user