Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support WebAssembly #202

Closed
Perfare opened this issue Nov 14, 2019 · 9 comments
Closed

Add support WebAssembly #202

Perfare opened this issue Nov 14, 2019 · 9 comments

Comments

@Perfare
Copy link
Owner

Perfare commented Nov 14, 2019

Related issue #162

@AndnixSH
Copy link

It's compiled as asm and zipped as .unityweb.
zipped .unityweb can be opened using 7zip which contains another .unityweb
global-metadata.dat can be grabbed from web.data.unityweb using hex editor but not sure how to guess the correct size of it
web.zip

@holly-hacker
Copy link

I've been working on a wasm decompiler a while ago and I may make my own global-metadata reader at some point. Once I've got something that works, I'll post a link to it here. I'd submit a PR for this project but the source is an absolute mess...

@AndnixSH
Copy link

AndnixSH commented Dec 26, 2019

That's interesting. No popular decompiler tools can even recognise wasm
Someone wrote a module for Ghidra https://github.com/andr3colonel/ghidra_wasm
Blog https://andr3colonel.github.io/

Btw, a guy shared his own .unityweb extractor tool after I reported issue regarding .unityweb support for UABE

SeriousCache/UABE#312 (comment)

web.data.unityweb_dump.zip

@Swenbop
Copy link

Swenbop commented Jan 17, 2020

Btw, a guy shared his own .unityweb extractor tool after I reported issue regarding .unityweb support for UABE

DerPopo/UABE#312 (comment)

nice! is it possible to get any code information from the dumped files? (global-metadata and .unity3d files)? I can open it in UABE but there does not seem to be any useful files that i could use with il2cppdumper for example.

@Brian151
Copy link

@holly-hacker

exactly how viable is WASM decompilation? i know a pure disassembly SHOULD go off well, short of the devs using obfuscation/encryption, because web assembly is still fairly high-level and you can't have what happens in say, x86, where data/code get intermingled and attempts to decompile result in garbage code and data which is actually code, etc... [and guessing exactly where/what locals/params are since they can be in the stack, or the heap, or be on the heap with a pointer on the stack. if you're really lucky, REGISTERS]

but, WASM technically doesn't need the names table and does behave more like a native CPU. so say you had a function that does something to an image structure/object, and the module doesn't have its names table, wouldn't that cause a LOT of problems?

or is it ALSO possible to aide this process using the type tree, similar to how UABE already can display the raw data of any asset/component in a file because the type tree describes the format of these objects?

@holly-hacker
Copy link

You can try my decompiler for yourself here. It basically converts the wasm to basic pseudo-c without applying any transformations to it, auto-generating names for functions that are not im/exported. In the future I'll look into how the metadata.dat file works and integrate that to produce output with more names. I also have to do some work to convert wasm's block-based control flow to a proper control flow graph to get better C-like control flow structs (eg. switch cases). I haven't worked on it for a while now since I'm working on other projects too.

@Brian151
Copy link

i'll have to take a look at that later
i can relate to having...multiple projects...XD

@Perfare
Copy link
Owner Author

Perfare commented Apr 9, 2020

Recently, I started to research WebAssembly, and have completed most of the content of WebAssembly. Now I just need to think about how to automatically search the pointer.

@Perfare
Copy link
Owner Author

Perfare commented Apr 10, 2020

The auto search part has been completed temporarily. But some of the problems, such as the range of bss needed for searching, is the value of the STATICTOP variable initialized in js. It may be possible to directly specify a very large value, but I have not tested more examples. Or maybe consider another search method. But for the time being, I will not continue to research WebAssembly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants