Quickstart¶
This page gives an overview of the library and tools to get you started.
Requirements¶
- Python >= 3.4 (CPython or PyPy)
- requests module for making HTTPS calls to the retdec.com API
Installation¶
The recommended way of installing is from Python Package Index (PyPI) with pip:
$ pip install retdec-python
This will install the latest stable version, including all dependencies. You can also install the latest development version directly from GitHub:
$ pip install git+https://github.com/s3rvac/retdec-python
Prerequisites¶
To be able to actually use the library and scripts, you need to register at retdec.com. After that, log in and click on Account. There, you will find your API key, which is used for authentication.
Attention
Be careful not to disclose your API key to anyone! You have to keep it a secret.
Library vs Scripts¶
retdec-python provides both a Python library and scripts. You can either incorporate the library in your own scripts:
from retdec.decompiler import Decompiler
decompiler = Decompiler(api_key='YOUR-API-KEY')
decompilation = decompiler.start_decompilation(input_file='file.exe')
decompilation.wait_until_finished()
decompilation.save_hll_code()
or you can use the provided scripts for stand-alone file analyses or decompilations:
$ decompiler -k YOUR-API-KEY file.exe
v23bmYb67R
----------
Waiting for resources (0%)... [OK]
Pre-Processing:
Obtaining file information (5%)... [OK]
Unpacking (10%)... [OK]
Front-End:
Initializing (20%)... [OK]
[..]
Done (100%)...
Downloading:
- file.c
Either way, file.c
then contains the decompiled C code:
$ cat file.c
//
// This file was generated by the Retargetable Decompiler
// Website: https://retdec.com
// Copyright (c) 2016 Retargetable Decompiler <info@retdec.com>
//
#include <stdio.h>
[..]
The library provides support for the decompilation, fileinfo, and test services. For a more detailed list, see the status page.
Next, we describe the library in a greater detail. If you wish to learn more about the provided scripts, continue here instead.