{"id":13638346,"url":"https://github.com/wwwg/wasmdec","last_synced_at":"2025-04-10T07:33:04.276Z","repository":{"id":106094840,"uuid":"97805303","full_name":"wwwg/wasmdec","owner":"wwwg","description":"WebAssembly to C decompiler","archived":false,"fork":false,"pushed_at":"2024-02-07T20:04:21.000Z","size":8103,"stargazers_count":395,"open_issues_count":9,"forks_count":26,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-08-03T01:12:42.810Z","etag":null,"topics":["binaryen","decompile","decompiler","webassembly"],"latest_commit_sha":null,"homepage":"https://wwwg.github.io/web-wasmdec/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wwwg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-07-20T07:36:30.000Z","updated_at":"2024-07-26T00:23:23.000Z","dependencies_parsed_at":"2023-11-13T16:00:31.366Z","dependency_job_id":null,"html_url":"https://github.com/wwwg/wasmdec","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwwg%2Fwasmdec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwwg%2Fwasmdec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwwg%2Fwasmdec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwwg%2Fwasmdec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wwwg","download_url":"https://codeload.github.com/wwwg/wasmdec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223430211,"owners_count":17143625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binaryen","decompile","decompiler","webassembly"],"created_at":"2024-08-02T01:00:44.432Z","updated_at":"2024-11-06T23:14:35.425Z","avatar_url":"https://github.com/wwwg.png","language":"C++","funding_links":[],"categories":["Inspecting","\u003ca id=\"0971f295b0f67dc31b7aa45caf3f588f\"\u003e\u003c/a\u003eDecompiler\u0026\u0026反编译器"],"sub_categories":["\u003ca id=\"e67c18b4b682ceb6716388522f9a1417\"\u003e\u003c/a\u003e工具"],"readme":"# wasmdec\nwasmdec is a program that converts WebAssembly binaries to C.\n\n# Demo\n[An online real-time WebAssembly decompiler utilizing wasmdec is avalible here](https://wwwg.github.io/web-wasmdec/)\n\n# Simple Example\nwasmdec will translate this WebAssembly binary:\n```wasm\n(module\n\t(func $addTwo (param i32 i32) (result i32)\n\t\t(return\n\t\t\t(i32.add (get_local 0) (get_local 1))\n\t\t)\n\t)\n\t(export \"addTwo\" $addTwo)\n)\n```\nTo the following pseudo-C code:\n```c\nint fn_addTwo(int arg0, int arg1) {\n\treturn arg0 + arg1;\n}\n```\n# More practical examples\n\n### [Diep.io](https://diep.io) (HTML5 web game written in C++ and compiled to WASM)\nDiep.io is a real time web game written in C++ and compiled to WebAssembly via Emscripten.\n* The WebAssembly binary is is always `http://static.diep.io/build_\u003cBUILD HASH\u003e.wasm.wasm`\n* [The decompiled binary is avalible here](examples/diep_decompiled.c)\n\n### wasmdec\nwasmdec is capable of decompiling itself back to C.\n* The makefile has a `wasm` target that uses [Emscripten](https://github.com/kripken/emscripten) to compile wasmdec to WebAssembly\n* [The decompiled binary is avalible here](examples/wasmdec_decompiled.c)\n\n### [WebDSP](https://github.com/shamadee/web-dsp) (a signal processing library compiled to WASM)\nFrom the [WebDSP repository](https://github.com/shamadee/web-dsp):\n```\nWebDSP 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.\n```\n* A compiled version of the library is avalible on the WebDSP demo page\n* [The decompiled library is avalible here](examples/webdsp_decompiled.c)\n\n# Applications\n[A CTF write-up which uses wasmdec to reverse engineer a WASM binary](http://maroueneboubakri.blogspot.com/2018/04/nuit-du-hack-ctf-quals-2018-assemblyme.html)\n\n# Installing with release\n\n- Grab a release on the releases page and select the correct tarball for your OS and arch.\n- Extract and run `install.sh` as root.\n\n# Installing manually\n\n## Getting the code\nClone the repository with\n```bash\ngit clone https://github.com/wwwg/wasmdec.git --recursive\n```\nMake sure the recursive flag is set to clone all the submodules.\n## Building\nTo build wasmdec and install all of it's dependencies, run `sudo make all` in the `wasmdec` directory. GCC 7 or higher is reccomended.\n\n# Usage\n```bash\nwasmdec -o (output file) (options) [input files]\n```\nWhere options is one of:\n- `-e` or `--extra` : Emits extra function information as comments:\n    * Raw WebAssembly names of functions\n    * Number of local variables and parameters of functions\n- `-m` or `--memdump` : \n    * Dumps the binary's memory and table to disk\n    * NOTE : memdump ONLY dumps memory and doesn't actually do any decompilation\n- `-d` or `--debug` : Print extra debug information to stdout\n- If no output file is specified, the default is `out.c`\n- 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.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwwg%2Fwasmdec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwwwg%2Fwasmdec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwwg%2Fwasmdec/lists"}