Why the jpexs tool not working when decompile swf file?

为君一笑 提交于 2019-12-23 21:20:11

问题


Anyone knows how to decompile .SWF file?

I have tried JPEXS and Sothink SWF Decompiler but it not working.

I put this .swf in this link.

Thanks.


回答1:


The SWF is not opening with JPEXS because it is compressed!!.

The first thing you should do when a file (eg: swf, jpeg, mp3, mp4) does not open in any program, is to check if the format bytes are correct by using a hex editor.

Checking your file bytes:

Usually a SWF file begins with bytes 43 57 53 (eg:"CWS") or even bytes 46 57 53 (eg: "FWS").

  • Your file begins with 78 DA 00 43 40 BC BF 43 57 53
    (the last three bytes are the expected 43 57 53 of a normal SWF).

  • Those first two bytes 78 DA means it has some ZLib compression (eg: like a .zip file).

Solution:
Two options to decomress ZLib. One is by AS3 code and the other is by external (Windows) tool.

Option 1) Use AS3 to decompress.

  • Get the library AS3ZLib and copy its as3zlib folder to same place as your Flash project .as files. (Find folder at: src/com/wirelust/as3zlib/).

  • Load (or read) your SWF file's bytes into an AS3 bytearray called fileBytes.

Try this code logic:

import Zlib; //do import of API

....

public var zlibdecomp :Zlib; //create instance variable

....

public var fileBytes :ByteArray = new ByteArray;
public var swfBytes :ByteArray = new ByteArray;

//#  SWF original file bytes load
fileBytes = ... ; //your loading code here

//# Decompress loaded into new SWF bytes
zlibdecomp = new Zlib; //create new ZLIB instance in variable
swfBytes = zlibdecomp.uncompress( fileBytes ); //update with decompress version
trace("swfBytes length (DEFLATED) : " + swfBytes.length); //is 8,617,377 bytes??

The bytes in swfBytes now can be saved as a file new.swf and this will open correctly in JPEXS. Use fileReference API to save AS3 bytes to disk.

Option 2) Use an external ZLib tool.

Using OffZip (for Windows OS) you can decompress the SWF.
This is the direct OffZip file. Copy Offzip.exe into a folder like c:\offzip\.

Now open command line by running cmd.exe. Type cd\offzip\ (press enter). Alternatively just hold shift and right-click the Offzip folder then choose "open command window here".

Type offzip -a vpt.swf (press enter).

You should see output like this...

C:\offzip>offzip -a vpt.swf

Offzip 0.4
by Luigi Auriemma
e-mail: aluigi@autistici.org
web:    aluigi.org

- open input file:    vpt.swf
- zip data to check:  32 bytes
- zip windowBits:     15
- seek offset:        0x00000000  (0)

+------------+-----+----------------------------+----------------------+
| hex_offset | ... | zip -> unzip size / offset | spaces before | info |
+------------+-----+----------------------------+----------------------+
  0x00000000 .

................................................................................
................................................................................
................................................................................


................................................................................
................................................................................
.................................................................... 8496131 ->
8617377 / 0x0081a403 _ 0 8:7:26:0:1:2657f334


- 1 valid compressed streams found
- 0x0081a403 -> 0x00837da1 bytes covering the 100% of the file

Now the output file 00000000.cws can be opened in JPEXS. You can rename this to 00000000.swf.



来源:https://stackoverflow.com/questions/55159335/why-the-jpexs-tool-not-working-when-decompile-swf-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!