Thursday, April 22, 2010

Tamarin Gems

While working on one of my recent actionscript project, I came across some interesting and useful information on the Tamarin project site. Tamarin, of course, is the actionscript virtual machine responsible for running actionscript codes in the Flash Player. I am sure someone else must have blogged about them somewhere on the web, but I still want to mention them again here.


The first one is very well known, the abcdump. This is handy little tool that allow you to extract the bytecode information from a SWF file. It can also dump the actionscript bytecode block as an ABC (short for actionscript bytecode I assume) file. This is truly the ultimately SWF decompiler. It doesn't matter if the SWF file is obfuscated by the most aggressive algorithm in the world, this tool will let you look into the actionscript in an assembler-like language. It's long and dry, but human-readable nonetheless.

The second one is the swfmake. This one, as the name suggests, allows you to stitch multiple ABC files together into a valid SWF file. Why is this useful? Well because of the next tool.

The third one is the abcasm. This one allows you to turn the text output from abcdump, which contains the actionscript in an assembler-like language into an ABC file. Think of the possibility here. One can decompile any SWF file, edit the assembler code, compile it back into an ABC and finally convert it into an SWF.

Unfortunately, during my initial attempts, I found that the abcasm doesn't work quite as advertised. All the test cases supplied with the Tamarin source compile just fine, but often the abcdump of even the simplest SWF would trigger an error. I have not worked out the details yet, but it seems, from the first glance, that abcasm doesn't like the way abcdump prints the class variables.

The Tamarin source code is full of many other wonderful tools. I will share more of them later. If you have a chance to use the abcasm tool, please do not hesitate to share your experience. I certainly hope the Tamarin team improve on this neat little tool soon.

No comments:

Post a Comment