no|wrap.de - Flare

Flare is a free ActionScript decompiler. It decompiles SWFs produced by Macromedia Flash, including Flash MX 2004 and Flash 8.
### What is it Flare processes an SWF and extracts all scripts from it. The output is written to a single text file. Only ActionScript is extracted, no text or images. Flare is freeware. Windows, Mac OS X and Linux versions are available. The main purpose of decompiler is to help you recover your own lost source code. However, there are other uses, like finding out how a component works, or trying to understand poorly documented interface. Depending on where you live, some of them may be forbidden by law. It's your responsibility to make sure you don't break the law using Flare. If you develop Flash applications for living, you probably know that your code is not secure in SWF. It's not the existence of decompiler that makes your code insecure though, it's design of SWF format. Although no ActionScipt is stored there, most of it can be recovered from bytecodes. ### Download and usage Most recent Flare version is 0.6. Windows Explorer extension Download flare06setup.exe. After installation right-click on any SWF file in Windows Explorer and choose `Decompile` from context menu. Flare will decompile `somename.swf` and store decomiled code in `somename.flr` in the same folder. `somename.flr` is a simple text file, you can open it with your favorite text editor. If Flare encounters problems during decompilation, it will display some warnings. If everything goes well, it will quit silently. That's all, Flare has no other GUI. To unistall, execute `Start>Programs>Flare>Uninstall`. Mac OS X droplet Get flare06.dmg. After mounting the disc image drop an SWF file onto the Flare icon in Finder. The decompiled ActionScript will be stored in SWF's folder with FLR extension. Open it with your text editor. You can decompile multiple SWF files at once. The droplet is compiled on OS X 10.3. It should work on 10.2 and 10.4. There is no Flare for OS 9. Command line versions DOS/Windows binary: flare06doswin.zip Mac OS X binary: flare06mac.tgz Linux x86 binary: flare06linux.tgz Solaris x86 binary: flare06solaris.tgz There is no installation procedure for command line versions. Just create a folder named `flare` somewhere and unpack the archive there. To uninstall, delete the folder and you're done. To use it, you have to open DOS window first (Windows). On Mac OS X, open Terminal: `Applications/Utilities/Terminal.` Now `cd` to the Flare folder and call Flare with SWF path and name as only parameter: `flare somepath\somename.swf` (Windows) or `./flare somepath/somename.swf` (Mac/Linux). There are no options. A text file named `somename.flr` will be created in SWF's folder, warnings (if any) will be shown to the console. If you're unsure what Windows version to download, get Windows Explorer extension. Needless to say, for Mac you'll probably want to use the droplet. ### History In July 2003 I had some thoughts about effective SWF obfuscation. Obfuscation may be the wrong word though, I mean something more complex than renaming variables — kind of scrambling. Anyway, I decided to write a decompiler first to find out what's really hard to decompile, and Flare was born. I've learned a lot, and wanted to release a commercial scrambler in 2004. Since I don't seem to actually start implementing it, the idea is dropped by now. ### Project state Flare is not mature. Please don't rely on Flare doing anything important — source control comes to mind. It may not format your hard drive, but it probably will crash on some SWFs or fail to decompile certain patterns. If you happen to find such a pattern, and the bug isn't listed below, please tell me about it. It would be nice if instead of sending me the SWF, you try to localize the bug yourself, and attach the FLA containing failed code only. Flare will never be a full-featured GUI decompiler like ASV. If I find time, Flare will continue to evolve in what it does. Better ActionScript II support would be a worthwile goal. ### Non bugs Nothing will happen if you right-click on SWF in your browser. On Windows, Flare adds `Decompile` entry to the right-click menu of Windows Explorer, not Internet Explorer. Flare can't make changes in SWF — it's not a compiler. Decompiler and compiler are completely different matters. To change an SWF, you may try Flasm or MTASC. No images, sounds or text are extracted — ActionScript only. I have no plans to add these in the near future. There are no comments in SWF, they are compiled away. No decompiler can recover what's not there. Flare doesn't work on earlier Mac OS versions. It only works on Mac OS X. Flare may show equivalent code that looks different from original code and does the same. While I try to show the code in its original form, sometimes it's not possible. Before you submit a bug, please make sure the code is wrong. Flare isn't well suited for simple cut'n'paste. In decompiled text file all frames, events and classes are shown together. To re-use it you have to know where the code belongs to. Flare works best on code compiled in Flash. It's not always possible to decompile, say, hand-optimized code. Flash may replace local variables with registers. Names of these variables are not recoverable. Neither are the names changed by obfuscators. Some actions (f.e. `extends` and `implements`) won't compile outside of classes. As long as Flare doesn't decompile to ActionScript II, there is no way to show them correctly. ### Bugs and missing features Flare shows ActionScript I code even if source was ActionScript II. ActionScript II is mostly compiled to ActionScript I in SWF, with some additional instructions. There's no strong typing there, for example. While it would be possible to restore it, currently Flare can't do that. ActionScript III (Flash Player 8.5) isn't supported. No format details are known yet. `while` loops are shown instead of `for` loops. They are equivalent with one exception: `continue` statement. In the future I'll attempt to recover most `for` loops. Multiple assignments `a = b = c = 10;` are shown as separate statements. Normally, it's not a problem. However, if used as loop condition, generated code may be incorrect. You may be surprised by the code within `catch` clause of `try/catch/finally` block. Flash compiles typed exceptions to the code that actually checks the type of exception variable. Flare shows this code instead of restoring the more high-level original format. Starting with Flash MX, movie clips may contain button event handlers. Flare incorrectly shows `onClipEvent` events instead of `on` events here. For buttons, correct event handlers are shown. If left side of an assignment is calculated, Flare incorrectly uses `eval`. Since Flash MX, `eval` isn't allowed here, such assignment should be converted to `set(var,val);` form. Flash 5 has no separate strict equality `===` or strict inequality `!==` operators, `typeof` is used instead. Flare will not recover them. Since `switch` statements depend on `===`, Flash 5 `switch` can't be recovered. In Flash 5 SWFs the condition of `if` statement may be reversed: `(5>v)` is shown instead of `(v<5)`. It's not wrong, just unpleasant. Flash optimizes certain branches away. Control flow recovery may be incomplete for edge cases. Flare can't handle unicode file names. ### Related software #### Free Flasm Disassembler and assembler, maintained by yours truly. With Flasm, you can make changes to SWF. However, it doesn't show ActionScript — only bytecodes. If you're unfamiliar with them, it may be difficult to grasp. Free with source code. MTASC Open source ActionScript II compiler. Flare output is probably not compatible with MTASC though. OSFlash Community-run resource site for open source Flash projects and tools. #### Commercial All commercial decompilers extract images, sounds and text, not only ActionScript. I haven't made any tests regarding their quality. If you need one, try demo versions yourself. Action Script Viewer The first ActionScript decompiler for Windows. Sothink SWF Decompiler Imperator FLA Claims to re-build most of the original FLA from SWF, including ActionScript. DeFlash Low-cost decompiler, handles SWFs up to Flash MX. Gordon Decompiler for Mac. KineticFusion SWF to XML and back, including ActionScript. Expensive. ### Terms of use Copyright © 2003-2005 Igor Kogan. All rights reserved. Flare is copyrighted freeware. It costs nothing. Neither do I ask for donations. However, there are some restrictions on its usage. Flare is provided “as is” and without any warranties. Please read the license included in the distribution for details. If you want to distribute Flare as part of commercial product, or need access to the source code, or do anything else that isn't covered by this license, please contact me for conditions. Portions of Flare's tag parsing engine are based on Flasm. Macromedia and Flash are registered trademarks of Macromedia, Inc. Macromedia does not sponsor, affiliate, or endorse this product. ### Enjoy Igor Kogan
Last update: 24 October 2005 |