website | twitter

Friday, January 29, 2010

Recent Tamarin and ABC tools

Tamarin-central, the stable source tree of open source VM used by Adobe Flash, was updated last December (Dec 22 2009) after relatively long blank. The newer tree has faster VM and includes updated ABC assembler and disassembler. Especially those ABC utilities are quite useful to a binary hacker of AVM2.

Download latest Flex SDK

I found that neither Flex SDK 3.5 nor 4.0 stable build can compile abcdump. You need to download later version from the Download Flex site. Flex 4-Beta 2 ( works well. I would set the Flex directory to environment variable FLEX.
$ export FLEX=~/Downloads/flex_sdk_4.0.0.10485_mpl

Download and build Tamarin-central

Building procedure is well documented in Tamarin_Build_Documentation. Only my additional suggestion is to add --enable-debugger, it makes error messages easy to read, it helps you, really.
$ hg clone
$ cd tamarin-central
$ mkdir objdir-release
$ cd objdir-release
$ python ../ --enable-shell --enable-debugger
$ make
$ ./shell/avmshell -Dversion
shell 1.5 release-debugger build cyclone
features AVMSYSTEM_32BIT; ...

Build abcdump

There are various useful utilities in utils/ directory. Some utilizes are written in ActionScript, so you need to compile them to use. Abcdump, ABC disassembler, is one of such utilities.
$ cd ..
$ java -jar $FLEX/lib/asc.jar -import core/ -import shell/ utils/
core/ and shell/ are basic libraries provided by tamarin, you can use them to try to see how abcdump works. Note that you need to separate abc file names with --, otherwise arguments are processed by avmshell instead of abcdump.
$ ./objdir-release/shell/avmshell ./utils/ -- core/ 
// magic 2e0010
// Cpool numbers size 158 0 %
I recommend you to make a tiny shell script to ease such a complicated command line.
~/tmp/tamarin-central/objdir-release/shell/avmshell ~/tmp/tamarin-central/utils/ -- $@

How to use abcasm

Abcasm is a ABC assembler. It is written in java and shell script, so you don't need to compile to try it. utils/abcasm/test/ directory includes various interesting sample programs. You can test them easily and quickly.
$ cd utils/abcasm/
$ ./ test/hello.abs
$ ../../objdir-release/shell/avmshell test/
Hello, world
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.