Skip to content
This repository has been archived by the owner on Jul 3, 2022. It is now read-only.
/ retdec-rust Public archive

A Rust library and tools providing easy access to the retdec.com decompilation service through their REST API.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

s3rvac/retdec-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

retdec-rust

docs.rs crates.io

WARNING

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

Description

A Rust library and tools providing easy access to the retdec.com decompilation service through their public REST API.

You can either incorporate the library in your own tools:

extern crate retdec;

use retdec::{Decompiler, DecompilationArguments, File, Settings};

let decompiler = Decompiler::new(
    Settings::new()
        .with_api_key("YOUR-API-KEY")
);
let mut decompilation = decompiler.start_decompilation(
    DecompilationArguments::new()
        .with_input_file(File::from_path("hello.exe")?)
)?;
decompilation.wait_until_finished()?;
let output_code = decompilation.get_output_hll_code()?;
print!("{}", output_code);

or you can use the provided tool for stand-alone decompilations:

$ decompiler -k YOUR-API-KEY hello.exe

Either way, you get the decompiled C code:

//
// This file was generated by the Retargetable Decompiler
// Website: https://retdec.com
// Copyright (c) 2017 Retargetable Decompiler <info@retdec.com>
//

int main(int argc, char ** argv) {
    printf("Hello, world!\n");
    return 0;
}

Additionally, the crate provides access to the fileinfo service (analysis of binary files).

Status

Currently, the crate only provides very basic support for the decompilation and file-analyzing services. Support for more features is under way as the crate is under development.

A summary of all the currently supported parts of the retdec.com's API is available here.

Installation

To include the crate into your project so you can use it as a library, add the following lines into your Cargo.toml file:

[dependencies]
retdec = "0.1.0"

If you want to use the development version (current master branch), use these two lines instead:

[dependencies]
retdec = { git = "https://github.com/s3rvac/retdec-rust" }

If you just want to use the command-line tools (decompiler, fileinfo), install the project as follows:

cargo install retdec

Documentation

An automatically generated API documentation is available here:

  • master (development version)
  • 0.1.0 (latest stable version)

Contributions

Contributions are welcome. Notes:

  • To generate API documentation, run

    cargo doc --lib --no-deps
    
  • To run unit tests, execute

    cargo test --lib
    
  • To run documentation tests, execute

    cargo test --doc
    
  • To run all tests, including integration tests, execute

    RETDEC_API_KEY=YOUR-API-KEY cargo test
    

    Note: Before running integration tests, you need to set the RETDEC_API_KEY environment variable to your API key. Integrations tests communicate with the retdec.com's API, which is why a valid API key is needed.

License

Licensed under either of

at your option.

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-cpp - A library and tools for accessing the service from C++.
  • retdec-sh - Scripts for accessing the service from shell.

About

A Rust library and tools providing easy access to the retdec.com decompilation service through their REST API.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages