Decompile a SWF file on Windows

I have recently discovered a great tool to decompile SWF animations (I needed a tool to extract the animation of a game to add design to one of my school projects).

So the only free solution I have found is called SWFTools. But the problems are that you don’t have any GUI for the tools that it provides so you have to do all the operations with the console and that you cannot extract all the objects at a time : you have to specify the ID of the object you want to extract!

So I have written a little batch script to extract all the objects automatically :

First of all, you have to create a sub-folder in your SWFTools folder (“badger” in this example).
Then copy the swf file you want to decompile in your SWFTools folder (“badger.swf” in this example).
Then decide how many objects you want to try to extract (200 in this example), it depends on the size of the swf file. The bigger the number the longer it will take.

Then create a bat file in your SWFTools folder, edit it with notepad, copy/paste the following script in it and finally replace the values.

:: To extract all the elements of the animation
FOR /L %%i IN (0,1,200) DO (
swfextract.exe -i %%i -o badger/%%i.swf badger.swf

:: To ajust the dimentions of the windows
FOR /L %%i IN (0,1,200) DO (
swfbbox.exe -o badger/%%i.swf -Oe badger/%%i.swf

Once you have extracted the object you were looking for (123.swf in this example), if you want to extract the png images of the different frames, copy paste it to the SWFTools folder and execute the following script.

:: To extract all the images of an animation
FOR /L %%i IN (0,1,50) DO (
swfextract.exe -p %%i -o badger/%%i.png 123.swf

Else, if you want to extract the vectors from the swf you have isolated, use Flash Exploit

Leave a Reply

Your email address will not be published. Required fields are marked *