mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-24 01:59:18 +01:00
IDAPython 1.5.2
- added ui_term/ui_save/ui_saved/ui_get_ea_hint UI notifications - added ph_get_operand_info() to retrieve operand information while debugging - added PteDump.py script - some code refactoring - bugfix: idaapi.netnode.getblob() was limited to MAXSPECSIZE - bugfix: idc.GetString()/idaapi.get_ascii_contents()/idautils.Strings() were limited to MAXSTR string length - bugfix: idaapi.del_menu_item() was failing to delete some menu items - bugfix: dbg_bpt was called instead of dbg_trace for a DBG_Hooks class implementation (old bug from 0.9.x) - bugfix: Form.GetControlValue() was not working with numeric controls - bugfix: SetBptCnd() was broken - bugfix: idaapi.get_func_cmt() was memory leaking
This commit is contained in:
parent
88aa875c55
commit
f5ec434bf7
@ -43,9 +43,9 @@ Make sure all the needed tools (compiler, swig) are on the PATH.
|
||||
idapython/ - IDAPython source code
|
||||
|
||||
2. On Mac OS X copy libida.dylib from the IDA install directory to
|
||||
swigsdk-versions/x.y/lib/gcc32.mac/
|
||||
swigsdk-versions/x.y/lib/x86_mac_gcc_32/
|
||||
and libida64.dylib to
|
||||
swigsdk-versions/x.y/lib/gcc64.mac/
|
||||
swigsdk-versions/x.y/lib/x86_mac_gcc_64/
|
||||
|
||||
3. Build the plugin
|
||||
|
||||
|
14
CHANGES.txt
14
CHANGES.txt
@ -1,6 +1,20 @@
|
||||
Please see http://code.google.com/p/idapython/source/list for a detailed list of changes.
|
||||
|
||||
|
||||
Changes from version 1.5.1 to 1.5.2
|
||||
------------------------------------
|
||||
- added ui_term/ui_save/ui_saved/ui_get_ea_hint UI notifications
|
||||
- added ph_get_operand_info() to retrieve operand information while debugging
|
||||
- added PteDump.py script
|
||||
- some code refactoring
|
||||
- bugfix: idaapi.netnode.getblob() was limited to MAXSPECSIZE
|
||||
- bugfix: idc.GetString()/idaapi.get_ascii_contents()/idautils.Strings() were limited to MAXSTR string length
|
||||
- bugfix: idaapi.del_menu_item() was failing to delete some menu items
|
||||
- bugfix: dbg_bpt was called instead of dbg_trace for a DBG_Hooks class implementation (old bug from 0.9.x)
|
||||
- bugfix: Form.GetControlValue() was not working with numeric controls
|
||||
- bugfix: SetBptCnd() was broken
|
||||
- bugfix: idaapi.get_func_cmt() was memory leaking
|
||||
|
||||
Changes from version 1.5.0 to 1.5.1
|
||||
------------------------------------
|
||||
- Introduced the CLI '?' pseudo-command to retrieve doc strings
|
||||
|
2
build.py
2
build.py
@ -36,7 +36,7 @@ else:
|
||||
# IDAPython version
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 5
|
||||
VERSION_PATCH = 1
|
||||
VERSION_PATCH = 2
|
||||
|
||||
# Determine Python version
|
||||
PYTHON_MAJOR_VERSION = int(platform.python_version()[0])
|
||||
|
@ -23,6 +23,40 @@ class MyUiHook(idaapi.UI_Hooks):
|
||||
print("IDA finished processing command: %s" % self.cmdname)
|
||||
return 0
|
||||
|
||||
def saving(self):
|
||||
"""
|
||||
The kernel is saving the database.
|
||||
|
||||
@return: Ignored
|
||||
"""
|
||||
print("Saving....")
|
||||
|
||||
def saved(self):
|
||||
"""
|
||||
The kernel has saved the database.
|
||||
|
||||
@return: Ignored
|
||||
"""
|
||||
print("Saved")
|
||||
|
||||
def term(self):
|
||||
"""
|
||||
IDA is terminated and the database is already closed.
|
||||
The UI may close its windows in this callback.
|
||||
|
||||
This callback is best used with a plugin_t with flags PLUGIN_FIX
|
||||
"""
|
||||
print("IDA terminated")
|
||||
|
||||
def get_ea_hint(self, ea):
|
||||
"""
|
||||
The UI wants to display a simple hint for an address in the navigation band
|
||||
|
||||
@param ea: The address
|
||||
@return: String with the hint or None
|
||||
"""
|
||||
print("get_ea_hint(%x)" % ea)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Remove an existing hook on second run
|
||||
|
@ -93,6 +93,9 @@ PyObject *PyW_TryImportModule(const char *name);
|
||||
// Tries to get an attribute and swallows the exception if it fails and returns NULL
|
||||
PyObject *PyW_TryGetAttrString(PyObject *py_var, const char *attr);
|
||||
|
||||
// Returns the linked object (void *) from a PyObject
|
||||
void *pyobj_get_clink(PyObject *pyobj);
|
||||
|
||||
// Converts a Python number (LONGLONG or normal integer) to an IDC variable (VT_LONG or VT_INT64)
|
||||
bool PyW_GetNumberAsIDC(PyObject *py_var, idc_value_t *idc_var);
|
||||
|
||||
@ -160,6 +163,9 @@ bool PyW_PyListToIntVec(PyObject *py_list, intvec_t &intvec);
|
||||
// Returns a reference to a class
|
||||
PyObject *get_idaapi_attr(const char *attr);
|
||||
|
||||
// Returns a reference to a class by its ID
|
||||
PyObject *get_idaapi_attr_by_id(const int class_id);
|
||||
|
||||
// notify_when()
|
||||
bool pywraps_nw_term();
|
||||
bool pywraps_nw_notify(int slot, ...);
|
||||
|
1043
swig/idaapi.i
1043
swig/idaapi.i
File diff suppressed because it is too large
Load Diff
62
swig/idp.i
62
swig/idp.i
@ -847,37 +847,37 @@ public:
|
||||
return unhook_from_notification_point(HT_IDB, IDB_Callback, this);
|
||||
}
|
||||
// Hook functions to override in Python
|
||||
virtual int byte_patched(ea_t ea) { return 0; };
|
||||
virtual int cmt_changed(ea_t, bool repeatable_cmt) { return 0; };
|
||||
virtual int ti_changed(ea_t ea, const type_t *type, const p_list *fnames) { msg("ti_changed hook not supported yet\n"); return 0; };
|
||||
virtual int op_ti_changed(ea_t ea, int n, const type_t *type, const p_list *fnames) { msg("op_ti_changed hook not supported yet\n"); return 0; };
|
||||
virtual int op_type_changed(ea_t ea, int n) { return 0; };
|
||||
virtual int enum_created(enum_t id) { return 0; };
|
||||
virtual int enum_deleted(enum_t id) { return 0; };
|
||||
virtual int enum_bf_changed(enum_t id) { return 0; };
|
||||
virtual int enum_renamed(enum_t id) { return 0; };
|
||||
virtual int enum_cmt_changed(enum_t id) { return 0; };
|
||||
virtual int enum_member_created(enum_t id, const_t cid) { return 0; };
|
||||
virtual int enum_member_deleted(enum_t id, const_t cid) { return 0; };
|
||||
virtual int struc_created(tid_t struc_id) { return 0; };
|
||||
virtual int struc_deleted(tid_t struc_id) { return 0; };
|
||||
virtual int struc_renamed(struc_t *sptr) { return 0; };
|
||||
virtual int struc_expanded(struc_t *sptr) { return 0; };
|
||||
virtual int struc_cmt_changed(tid_t struc_id) { return 0; };
|
||||
virtual int struc_member_created(struc_t *sptr, member_t *mptr) { return 0; };
|
||||
virtual int struc_member_deleted(struc_t *sptr, tid_t member_id) { return 0; };
|
||||
virtual int struc_member_renamed(struc_t *sptr, member_t *mptr) { return 0; };
|
||||
virtual int struc_member_changed(struc_t *sptr, member_t *mptr) { return 0; };
|
||||
virtual int thunk_func_created(func_t *pfn) { return 0; };
|
||||
virtual int func_tail_appended(func_t *pfn, func_t *tail) { return 0; };
|
||||
virtual int func_tail_removed(func_t *pfn, ea_t tail_ea) { return 0; };
|
||||
virtual int tail_owner_changed(func_t *tail, ea_t owner_func) { return 0; };
|
||||
virtual int func_noret_changed(func_t *pfn) { return 0; };
|
||||
virtual int segm_added(segment_t *s) { return 0; };
|
||||
virtual int segm_deleted(ea_t startEA) { return 0; };
|
||||
virtual int segm_start_changed(segment_t *s) { return 0; };
|
||||
virtual int segm_end_changed(segment_t *s) { return 0; };
|
||||
virtual int segm_moved(ea_t from, ea_t to, asize_t size) { return 0; };
|
||||
virtual int byte_patched(ea_t /*ea*/) { return 0; };
|
||||
virtual int cmt_changed(ea_t, bool /*repeatable_cmt*/) { return 0; };
|
||||
virtual int ti_changed(ea_t /*ea*/, const type_t * /*type*/, const p_list * /*fnames*/) { msg("ti_changed hook not supported yet\n"); return 0; };
|
||||
virtual int op_ti_changed(ea_t /*ea*/, int /*n*/, const type_t * /*type*/, const p_list * /*fnames*/) { msg("op_ti_changed hook not supported yet\n"); return 0; };
|
||||
virtual int op_type_changed(ea_t /*ea*/, int /*n*/) { return 0; };
|
||||
virtual int enum_created(enum_t /*id*/) { return 0; };
|
||||
virtual int enum_deleted(enum_t /*id*/) { return 0; };
|
||||
virtual int enum_bf_changed(enum_t /*id*/) { return 0; };
|
||||
virtual int enum_renamed(enum_t /*id*/) { return 0; };
|
||||
virtual int enum_cmt_changed(enum_t /*id*/) { return 0; };
|
||||
virtual int enum_member_created(enum_t /*id*/, const_t cid) { return 0; };
|
||||
virtual int enum_member_deleted(enum_t /*id*/, const_t cid) { return 0; };
|
||||
virtual int struc_created(tid_t /*struc_id*/) { return 0; };
|
||||
virtual int struc_deleted(tid_t /*struc_id*/) { return 0; };
|
||||
virtual int struc_renamed(struc_t * /*sptr*/) { return 0; };
|
||||
virtual int struc_expanded(struc_t * /*sptr*/) { return 0; };
|
||||
virtual int struc_cmt_changed(tid_t /*struc_id*/) { return 0; };
|
||||
virtual int struc_member_created(struc_t * /*sptr*/, member_t * /*mptr*/) { return 0; };
|
||||
virtual int struc_member_deleted(struc_t * /*sptr*/, tid_t /*member_id*/) { return 0; };
|
||||
virtual int struc_member_renamed(struc_t * /*sptr*/, member_t * /*mptr*/) { return 0; };
|
||||
virtual int struc_member_changed(struc_t * /*sptr*/, member_t * /*mptr*/) { return 0; };
|
||||
virtual int thunk_func_created(func_t * /*pfn*/) { return 0; };
|
||||
virtual int func_tail_appended(func_t * /*pfn*/, func_t * /*tail*/) { return 0; };
|
||||
virtual int func_tail_removed(func_t * /*pfn*/, ea_t /*tail_ea*/) { return 0; };
|
||||
virtual int tail_owner_changed(func_t * /*tail*/, ea_t /*owner_func*/) { return 0; };
|
||||
virtual int func_noret_changed(func_t * /*pfn*/) { return 0; };
|
||||
virtual int segm_added(segment_t * /*s*/) { return 0; };
|
||||
virtual int segm_deleted(ea_t /*startEA*/) { return 0; };
|
||||
virtual int segm_start_changed(segment_t * /*s*/) { return 0; };
|
||||
virtual int segm_end_changed(segment_t * /*s*/) { return 0; };
|
||||
virtual int segm_moved(ea_t /*from*/, ea_t /*to*/, asize_t /*size*/) { return 0; };
|
||||
};
|
||||
|
||||
//</inline(py_idp)>
|
||||
|
@ -109,6 +109,7 @@ void refresh_lists(void)
|
||||
|
||||
%inline %{
|
||||
//<inline(py_kernwin)>
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
static PyObject *py_choose_idasgn()
|
||||
@ -437,6 +438,38 @@ class UI_Hooks(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
def saving(self):
|
||||
"""
|
||||
The kernel is saving the database.
|
||||
|
||||
@return: Ignored
|
||||
"""
|
||||
pass
|
||||
|
||||
def saved(self):
|
||||
"""
|
||||
The kernel has saved the database.
|
||||
|
||||
@return: Ignored
|
||||
"""
|
||||
pass
|
||||
|
||||
def get_ea_hint(self, ea):
|
||||
"""
|
||||
The UI wants to display a simple hint for an address in the navigation band
|
||||
|
||||
@param ea: The address
|
||||
@return: String with the hint or None
|
||||
"""
|
||||
pass
|
||||
|
||||
def term(self):
|
||||
"""
|
||||
IDA is terminated and the database is already closed.
|
||||
The UI may close its windows in this callback.
|
||||
"""
|
||||
pass
|
||||
|
||||
#</pydoc>
|
||||
*/
|
||||
class UI_Hooks
|
||||
@ -464,6 +497,22 @@ public:
|
||||
virtual void postprocess()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void saving()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void saved()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void term()
|
||||
{
|
||||
}
|
||||
virtual PyObject *get_ea_hint(ea_t /*ea*/)
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -798,6 +847,37 @@ int idaapi UI_Callback(void *ud, int notification_code, va_list va)
|
||||
case ui_postprocess:
|
||||
proxy->postprocess();
|
||||
break;
|
||||
|
||||
case ui_saving:
|
||||
proxy->saving();
|
||||
break;
|
||||
|
||||
case ui_saved:
|
||||
proxy->saved();
|
||||
break;
|
||||
|
||||
case ui_term:
|
||||
proxy->term();
|
||||
break;
|
||||
|
||||
case ui_get_ea_hint:
|
||||
{
|
||||
ea_t ea = va_arg(va, ea_t);
|
||||
char *buf = va_arg(va, char *);
|
||||
size_t sz = va_arg(va, size_t);
|
||||
char *_buf;
|
||||
Py_ssize_t _len;
|
||||
|
||||
PyObject *py_str = proxy->get_ea_hint(ea);
|
||||
if ( py_str != NULL
|
||||
&& PyString_Check(py_str)
|
||||
&& PyString_AsStringAndSize(py_str, &_buf, &_len) != - 1 )
|
||||
{
|
||||
qstrncpy(buf, _buf, qmin(_len, sz));
|
||||
ret = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Swig::DirectorException &e)
|
||||
|
25
swig/ua.i
25
swig/ua.i
@ -825,34 +825,13 @@ static void op_t_set_specflag4(PyObject *self, PyObject *value)
|
||||
//-------------------------------------------------------------------------
|
||||
insn_t *insn_t_get_clink(PyObject *self)
|
||||
{
|
||||
// Must have the link attribute
|
||||
if ( !PyObject_HasAttrString(self, S_CLINK_NAME) )
|
||||
return NULL;
|
||||
|
||||
insn_t *insn;
|
||||
PyObject *attr = PyObject_GetAttrString(self, S_CLINK_NAME);
|
||||
if ( PyCObject_Check(attr) )
|
||||
insn = (insn_t *) PyCObject_AsVoidPtr(attr);
|
||||
else
|
||||
insn = NULL;
|
||||
Py_DECREF(attr);
|
||||
return insn;
|
||||
return (insn_t *)pyobj_get_clink(self);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
op_t *op_t_get_clink(PyObject *self)
|
||||
{
|
||||
// Must have the link attribute
|
||||
if ( !PyObject_HasAttrString(self, S_CLINK_NAME) )
|
||||
return NULL;
|
||||
op_t *r;
|
||||
PyObject *attr = PyObject_GetAttrString(self, S_CLINK_NAME);
|
||||
if ( PyCObject_Check(attr) )
|
||||
r = (op_t *) PyCObject_AsVoidPtr(attr);
|
||||
else
|
||||
r = NULL;
|
||||
Py_DECREF(attr);
|
||||
return r;
|
||||
return (op_t *)pyobj_get_clink(self);
|
||||
}
|
||||
|
||||
//</code(py_ua)>
|
||||
|
Loading…
Reference in New Issue
Block a user