There are no reviews yet. Be the first to send feedback to the community and the maintainers!
Milan's useful functions for Hex-Rays decompiler ================================================ New hexrays features: Assist in creation of new structure definitions / virtual calls detection =========================================================================== 1) use "Reset pointer type" on all variables that you want to scan. 2) Select one of these variables and choose "Scan variable (S)" Plugin deals with simple assignments "v1 = this;" automatically. 3) Again right click on such variable and choose open structure builder. Ajdust the structure to your likings. In Structure builder you can open a list of functions you scanned so far and functions that were added from virtual function tables. Open some of the functions and scan other variables that are of the same type. Be carefull there is no undo yet. As you gather more evidence structure builder will show you guessed substructure sizes and guessed types. Colliding types have yellow background. Use delete to solve the ambiguity. With red colour is marked current master offset into structure being created. Use "*" to change master offset. But you should not need this too often, because basic situations are detected automatically. This deals with nested structures: struct aa { int foo; } struct bb { int foo; } struct cc { aa a; bb b; } void foo(struct *b) { b->foo=4;//while scanning b you should have master offset set to 4 } void bar(struct *cc) { c->a.foo=5; foo(&c->b); } substructures ------------- use "+" and "-" on numeric keyboard to shift parts of the structure. Then use "pack substruct" to build substructures before finishing the structure. 4) Click on some variable in pseudocode and choose "finalize structure" You will be given a window with "C" declaration of the new structure that you can tweak by hand and then the new type will by assigned to all variables you have scanned. Job done! Jump directly to virtual function or structure member definition ================================================================== A class is any structure (A) that has as a pointer into another structure (A_VT). Where A_VT has a STRUCT comment containing address of the virtual table and "@0x". Gives list of structures with given size, with given offset ======================================================================== Right clicking on any number in hexrays view. There are two new items in the menu: Which structs have this offset? Which structs have this size? This will give you list of structures having exact size or this offset (even in substructures); Finds structures with same "shape" as is used. ============================================= Imagine there are structures like this: 00000000 ; --------------------------------------------------------------------------- 00000000 one struc ; (sizeof=0x8, standard type) 00000000 vfptr dd ? ; offset 00000004 x dd ? 00000008 one ends 00000000 ; --------------------------------------------------------------------------- 00000000 two struc ; (sizeof=0x8) ; XREF: three�r three�r 00000000 baseclass_0 one ? 00000008 two ends 00000008 00000000 ; --------------------------------------------------------------------------- 00000000 two struc ; (sizeof=0x8) ; XREF: three�r three�r 00000000 baseclass_0 one ? 00000008 two ends 00000000 ; --------------------------------------------------------------------------- 00000000 00000000 three struc ; (sizeof=0x70) ; XREF: four::four(void)+29�r 00000000 ; four::four(void)+2A�r ... 00000000 baseclass_0 two ? 00000008 a one ? 00000010 b two ? 00000018 c dd 20 dup(?) 00000068 d dd ? 0000006C e dd ? 00000070 three ends 00000070 00000000 ; --------------------------------------------------------------------------- 00000000 00000000 four struc ; (sizeof=0xCC) ; XREF: four::four(void)+3C�r 00000000 ; four::four(void)+43�r ... 00000000 baseclass_0 three ? 00000070 a dd ? 00000074 b dd ? 00000078 c dd 20 dup(?) 000000C8 d dd ? 000000CC four ends And you come across a code like this: void __thiscall four::four(int this) { int v1; // esi@1 v1 = this; *(_DWORD *)(this + 4) = 5; *(_DWORD *)(this + 12) = 5; *(_DWORD *)(this + 8) = &one::`vftable'; *(_DWORD *)(this + 20) = 5; *(_DWORD *)(this + 16) = &two::`vftable'; *(_DWORD *)(this + 104) = 0; *(_DWORD *)(this + 108) = 0; memset((void *)(this + 24), 32, 0x50u); *(_DWORD *)v1 = &four::`vftable'; *(_DWORD *)(v1 + 112) = 0; *(_DWORD *)(v1 + 116) = 0; *(_DWORD *)(v1 + 200) = 0; memset((void *)(v1 + 120), 33, 0x50u); } Right click on either "v1" or "this" and choose "recognize shape (T)". The plugin will show you that the only structure that matches this shape is "four". See virtual_calls_4.idb. convert function to __usercall or __userpurge =============================================================== Once I dealt with project that mixed Delphi and Visual C++. These two uses different registers for thiscall/fastcall etc so changing compiler resulted in ruining analysis. So I made this functionality to deal with it forever. Just right click on first line of pseudocode and choose "Convert to __usercall". removes function's return type making it void fnc(...) =============================================================== Sometimes function does not return any value but hex-rays thinks it does. It was very tiresome to type "home, y, home, ctrl-shift-left, "void", enter" so I made Ida do it on one click. Just right click on first line of pseudocode and choose "Remove return type" or type 'R'. Adds Classes on top of structures =============================================================== menu View / Open Subviews / Classes Now just list of "interesting" structures inside database along with their functions. Automatically zero certain variables in hexrays output =============================================================== Sometimes in pseudocode there is variable that gets assigned zero and is never changed. This feature propagates this zero to all places where this variable was. The rules are: """ zeroizer.cpp variable is assigned zero variable is never referenced warn if variable is on stack replace every such variable with zero """ Works automatically. Deals with structures with negative offsets =========================================== see test2_negative_offsets.idb @004010B0 Without my plugin: void __cdecl test3(pokusx *p) { *(_DWORD *)&p[-1].array[19996] = 124; p[-1].k = 666; } With my plugin: void __cdecl test3(pokusx *p) { container_of(p, 8)->a = 124; container_of(p, 8)->cc = 666; } Removes function arguments ========================== Sometimes hexrays thinks that a register is used as an argument for a function but it isn't so. It was also tiresome to type "home, home, y, ctrl->right, ctrl-shift-right, delete, enter" So I made this to deal with it. Just select that argument in the first line of pseudocode and choose "Remove this argument" or type 'A'. Assists with changing types of structure members and variables =============================================================== Imagine you have pseudocode like this. CASE 1: { type1 v1; type2 v2 v2 = (type2)v1; } right click on "v2" in the last line and choose "recast item" v2 will be converted to type "type2"; CASE 2: you have type declarations: struct object { struct vtable *v; } struct vtable { int fnc1; int fnc2; } and there is code like this in pseudocode: struct object * this; (void (__thiscall *)(object *)this->v->fnc1)(this); righ clicking on fnc1 and choosing "Recast item" will change type of "vtable.fnc1" to "void (__thiscall *)(object *)". Now suppose there is virtual table for object at address 0xABCDEF. Setting STRUCT comment for "struct vtable" as something containing "@0xABCDEF" (crucial part is "@0x" ) enables my plugin to navigate to functions located at 0xABCDEF. But setting this by hand is seldom needed because structure builder takes care of this automatically. Dealing with delphi classes =========================== Also there is experimental code for dealing with delphi classes. In menu Edit / Structs / Create Delphi class. The cursor must be on first line of delphi class in ida-view before using this functionality. warning: This feature is highly experimental. New functionality in Structures view ==================================== Use right click in Structures view. Extract object -------------- Select few lines in a structure and it will create a new structure off selected lines. Unpack object ------------- Does the opposite of Extract object. It in place unpacks selected structure. Which structure matches here? ----------------------------- It will try to guess which structure has the right offsets and types that can matche selected lines in Structures view. Add to classes -------------- Promotes a structure to a class. Add VT ------ Adds virtual table to a structure. It asks for address to a virtual table. Then this happens: 00000000 struc_1 struc ; (sizeof=0x10) 00000000 field_0 dd ? 00000004 field_4 dd ? 00000008 field_8 dd ? 0000000C field_C dd ? 00000010 struc_1 ends ---> 00000000 struc_1 struc ; (sizeof=0x10) 00000000 VT dd ? ; offset 00000004 field_4 dd ? 00000008 field_8 dd ? 0000000C field_C dd ? 00000010 struc_1 ends 00000010 00000000 ; --------------------------------------------------------------------------- 00000000 00000000 ; @0x004047B0 00000000 struc_1_VT struc ; (sizeof=0x10) 00000000 sub_40101E dd ? ; sub_40101E 00000004 j___RTC_NumErrors dd ? ; j___RTC_NumErrors 00000008 sub_401023 dd ? ; sub_401023 0000000C sub_401073 dd ? ; sub_401073 00000010 struc_1_VT ends the type of "struc_1.VT" is "struc_1_VT*" When asked for vtableaddress I gave it 0x004047B0. This enables jumps in hexrays to virtual function. IDC functionality ================= my plugins add these idc functions: reset_alt_calls --------------- I messed up my idb database and this was a cure: static void reset_alt_calls(ea_t ea) { static const char * nname; if ( ph.id == PLFM_MIPS ) nname = "$ mips"; else if ( ph.id == PLFM_ARM ) nname = " $arm"; else nname = "$ vmm functions"; netnode n(nname); for(nodeidx_t idx= n.alt1st(); idx != BADNODE; idx = n.altnxt(idx)) { if(n.altval(idx)-1 == ea) { n.altdel(idx); noUsed(idx); // reanalyze the current instruction recalc_spd(idx); } //n.altdel_all(atag); } } structs_of_size(num) ------------------- Just calls "Which structure has size num?". Graph of structures inside structures. ====================================== structures_graph_0.png, see structures_graph.png menu View/graphs/show structures graph Milan Bohacek
ScyllaHide
IDA_Signsrch
IDA SignsrchIDA-IDC-Scripts
Varoius IDC-scripts I've collected during the years.idastealth
IDA_ClassInformer
IDA ClassInformer PlugInGUID-Finder
IDASimulator
IDASimulator is a plugin that extends IDA's conditional breakpoint support, making it easy to augment / replace complex executable code inside a debugged process with Python code. Specifically, IDASimulator makes use of conditional breakpoints in the IDA debugger to hijack the execution flow of a process and invoke Python handler functions whenever particular code blocks are executed. With support for multiple target architectures, it handles details such as register initialization, memory allocation, pointers, function arguments and return values seamlessly and transparently, making it easy to replace, modify and subvert existing functionality (or lack thereof) in the target process. IDASimulator also includes the IDASim python module, on which IDASimulator is based. This allows for all of the features of IDASimulator to be integrated into more complex IDAPython scripts. IDASimulator currently supports the x86, x86_64, ARM and MIPS32 architectures. Porting to other architectures is very easy.ida-pro-swf
IDA_FunctionStringAssociate_PlugIn
IDA FunctionStringAssociate PlugInidascope
IDA_COM_Plugin
Fast_IDB2Sig_and_LoadMap_IDA_plugins
optimice
arm-thumb-decompiler-plugin
IDA_Extrapass
IDA ExtraPass PlugInidapathfinder
IndirectCalls
detpdb
desquirr
idatools
Tools for IDAIDAProBoschME7
Siemens Bosch ME7.x Disassembler Helper for IDA Proida-x86emu-QT
bios_parse
PPCAltivec
idaplugs
Plugins for IDA Pro by serviluberstealth
IDA2PAT_Reloaded
turbodiff
CommentViewer
patchdiff3
Continuation of the popular patchdiff IDA pluginRECPP
RECPP is a IDA plugin / API for reversing C++ applications based on Igor Skochinsky articles and scripts (http://www.openrce.org/articles/full_view/21)idastruct
jeb2-plugin-macho
Mach-O Object Plugin for JEB2 https://www.pnfsoftware.comHeapTracer
ida-libbfd-loader
IDA Pro libbfd based loader for misc formats that IDA cannot handle, like IRIX ECOFF etc.bflt-utils
ida-plugins-collection
ida-unicode-string-convert
WhatAPIs
IDA WhatAPIs PlugInida-sync-plugin
ida-pro-plugin-wizard-for-vs2013
StructDump
axis-cris-idp
IDA Pro CPU plugin for the AXIS CRIS architecturearm-helper
IDA-CC
http://forum.exetools.com/showthread.php?t=13569&page=3idainject
binarydiffer
garmin-ida-loader
processstalker
Cypress-M8-IDA-Processor-Module
analyzecore
IDA-omf2pat
IDA FLAIR helpers for making .SIG files from Borland sources by servilIDA-rails
IDA-pinlog
findStrcpy
fujitsu-fr30-idp
IDA Pro CPU plugin for the Fujitsu FR30 architecturecyrplw
findMemcpy
bignum-dumper
findMalloc
get-asm-code
Automated-Generic-Function-Naming
MIPSJT
MIPS JT fixup for IDA PROrsrcExtractor
IdaThingy
ppc2
krypton
gerbay1
ida-dbdump
tree-cbass
ida-x86emu
IDAWinHelpViewer
depload
ppchelper
ida_objectivec_plugins
IDA_MarkRefCnt
IDA MarkRefCount PlugInidaplugininfo
This is a little utility to dump information about installed IDA Pro plugins. The key parts of the IDA PLUGIN export "plugin_t" struct data.REDB
IDA_WaitBoxEx
IDA WaitBoxExCopyAndPast
Binary Copy and Pasteidaocaml
idapatchwork
https://bitbucket.org/daniel_plohmann/idapatchworkncoverage
ida_load_all_dump_load
IDA-auto-declaration
IDA PRO plugin for automatic type declaration like char, byte, float, double wchar etc...vctaxo
malflare
ParseBinTree
take IDA PRO memory lines and print binary tree node.IDACSharp
C# 'Scripts' for IDA 6.6+ based on https://idacsharp.codeplex.com/mynav
wwcd2
Ida pro What Would Capstone Decode by Stefan EsserHotch
rails
ida-vs2005templates
classinformer
https://sourceforge.net/projects/classinformer/ partially adapted for ida64ida_plugin_depack_aplib_and_lzma
CLU
idastruct-1
Script helper in working with ida structuresCOSA-IDA
Comprehensive Static Analyzer For Android Application (COSA with IDA Pro)lltd-osx
LLTD (LLD2D) for OS XLove Open Source and this site? Check out how you can help us