Code Monkey home page Code Monkey logo

hrdevhelper's Introduction

HRDevHelper

HRDevHelper is an extension for the Hexrays decompiler written in IDAPython and is meant to be a helpful tool for debugging and developing your own Hexrays plugins and scripts. The plugin draws its usefulness from displaying a graph of a decompiled function's respective ctree and creating visual links between its underlying decompiled code and the graphs' individual items.

HRDevHelper animated gif

When invoked, HRDevHelper creates and attaches a ctree graph to the currently active decompiler widget and centers the graph's view on the current ctree item. Subsequently navigating the decompiled code visually highlights corresponding ctree items in the graph.

The plugin's default colors and other settings (zoom, dock position etc.) can be configured by editing the plugin's configuration file that is created after running the plugin for the first time. The HRDevhelper.cfg configuration file can be found in the IDA user directory.

Installation

Copy hrdevhelper.py and the hrdh folder to ./IDA/plugins/ and restart IDA.

Plugin Usage & Shortcuts

The plugin's functionality is accessible via right-click in a decompiler view or otherwise via keyboard shortcuts:

  • "show ctree" creates a graph of all ctree items of the current decompiled function.
  • "show sub-tree" creates a graph of ctree items that belong to the current expression. The subgraph's root is determined via the current decompiler view's text cursor.
  • "show context" opens a context viewer that, among other information, displays the current sub-tree's citems as a lambda expression. This expression can be used with and directly copy-pasted into hxtb-shell that comes with the HexraysToolbox script.

By default, HRDevHelper visually highlights all ctree items in a graph that correspond to a current single decompiled line of code. Making a selection of multiple lines highlights nodes accordingly.

The two screenshots below show the context viewer.

HRDevHelper context view

HRDevHelper context view

In addition to the keyboard shortcuts that are made available in decompiler views, the graphs created by HRDevHelper have additional keyboard shortcuts in place as shown below.

Graph Hotkeys (focus on any HRDevHelper graph/subgraph):

  • C: Toggle "center on current item/node" functionality (switches synchronization on/off).
  • D: Increase debug/verbosity of particular nodes

hrdevhelper's People

Contributors

faty42 avatar jonpalmisc avatar patois avatar stevemk14ebr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hrdevhelper's Issues

Failed when running this plugin

Hello, when I load this plugin through the hotkey or Edit menu, this issue occurs on both IDA7.5(Win10) and IDA7.5(MacOS). I tried to find it out but it seems to related to a config file?

Error in OnGetText

Hi sir,

I got this error message in Output. The bug triggered once I activated HRDevHelper then browsed a sub call in a function.

IDAPython: Error while calling Python callback <OnGetText>:
Traceback (most recent call last):
  File "HRDevHelper.py", line 483, in OnGetText
    return self[node_id]
  File "ida_graph.py", line 2609, in __getitem__
    raise KeyError
KeyError
WARNING: It appears the graph_viewer_t instance is changing its
WARNING: textual/color data without calling refresh() afterwards.
WARNING: In order to provide backwards-compatibility, IDA will
WARNING: still consider the new data, but later versions of IDA
WARNING: will likely not. Please consider calling refresh_viewer()
WARNING: (or the Refresh() method if you are using IDAPython)
WARNING: after changes occur in the data.
IDAPython: Error while calling Python callback <OnGetText>:
Traceback (most recent call last):
  File "HRDevHelper.py", line 483, in OnGetText
    return self[node_id]
  File "ida_graph.py", line 2609, in __getitem__
    raise KeyError
KeyError

TypeError: unhashable type: 'cinsn_t' in IDA 7.4

Hello,

I tried to use your plugin in IDA 7.4 and I encountered the error TypeError: unhashable type: 'cinsn_t' at the line 338 of the code when pressing the shortcut to launch the plugin.

Here is the faulting function:

HRDevHelper/hrdevhelper.py

Lines 328 to 339 in 909249c

def add_node(self, i):
for k in self.reverse.keys():
if i.obj_id == k.obj_id:
ida_kernwin.warning("bad ctree - duplicate nodes! (i.ea=%x)" % i.ea)
return -1
n = self.cg.add_node()
if n <= len(self.cg.items):
self.cg.items.append(i)
self.cg.items[n] = i
self.reverse[i] = n
return n

As the issue is linked to cinsn_t, I looked for a change in hexrays.hpp and I suspect this is probably because they added the line DECLARE_TYPE_AS_MOVABLE(cinsn_t) between the 7.3 and 7.4.

Do you have any hints about that?

Thanks !

interr 51058

Calling GraphView.Refresh() from within hook causes interr 51058

Can not use in IDA8 python3.6

log

D:\soft\IDA8\plugins\hrdevhelper.py: module 'hrdh' has no attribute 'handler'
Traceback (most recent call last):
  File "D:\soft\IDA8\python\3\ida_idaapi.py", line 580, in IDAPython_ExecScript
    exec(code, g)
  File "D:/soft/IDA8/plugins/hrdevhelper.py", line 10, in <module>
    import hrdh.handler as handler
  File "D:/soft/IDA8/plugins\hrdh\handler.py", line 7, in <module>
    from hrdevhelper import HRDevHelper
  File "D:/soft/IDA8/plugins\hrdevhelper.py", line 10, in <module>
    import hrdh.handler as handler
AttributeError: module 'hrdh' has no attribute 'handler'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.