15 ms·
WebAssembly is actually simple to work with. If you want to obtain a "C" pseudocode, you can give a wasm file to wasm2c [1]. You can re-obtain a WebAssembly f
by KenanSulayman 8y ago
WebAssembly is actually simple to work with.
If you want to obtain a "C" pseudocode, you can give a wasm file to wasm2c [1].
You can re-obtain a WebAssembly folded-expression text format using wasm2wat [1].
You can obtain a call-graph from a WebAssembly module by generating the wat representation using wasm2wat and pasting it into main.wat on https://webassembly.studio/ https://webassembly.studio/ (-> Empty Wat Project). Then save and build; right click the new main.wasm and select "Generate Call Graph."
That said, check out this encrypted and anonymous "pastebin" I built [2] with the crypto being written in Rust and bindings generated using wasm-bindgen [3]. It surprisingly hard to debug when optimized using wasm-opt [4].
[1] Part of WebAssembly Binary Toolkit: https://github.com/WebAssembly/wabt https://github.com/WebAssembly/wabt
[2] Source code on Github: https://github.com/psychonautwiki/impis/blob/master/core/src/lib.rs https://github.com/psychonautwiki/impis/blob/master/core/src... — Demo paste: https://imp.is/n/7NFsfEiCjkFBVgC6A4JS6GyqN7puN5Sg7ed11m8VrtTv#DSP6yVL9Hg8QKLeeUTfJEv8SVRyx6uNFHzCNbEm5wF2f https://imp.is/n/7NFsfEiCjkFBVgC6A4JS6GyqN7puN5Sg7ed11m8VrtT...
[3] https://github.com/rustwasm/wasm-bindgen https://github.com/rustwasm/wasm-bindgen
[4] Part of Binaryen: https://github.com/WebAssembly/binaryen https://github.com/WebAssembly/binaryen
- mbebenita 8y agoRe WebAssembly.Studio, you can also just drag your .wat, .wasm file in without creating a project.
- piphf 8y agoWebAssembly is not "simple to work with", especially when it comes to analyzing non-trivial, large, optimized programs. The tool [1] generates a one-by-one equivalence of wasm instructions to C code. I guess you could qualify that as a "decompiler", but real decompilers - the ones used for malware analysis such as JEB or IDA - are optimizing decompilers that provide an output of higher level (eg more legible) than the input disassembly/binary.