update to ida 7.6, add builds
This commit is contained in:
52
idasdk76/plugins/script_plg/idcplugin.idc
Normal file
52
idasdk76/plugins/script_plg/idcplugin.idc
Normal file
@@ -0,0 +1,52 @@
|
||||
#include <idc.idc>
|
||||
|
||||
class myplugmod_t
|
||||
{
|
||||
myplugmod_t()
|
||||
{
|
||||
this.wanted_name = "Sample IDC plugin";
|
||||
}
|
||||
run(arg)
|
||||
{
|
||||
msg("%s: run() has been called with %d\n", this.wanted_name, arg);
|
||||
return (arg % 2) == 0;
|
||||
}
|
||||
~myplugmod_t()
|
||||
{
|
||||
msg("%s: unloaded\n", this.wanted_name);
|
||||
}
|
||||
}
|
||||
|
||||
class myplugin_t
|
||||
{
|
||||
myplugin_t()
|
||||
{
|
||||
this.flags = PLUGIN_MULTI;
|
||||
this.comment = "This is a sample IDC plugin";
|
||||
this.help = "This is help";
|
||||
this.wanted_name = "Sample IDC plugin";
|
||||
this.wanted_hotkey = "Alt-F6";
|
||||
}
|
||||
|
||||
init()
|
||||
{
|
||||
msg("%s: init() has been called\n", this.wanted_name);
|
||||
return myplugmod_t();
|
||||
}
|
||||
|
||||
run(arg)
|
||||
{
|
||||
msg("%s: ERROR: run() has been called for global object!\n", this.wanted_name);
|
||||
return (arg % 2) == 0;
|
||||
}
|
||||
|
||||
term()
|
||||
{
|
||||
msg("%s: ERROR: term() has been called (should never be called)\n", this.wanted_name);
|
||||
}
|
||||
}
|
||||
|
||||
static PLUGIN_ENTRY()
|
||||
{
|
||||
return myplugin_t();
|
||||
}
|
||||
9
idasdk76/plugins/script_plg/makefile
Normal file
9
idasdk76/plugins/script_plg/makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
include ../../allmake.mak
|
||||
|
||||
SCRIPTS += idcplugin.idc
|
||||
SCRIPTS += pyplugin.py
|
||||
SCRIPTS += procext.py
|
||||
|
||||
include ../script_plg.mak
|
||||
|
||||
69
idasdk76/plugins/script_plg/procext.py
Normal file
69
idasdk76/plugins/script_plg/procext.py
Normal file
@@ -0,0 +1,69 @@
|
||||
import idaapi
|
||||
|
||||
mymnem = "linux_kernel_call"
|
||||
|
||||
"""
|
||||
This is a sample plugin for extending processor modules
|
||||
|
||||
It extends the IBM PC processor module to disassemble
|
||||
"int 80h"
|
||||
as
|
||||
"%s"
|
||||
|
||||
for ELF files
|
||||
|
||||
(c) Hex-Rays
|
||||
""" % mymnem
|
||||
|
||||
NN_kernel_call = idaapi.CUSTOM_INSN_ITYPE
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
class linux_idp_hook_t(idaapi.IDP_Hooks):
|
||||
def __init__(self):
|
||||
idaapi.IDP_Hooks.__init__(self)
|
||||
|
||||
def ev_ana_insn(self, insn):
|
||||
if idaapi.get_bytes(insn.ea, 2) != b"\xCD\x80":
|
||||
return False
|
||||
insn.itype = NN_kernel_call
|
||||
insn.size = 2
|
||||
return True
|
||||
|
||||
def ev_out_mnem(self, outctx):
|
||||
if outctx.insn.itype != NN_kernel_call:
|
||||
return 0
|
||||
outctx.out_custom_mnem(mymnem)
|
||||
return 1
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
class linuxprocext_t(idaapi.plugin_t):
|
||||
# Processor fix plugin module
|
||||
flags = idaapi.PLUGIN_PROC | idaapi.PLUGIN_HIDE
|
||||
comment = ""
|
||||
wanted_hotkey = ""
|
||||
help = "Replaces int 0x80 with %s" % mymnem
|
||||
wanted_name = mymnem
|
||||
|
||||
def init(self):
|
||||
self.prochook = None
|
||||
if idaapi.ph_get_id() != idaapi.PLFM_386 or idaapi.cvar.inf.filetype != idaapi.f_ELF:
|
||||
print("linuxprocext_t.init() skipped!")
|
||||
return idaapi.PLUGIN_SKIP
|
||||
|
||||
self.prochook = linux_idp_hook_t()
|
||||
self.prochook.hook()
|
||||
|
||||
print("linuxprocext_t.init() called!")
|
||||
return idaapi.PLUGIN_KEEP
|
||||
|
||||
def run(self, arg):
|
||||
pass
|
||||
|
||||
def term(self):
|
||||
print("linuxprocext_t.term() called!")
|
||||
if self.prochook:
|
||||
self.prochook.unhook()
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
def PLUGIN_ENTRY():
|
||||
return linuxprocext_t()
|
||||
34
idasdk76/plugins/script_plg/pyplugin.py
Normal file
34
idasdk76/plugins/script_plg/pyplugin.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import ida_idaapi, ida_kernwin
|
||||
|
||||
class myplugmod_t(ida_idaapi.plugmod_t):
|
||||
def __del__(self):
|
||||
ida_kernwin.msg("unloaded myplugmod\n")
|
||||
|
||||
def run(self, arg):
|
||||
ida_kernwin.msg("run() called with %d!\n" % arg)
|
||||
return (arg % 2) == 0
|
||||
|
||||
class myplugin_t(ida_idaapi.plugin_t):
|
||||
flags = ida_idaapi.PLUGIN_UNL | ida_idaapi.PLUGIN_MULTI
|
||||
comment = "This is a sample Python plugin"
|
||||
help = "This is help"
|
||||
wanted_name = "Sample Python plugin"
|
||||
wanted_hotkey = "Alt-F8"
|
||||
|
||||
#def __del__(self):
|
||||
#ida_kernwin.msg("unloaded globally\n")
|
||||
|
||||
def init(self):
|
||||
ida_kernwin.msg("init() called!\n")
|
||||
return myplugmod_t()
|
||||
|
||||
def run(self, arg):
|
||||
ida_kernwin.msg("ERROR: run() called for global object!\n")
|
||||
return (arg % 2) == 0
|
||||
|
||||
def term(self):
|
||||
ida_kernwin.msg("ERROR: term() called (should never be called)\n")
|
||||
|
||||
def PLUGIN_ENTRY():
|
||||
return myplugin_t()
|
||||
|
||||
Reference in New Issue
Block a user