Home

Awesome

<img width="150" height="150" align="left" style="float: left; margin: 0 10px 0 0;" alt="rz-retdec logo" src="https://raw.githubusercontent.com/rizinorg/rz-retdec/dev/doc/rz-retdec.svg">

rz-retdec

RetDec plugin for Rizin.

The plugin integrates RetDec decompiler into Rizin console. rz-retdec is shipped with a bundled RetDec version, but you can use your own version (specified below).

With the bundled version of RetDec you can decompile the following architectures:

Use in Rizin Console

In rizin console you can type pdz? to print help:

Usage: pdz   # Native RetDec decompiler plugin.
| pdz      # Show decompilation result of current function.
| pdz*     # Show current decompiled function side by side with offsets.
| pdza[?]  # Run RetDec analysis.
| pdze     # Show environment variables.
| pdzj     # Dump current decompiled function as JSON.
| pdzo     # Show current decompiled function side by side with offsets.

The following environment variables may be used to dynamically customize the plugin's behavior:

$ export DEC_SAVE_DIR=<path> # custom path for output of decompilation to be saved to.

Build and Installation

This section describes a local build and installation of rz-retdec.

Requirements

To build the bundled version of RetDec see RetDec requirements section.

Process

You have to pass the following parameters to cmake:

You can pass the following additional parameters to cmake:

Note: rz-retdec requires filesystem library to be linked with the plugin. CMake will try to find the library in the system but on GCC 7 it might not be able to do so automatically. In that case you must specify a path where this library is located in the system to the cmake by adding:

On GCC 7 is stdc++fs located in:

License

rz-retdec Copyright (c) 2022 RizinOrg

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://www.gnu.org/licenses/.

rz-retdec uses third-party libraries or other resources that may be distributed under licenses different than this software.

In the event that we accidentally failed to list a required notice, please bring it to our attention by contacting the repository owner.

RetDec r2plugin uses the following third-party libraries or other resources:

  1. RetDec: https://github.com/avast/retdec Copyright (c) 2017 Avast Software, MIT license
  2. retdec-r2plugin: https://github.com/avast/retdec-r2plugin Copyright (c) 2020 Avast Software, MIT license