| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Plugin for IDA Pro
Table of Contents
Most of the changes for IDA 9 compatibility, mine and from other people, have been added to the code. Now it need to test and fish out the remaining porting issues.
It's my fork of plugin with tuning for my convenience of work. Changes:
Pulled some changes from https://github.com/sabason/HexRaysPyTools, https://github.com/NyaMisty/HexRaysPyTools, https://github.com/oopsmishap/HexRaysPyTools and https://github.com/mahmoudimus/HexRaysPyTools
You can read about it here Fork features
=====
The plugin assists in the creation of classes/structures and detection of virtual tables. It also facilitates transforming decompiler output faster and allows to do some stuff which is otherwise impossible.
Note: The plugin supports IDA Pro 7.x with Python 2/3.
Copy HexRaysPyTools.py file and HexRaysPyTools directory to $IDAUSR/plugins directory.
Install the plugin requirements found in the requirements.txt file. Be sure to install these for the Python environment used by your IDA installation.
Can be found at $IDAUSR\cfg\HexRaysPyTools.cfg
Most of the features can be enabled/disabled via the added configuration window.
To switch a feature, double-click on the selected one.
A vtable can be created either from pseudocode (via a pointer to a global variable) or from an address in the disassembly.
It is created info in a netnode, a store inside the IDB, where, for each method in each table, the function’s offset from the table base is stored. As a result, you can always jump to a method’s code—for example, by double-clicking in pseudocode. Or via Jump to method function action in Local Types window

You can create a struct of a given size and fill it with fields of fixed widths (1, 2, 4, 8 bytes). You can set alignment. You can specify a base class.
Click at number to set the field size.
Because each method entry is mapped to its function, names stay in sync. Renaming a method in a vtable renames all other entries pointing to the same function, and renames the function itself. Renaming a function renames all method entries across all vtables that reference it.

Walks the AST to determine the exact type to apply (not perfect, but better than the original). Handles cases like Byte2(struct->field).

something* → p_something
Something* → pSomething
The reconstruction process usually comprises the following steps:
Now, a few more details.
The place where all the collected information about the scanned variables can be viewed and modified. Ways of collecting information:
Structure builder stores collected information and enables interaction:
Buttons serve the following purpose:
Finalize - opens a window with an editable C-like declaration and assigns new types to all scanned variables.
Disable, Enable - are used for collision resolution.
Origin - switches the base offset which is used to produce new fields to structure (this value will be added to every offset of a newly-scanned variable, default = 0).
Array - renders a selected field as an array the size of which is automatically calculated.
Pack - creates and substitutes a substructure for selected items (collisions for these items should be resolved).
Unpack - dismembers a selected structure and adds all its fields to the builder.
Load - loads a predefined type that is loaded into IDA into the structure builder.
Remove - removes the information about selected fields.
Clear - clears all.
Recognize Shape - looks for appropriates structure for selected fields.
Resolve Conflicts (new) - attempts to disable less meaningful fields in favor of more useful ones. (char > _BYTE, SOCKET > _DWORD etc). Doesn't help to find arrays.
Templated Types View - switches the templated types view
Structure View - switches to the structure builder view
With HexRaysPyTools, every time the F5 button is pressed and code is decompiled, the information about addressing to fields is stored inside cache. It can be retrieved with the "Field Xrefs" menu. So, it is better to apply reconstructed types to as many locations as possible to have more information about the way structures are used.
Note: IDA 7.4 has now an official implementation of this feature, available through Shift-X hotkey.
Warning!! Very raw feature. The idea is to help find where a variable came from so as to run Deep Scan Process at the very top level and not to skip large amounts of code.
Usage:
Helps find a suitable structure by the information gleaned from pseudocode after variable scanning.
Usage:
The templated types view allows you to easily define and propagate templated types such as the data types you find within STL.
Type List - list of the loaded types, click on the type you want to set to populate the middle form.
Selected Type - each templated typename has two fields, Type & Name. The Type field is the actual type that will be defined, this has to be a real type, as it will throw an error if it is not. The Name field is used to create an unique typename for the templated type.
Creating Type - a live output of the types you will set.
Reload Templated Types TOML - if you have edited the current TOML file you will have to reload the list.
Open Templated Types TOML - open your own custom templated types TOML following the templated types structure
Before:
After
["std::vector<T>"]
base_name = "std_vector_{1}"
types = ["T"]
struct = """
struct std_vector_{1}
{{
{0} *_Myfirst;
{0} *_Mylast;
{0} *_Myend;
}};
""" Class Name - pretty type name, this is used as dictionary key and in the types list (["std::vector<T>"])
Base Name - - name used for IDA's structs as we cannot use ::, format identifiers for type name, these are always odd numbers (Note: this must match the base structure name within struct string)
Types - define the types here as a list of strings, each type will have 2 format specifier tokens
Struct - this is where you define the struct, format specifiers work as the following:
Helps find containing structure and makes code prettier by replacing pointers with CONTAINING_RECORD macro
Before:
After:
Usage:
If a variable is a structure pointer and there's an access to outside of the boundaries of that structure, then:
Every time you have two sides in an expression, where each side may be a local or global variable, argument or return value of the function signature, it is possible to right-click or press the hotkey to give both sides of the expression similar types. Below, there is the table of possible conversions:
| Original | Shift+L | Shift+R |
|---|---|---|
| var = (TYPE) expr | var type -> TYPE | |
| exp = (TYPE) var | var type -> TYPE | |
| function(..., (TYPE) var, ...) | functions' argument -> TYPE | var type -> TYPE |
| (TYPE) function(...) | functions' return type -> TYPE | |
| return (TYPE) var | functions' return type -> TYPE | var type -> TYPE |
| struct.field = (TYPE) var | type(field) -> TYPE | |
| pstruct->field = (TYPE) var | type(field) -> TYPE |
When you have an expression like function(..., some_good_name, ...), you can rename function parameter.
When you have an expression like function(..., v12, ...), and function has an appropriate parameter name, you can quickly apply this name to the variable.
Also possible to rename vXX = v_named into _v_named = v_named and vice versa.
And there's a feature for massive renaming functions using assert statements. If you find a function that looks like an assert, right-click the string argument with the function name and select "Rename as assert argument". All the functions where a call to assert statement has happened will be renamed (provided that there is no conflicts, either way, you'll see the warning in the output window)
This feature does the same recursive traversal over functions as the Deep Scan Variable does. But this time, all elements that have a connection with the selected one receive its name. It’s possible to rename it or use names of both local and global variables, as well as structure members. By default, the plugin propagates names only over default names like v1, a2. See Configuration in order to change that.
Before:
...
if (condition) {
statement_1;
statement_2;
...
return another_value;
}
return value;After:
...
if (opposite_condition) {
return value;
}
statement_1;
statement_2;
...
return another_value; // if 'then' branch has no return, than `return value;`Also, it can be found at View->Open Subview->Classes. Helps to manage classes (structures with virtual tables).
Class, virtual tables, and functions names are editable. Also a function's declaration can be edited. After editting, the altered items change font to italic. Right click opens the following menu options:
You can also filter classes using Regexp either by class_name or by existence of specific functions. Simply input an expression in line edit for filtering by class_name or prepend it with "!" to filter by function name.
Shows relationship between structures:
Also: dark green node is union, light green - enum.
Usage:
Under construction
| Back | FazBrowse Home | New Git URL |