retdec-rust

docs.rs crates.io

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:

```rust extern crate retdec;

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

let decompiler = Decompiler::new( Settings::new() .withapikey("YOUR-API-KEY") ); let mut decompilation = decompiler.startdecompilation( DecompilationArguments::new() .withinputfile(File::frompath("hello.exe")?) )?; decompilation.waituntilfinished()?; let outputcode = decompilation.getoutputhllcode()?; print!("{}", output_code); ```

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

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

Either way, you get the decompiled C code:

```text // // 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:

text [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:

text cargo install retdec

Documentation

An automatically generated API documentation is available here:

Contributions

Contributions are welcome. Notes:

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: