irelance / jsc-decompile-mozjs-34

A javascript bytecode decoder for mozilla spider-monkey version 34. May decompile jsc file compile by cocos-2dx
164 stars 78 forks source link

Undefined offset, Decompilation error #3

Open PutterPlace opened 6 years ago

PutterPlace commented 6 years ago

When attempting to decompile this file, I only receive a bunch of errors:

Notice: Undefined offset: 3277386 in C:\Tools\jsc-decompile-mozjs-34-master\src\Xdr\Atom.php on line 25  
Notice: Undefined offset: 3277385 in C:\Tools\jsc-decompile-mozjs-34-master\src\Xdr\Atom.php on line 25  
Notice: Undefined offset: 3277388 in C:\Tools\jsc-decompile-mozjs-34-master\src\Xdr\Atom.php on line 25  
...

I receive similar errors when attempting to decompile this file:

Notice: Undefined offset: 452315 in C:\Tools\jsc-decompile-mozjs-34-master\src\Xdr\Common.php on line 46  
Notice: Undefined offset: 452316 in C:\Tools\jsc-decompile-mozjs-34-master\src\Xdr\Common.php on line 46  
Notice: Undefined offset: 452317 in C:\Tools\jsc-decompile-mozjs-34-master\src\Xdr\Common.php on line 46  
...

I've double-checked to make sure these two files are in accordance to a previously-posted issue. These files share the magic number you mentioned that this tool can decompile: 2C C0 73 B9

Any help would be greatly appreciated.

Quantum64 commented 6 years ago

Right! We're all trying to decompile cash show...

discoli-zz commented 6 years ago

Welcome to the club!

PutterPlace commented 6 years ago

Tell me about it. I can connect to their websocket, but I can't figure out, for the life of me, how to communicate with it properly. I need the JS! :-P

Quantum64 commented 6 years ago

I'm in exactly the same spot. Just looks like a stream of binary data in Wireshark, so there isn't much hope of blackboxing it.

PutterPlace commented 6 years ago

The data is definitely hexadecimal, but I'm not sure of the formatting is all. You can read the strings inside the messages sent and received, but there's other data being sent and received along with it.

Quantum64 commented 6 years ago

I mean you can represent binary data as hexadecimal digits. One byte can be represented as two characters from 0 to f. There's no such thing as "hexadecimal data". Typically when people refer to binary data, they mean "non-ascii" data, or not plaintext.

PutterPlace commented 6 years ago

I know that. It's definitely being transmitted as binary data. I just mean that it's not completely unreadable if switched to hex or ascii. Just enough so to not be able to replicate it without more info. :-P

Quantum64 commented 6 years ago

While we await @irelance's reply, I've done some research into this issue myself.

It appears that $parseIndex is extending past the number of bytes in the file, causing the undefined offsets in the $bytecodes array, which is just the file as a byte array. I'm still not sure what's causing this though.

PutterPlace commented 6 years ago

I'll probably take a look into as well tomorrow. Much too tired atm. :-P

WalkyRG commented 6 years ago

Any progress on the issue ? I'm not able to decompile JSC files too..

PutterPlace commented 6 years ago

None thus far. Sorry.

irelance commented 6 years ago

That means my script do not work on your bytecode:

  1. Maybe my script decompile has some bugs (I am trying to rewrite the generate code process in the free time)
  2. Maybe your bytecode compile by different engine or different version (see issue2)
Quantum64 commented 6 years ago

Have you had a chance to look into this @irelance?

heliocosta-dev commented 1 month ago

How did y'all end up with this? I'm in the exact same spot. Can read some strings but there's some weird bytes there as well. @Quantum64 @PutterPlace