Crate retdec [] [src]

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:

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;
}

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.

License

Licensed under either of

at your option.

Reexports

pub use analysis::Analysis;
pub use analysis::AnalysisArguments;
pub use decompilation::Decompilation;
pub use decompilation::DecompilationArguments;
pub use decompiler::Decompiler;
pub use error::Error;
pub use error::Result;
pub use file::File;
pub use fileinfo::Fileinfo;
pub use settings::Settings;

Modules

analysis

Analyses from the fileinfo service.

decompilation

Decompilations from the decompiler service.

decompiler

Access to the file-decompiling service (decompiler).

error

Error handling.

file

Representation of files.

fileinfo

Access to the file-analyzing service (fileinfo).

settings

Settings for the provided services.

test

Access to the testing service (test).

tools

Tools that use the library to analyze and decompile files.

Constants

VERSION

Crate version.