It writes back the header (with the "FWS" signature) and the uncompressed data, creating a new, uncompressed SWF.It reads the rest of the data and uncompresses it.It reads the uncompressed header (the first 8 bytes) without the signature and remembers it.writeBytes ( compressed ) //write the now uncompressed content writeBytes ( header ) //write the header backĭecompressed. writeMultiByte ( "FWS", "us-ascii" ) //mark as uncompressedĭecompressed. writeBytes ( data, 8 ) //read the rest, compressedĭecompressed. writeBytes ( data, 3, 5 ) //read the uncompressed header, excluding the signatureĬompressed. Var decompressed : ByteArray = new ByteArray () Var compressed : ByteArray = new ByteArray () Var header : ByteArray = new ByteArray () Private function decompress ( data : ByteArray ) : ByteArray Choose a SWF you want to protect and embed it as binary data using the Embed tag: Open a new ActionScript 3.0 project, and set it to compile with Flex SDK (I use FlashDevelop to write code). You can grab a trial of Sothink SWF Decompiler from Whilst not necessary, it would be nice to check if our protection actually works. You can download it from or you can use an editor of your choice. I'll be using a free editor called Hex-Ed. We will be using it to embed content using the Embed tag. Feel free to download the SWF I'll be working on. This tutorial is also about low level programming that involves bytes, ByteArrays and manipulating SWF files with a hex editor. Try to decompile it yourself.īefore we get going, I want to point out that this tutorial is not suitable for beginners and you should have solid knowledge of AS3 if you want to follow along. Additionally, the names are illegal so it won't compile back. The code that is decompiled is actually the code for decrypting the content and has nothing to do with your main code.
0 Comments
Leave a Reply. |