avast-tl / retdec
- четверг, 14 декабря 2017 г. в 03:14:33
RetDec is a retargetable machine-code decompiler based on LLVM.
RetDec is a retargetable machine-code decompiler based on LLVM.
The decompiler is not limited to any particular target architecture, operating system, or executable file format:
Features:
Currently, we support only Windows and Linux.
Either download and unpack a pre-built package from the following list, or build and install the decompiler by yourself (the process is described below):
Install Microsoft Visual C++ Redistributable for Visual Studio 2015.
Install MSYS2 and other needed applications by following RetDec's Windows environment setup guide.
Now, you are all set to run the decompiler. To decompile a binary file named test.exe
, go into $RETDEC_INSTALLED_DIR/bin
and run:
bash decompile.sh test.exe
For more information, run bash decompile.sh --help
.
There are currently no pre-built packages for Linux. You will have to build and install the decompiler by yourself. The process is described below.
After you have built the decompiler, you will need to install the following packages via your distribution's package manager:
Now, you are all set to run the decompiler. To decompile a binary file named test.exe
, go into $RETDEC_INSTALLED_DIR/bin
and run:
./decompile.sh test.exe
For more information, run ./decompile.sh --help
.
This section describes a manual build and installation of RetDec.
PATH
, or it has to be provided to CMake using CMAKE_PROGRAM_PATH
variable, e.g. -DCMAKE_PROGRAM_PATH=/c/perl/bin
.Warning: Currently, RetDec has to be installed into a clean, dedicated directory. Do NOT install it into /usr
, /usr/local
, etc. because our build system is not yet ready for system-wide installations. So, when running cmake
, always set -DCMAKE_INSTALL_PREFIX=<path>
to a directory that will be used just by RetDec. For more details, see #12.
git clone --recursive https://github.com/avast-tl/retdec
cd retdec
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=<path>
make && make install
msbuild
command.cd retdec
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=<path> -G<generator>
msbuild /m /p:Configuration=Release retdec.sln
msbuild /m /p:Configuration=Release INSTALL.vcxproj
retdec.sln
generated by cmake
in Visual Studio IDE.You have to pass the following parameters to cmake
:
-DCMAKE_INSTALL_PREFIX=<path>
to set the installation path to <path>
.-G<generator>
is -G"Visual Studio 14 2015"
for 32-bit build using Visual Studio 2015, or -G"Visual Studio 14 2015 Win64"
for 64-bit build using Visual Studio 2015. Later versions of Visual Studio may be used.You can pass the following additional parameters to cmake
:
-DRETDEC_DOC=ON
to build with API documentation (requires Doxygen and Graphviz, disabled by default).-DRETDEC_TESTS=ON
to build with tests, including all the tests in dependency submodules (disabled by default).-DCMAKE_BUILD_TYPE=Debug
to build with debugging information, which is useful during development. By default, the project is built in the Release
mode. This has no effect on Windows, but the same thing can be achieved by running msbuild
with the /p:Configuration=Debug
parameter.-DCMAKE_PROGRAM_PATH=<path>
to use Perl at <path>
(probably useful only on Windows).This repository contains the following libraries:
bin2llvmir
-- library of LLVM passes for translating binaries into LLVM IR modules.debugformat
-- library for uniform representation of DWARF and PDB debugging information.dwarfparser
-- library for high-level representation of DWARF debugging information.llvm-support
-- set of LLVM related utility functions.llvmir2hll
-- library for translating LLVM IR modules to high-level source codes (C, Python-like language).This repository contains the following tools:
bin2llvmirtool
-- frontend for the bin2llvmir
library.llvm2hlltool
-- frontend for the llvmir2hll
library.This repository contains the following scripts:
decompile.sh
-- the main decompilation script binding it all together. This is the tool to use for full binary-to-C decompilations.decompile.sh
:
color-c.py
-- decorates output C sources with IDA color tags -- syntax highlighting for IDA.config.sh
-- decompiler's configuration file.decompile-archive.sh
-- decompiles objects in the given AR archive.fileinfo.sh
-- a Fileinfo tool wrapper.signature-from-library.sh
-- extracts function signatures from the given library.unpack.sh
-- tries to unpack the given executable file by using any of the supported unpackers.decompile-all.sh
-- decompiles all executables in the given directory and subdirectories.run-unit-test.sh
-- run all tests in the unit test directory.utils.sh
-- a collection of bash utilities.Copyright (c) 2017 Avast Software, licensed under the MIT license. See the LICENSE
file for more details.
RetDec uses third-party libraries or other resources listed, along with their licenses, in the LICENSE-THIRD-PARTY
file.
See RetDec contribution guidelines.
This software was supported by the research funding TACR (Technology Agency of the Czech Republic), ALFA Programme No. TA01010667.