Shell scripts for decompiling and analyzing binary files through the retdec.com REST API.
Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

retdec-sh

WARNING

The retdec.com decompilation service is to be disabled (see the official announcement). This will render the scripts in the present repository non-functional. I will keep the repository online in case it is helpful to anyone.

Description

Shell scripts for decompiling and analyzing binary files through the retdec.com decompilation service by using their public REST API.

Two scripts are provided:

  • fileinfo.sh - Analyzes the given binary file and prints the obtained information to the standard output:

      $ scripts/fileinfo.sh --api-key YOUR-API-KEY file.exe
      Input file               : file.exe
      File format              : PE
      File class               : 32-bit
      File type                : Executable file
      Architecture             : x86 (or later and compatible)
      [..]
    
  • decompiler.sh - Decompiles the given binary file and downloads the decompiled C source code:

      $ scripts/decompiler.sh --api-key YOUR-API-KEY file.exe
      $ cat file.c
      //
      // This file was generated by the Retargetable Decompiler
      // Website: https://retdec.com
      // Copyright (c) 2015 Retargetable Decompiler <info@retdec.com>
      //
      [..]
    

Development Status

Although the very basic functionality is there, more features are under development.

For a list of changes, see the CHANGELOG file.

Requirements

  • shell (bash, dash, ...)
  • curl

The scripts should work with any POSIX shell, although they have been tested only on bash and dash.

Installation

Simply copy the scripts from the scripts directory to your machine, either directly or by cloning this repository.

Usage

Since the scripts use the retdec.com API, you need to provide them your API key. The API key can be obtained by registering at retdec.com. After logging in, go to your account, where you can generate an API key). After you have an API key, either pass it by using the -a/--api-key parameter, or set the RETDEC_API_KEY environment variable.

Synopsis:

scripts/{fileinfo,decompile}.sh [OPTIONS] FILE

For a detailed list of available options, run the scripts with the -h/--help parameter.

Exit Codes

The scripts may exit with the following codes.

  • 0 - everything went OK,
  • 1 - either curl is not installed or the given script parameters are invalid,
  • 2 - there was an error during script runtime (e.g. a decompilation failed).

Contributions

Contributions are welcomed as pull requests.

Bug Reporting

If you have found a bug, please report it by opening an issue.

License

Copyright (c) 2015 Petr Zemek (s3rvac@gmail.com) and contributors.

Distributed under the MIT license. See the LICENSE file for more details.

Access from Other Languages

If you want to access the retdec.com decompilation service from other languages, check out the following projects:

  • retdec-python - A library and tools for accessing the service from Python.
  • retdec-rust - A library and tools for accessing the service from Rust.
  • retdec-cpp - A library and tools for accessing the service from C++.