All Projects → wwwg → Wasmdec

wwwg / Wasmdec

Licence: mit
WebAssembly to C decompiler

Projects that are alternatives of or similar to Wasmdec

Jremapper
Remapping tool for compiled java programs.
Stars: ✭ 97 (-66.55%)
Mutual labels:  decompiler, decompile
Bytecoder
Rich Domain Model for JVM Bytecode and Framework to interpret and transpile it.
Stars: ✭ 401 (+38.28%)
Mutual labels:  decompiler, webassembly
TML.Patcher
Console application for decompiling, recompiling, packaging, and patching tModLoader's .tmod files at blazing-fast speeds.
Stars: ✭ 38 (-86.9%)
Mutual labels:  decompiler, decompile
Reko
Reko is a binary decompiler.
Stars: ✭ 942 (+224.83%)
Mutual labels:  decompiler, decompile
Ilspy
.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
Stars: ✭ 14,011 (+4731.38%)
Mutual labels:  decompiler, decompile
Recaf
The modern Java bytecode editor
Stars: ✭ 3,374 (+1063.45%)
Mutual labels:  decompiler, decompile
react-native-decompiler
Decompile React Native Android/IOS Bundle.
Stars: ✭ 78 (-73.1%)
Mutual labels:  decompiler, decompile
Riscv Rust
RISC-V processor emulator written in Rust+WASM
Stars: ✭ 253 (-12.76%)
Mutual labels:  webassembly
Dragon Iss Docking Autopilot
Autopilot in Go for docking the SpaceX Dragon capsule in the simulator
Stars: ✭ 276 (-4.83%)
Mutual labels:  webassembly
apk-decompiler
Small Rust utility to decompile Android apks
Stars: ✭ 48 (-83.45%)
Mutual labels:  decompiler
x-img-diff-js
🎨 JavaScript library which compares 2 images and detect structural difference information using OpenCV(WebAssembly)
Stars: ✭ 43 (-85.17%)
Mutual labels:  webassembly
Luadec51
Lua Decompiler for Lua version 5.1
Stars: ✭ 257 (-11.38%)
Mutual labels:  decompiler
Glas
WebGL in WebAssembly with AssemblyScript
Stars: ✭ 278 (-4.14%)
Mutual labels:  webassembly
wasm-arrays
A couple of helper functions to make WebAssembly array parameters easy to use
Stars: ✭ 33 (-88.62%)
Mutual labels:  webassembly
Pyinstxtractor
PyInstaller Extractor
Stars: ✭ 280 (-3.45%)
Mutual labels:  decompile
node-wasm-trace
Instruments wasm files and traces execution
Stars: ✭ 24 (-91.72%)
Mutual labels:  webassembly
Wasmexplorer
Stars: ✭ 291 (+0.34%)
Mutual labels:  webassembly
Wasmer Ruby
💎🕸 WebAssembly runtime for Ruby
Stars: ✭ 286 (-1.38%)
Mutual labels:  webassembly
Wasm Git
GIT for nodejs and the browser using https://libgit2.org compiled to WebAssembly with https://emscripten.org
Stars: ✭ 261 (-10%)
Mutual labels:  webassembly
Octopus
Security Analysis tool for WebAssembly module (wasm) and Blockchain Smart Contracts (BTC/ETH/NEO/EOS)
Stars: ✭ 261 (-10%)
Mutual labels:  webassembly

wasmdec

wasmdec is a program that converts WebAssembly binaries to C.

Demo

An online real-time WebAssembly decompiler utilizing wasmdec is avalible here

Simple Example

wasmdec will translate this WebAssembly binary:

(module
	(func $addTwo (param i32 i32) (result i32)
		(return
			(i32.add (get_local 0) (get_local 1))
		)
	)
	(export "addTwo" $addTwo)
)

To the following pseudo-C code:

int fn_addTwo(int arg0, int arg1) {
	return arg0 + arg1;
}

More practical examples

Diep.io (HTML5 web game written in C++ and compiled to WASM)

Diep.io is a real time web game written in C++ and compiled to WebAssembly via Emscripten.

wasmdec

wasmdec is capable of decompiling itself back to C.

WebDSP (a signal processing library compiled to WASM)

From the WebDSP repository:

WebDSP is a collection of highly performant algorithms, which are designed to be building blocks for web applications that aim to operate on media data. The methods are written in C++ and compiled to WASM, and exposed as simple vanilla Javascript functions developers can run on the client side.

Applications

A CTF write-up which uses wasmdec to reverse engineer a WASM binary

Installing with release

  • Grab a release on the releases page and select the correct tarball for your OS and arch.
  • Extract and run install.sh as root.

Installing manually

Getting the code

Clone the repository with

git clone https://github.com/wwwg/wasmdec.git --recursive

Make sure the recursive flag is set to clone all the submodules.

Building

To build wasmdec and install all of it's dependencies, run sudo make all in the wasmdec directory. GCC 7 or higher is reccomended.

Usage

wasmdec -o (output file) (options) [input files]

Where options is one of:

  • -e or --extra : Emits extra function information as comments:
    • Raw WebAssembly names of functions
    • Number of local variables and parameters of functions
  • -m or --memdump :
    • Dumps the binary's memory and table to disk
    • NOTE : memdump ONLY dumps memory and doesn't actually do any decompilation
  • -d or --debug : Print extra debug information to stdout
  • If no output file is specified, the default is out.c
  • When more than one input file is provided, wasmdec will decompile each WebAssembly to the same output file. Functions from more than one file are prefixed by their module name in order to prevent ambiguous function definitions.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].