Introduction to decompilation of swf files

Source: Internet
Author: User

/*------------------------------------------------------
Author: WiNrOOt [FCG]
Tool: flasm http://www.nowrap.de/flasm.html
UltraEdit
Sothink SWF Decompiler
Objective: To enable swf with server verification to be played locally (the main objective is to hope you can give some advice)
Objective: ** Gong Shuo's mathematics tutoring swf File
--------------------------------------------------------*/
Hello everyone! I'm WiNrOOt, cainiao.
Let's talk about how to enable local playback of swf with server verification.
It is very easy for you to master, but it takes a little time for me as a layman.
========================================================== ========================================
Recently I need some teaching materials. I went online and found that xdf flash is good. I like it very much! Oh, I got something in bt.
The discovery of incomplete information gave rise to the implication of cracking! So I became interested in flash cracking, but I started learning from scratch when I knew nothing about flash.
Just a friend's ** Gong Shuo's mathematics tutoring swf file (not xdf) cannot be played locally, so we started .......


1.swf file structure (paste a bit)
Let's take a look at the official swf file format.
Http://www.half-serious.com/swf/format/
******** **************************************** *
The overall structure of the swf file is composed of header + body.
The file starts with a [File Header]
Its structure is as follows:
Byte Name Description
1 Signature "F" indicates the non-encrypted format, and "C" indicates the encrypted format
1 Signature "W" has no special significance
1 Signature "S" has no special significance
1 Version number, indicating the corresponding Player Version
4 FileLength: the length of the entire file.
N FrameSize RECT struct, indicating the screen size. The specific structure and length are discussed based on data changes.
2 FrameRate frame rate. The default value is 12.
2 FrameCount: the number of frames at the root of the file.

Each tag includes a header and a data body. The header has two types: Short tag and long tag.
The short tag is composed of 2 bytes. The first 10 bits represent the tag type, and the last 6 bits represent the tag length.
The long tag is composed of 6 bytes. The first 10 bits indicate the tag type. The last 6 bits are fixed to 1, and the last 4 bits represent the tag length.
The length of a tag is different from that of a FileLength header. It is the length after the tag header is removed.

A swf file consists of one head and one body.
The rest below is the body of the swf file.
The entire file body consists of a large number of tags. By analyzing the head part of the tag, you can immediately know the type code and length of the tag.
If you cannot identify the tag type, you can skip the tag directly using the tag length.
This method ensures the compatibility of the version. Even if a new tag is generated, the player of the old version can still parse the entire swf file without making any error. A big deal is that it cannot provide new functions.
The following is an image concept of the swf file structure.

(File header) (file body)
| (Tag 1) (tag 2) (tag 3 )(......)
| (Tag header) (tag body)
| (Tag type code) (tag length)
******** **************************************** *
Add one point
Two types of Tags are available: Definition Tags and Control Tags.
The Control tag is divided into: Display List tags Control tags and Action tags.
Personal Understanding: Definition Tags is to store all resources
The Control tag is used to store the Control code.
We know from the above that the verification information must be stored in the Action.
Start working ...........
Decompilation with Sothink SWF Decompiler
Take a look at Action --------> MainMovie
Wow, Hahahaha, what do you see? (cainiao performance)

Code: -------------------------------------------------------------------------------- // Action script...

// [OnClipEvent of sprite 1 in frame 1]
// Component construct ()
{
FV_AcceptedURLs_array = [];
FV_AcceptedURLs_array [0] = "www. *****. cn ";
FV_AcceptedURLs_array [1] = "www. *****. net ";
FV_AcceptedURLs_array [2] = "www. ******* .com.cn ";
FV_AcceptedURLs_array [3] = "www. ******* .net.cn ";
FV_AcceptedURLs_array [4] = "www. ******. cn ";
FV_AcceptedURLs_array [5] = "www. *******. net ";
FV_AcceptedURLs_array [6] = "www. *******. com ";
FV_AcceptedURLs_array [7] = "www. *******. com ";
FV_AcceptedURLs_array [8] = "www. ******* .net.cn ";
FV_ExactURL_bool = false;
FV_AllowFromHDD_bool = false;
FV_ShowWarning_bool = false;
}

// [OnClipEvent of sprite 1 in frame 1044]
// Component construct ()
{
FV_AcceptedURLs_array = [];
FV_AcceptedURLs_array [0] = "www. *****. cn ";
FV_AcceptedURLs_array [1] = "www. *****. net ";
FV_AcceptedURLs_array [2] = "www. ******* .com.cn ";
FV_AcceptedURLs_array [3] = "www. ******* .net.cn ";
FV_AcceptedURLs_array [4] = "www. ******. cn ";
FV_AcceptedURLs_array [5] = "www. *******. net ";
FV_AcceptedURLs_array [6] = "www. *******. com ";
FV_AcceptedURLs_array [7] = "www. *******. com ";
FV_AcceptedURLs_array [8] = "www. ******* .net.cn ";
FV_ExactURL_bool = false;
FV_AllowFromHDD_bool = false;
FV_ShowWarning_bool = false;
}--------------------------------------------------------------------------------

// Hide the website information to avoid unnecessary troubles


Note that FV_AllowFromHDD_bool = false;
I'm a fool, but I know it defines a variable to make it equal to false
What is the variable name? Can AllowFromHDD be played from hard disk?
Haha, I am very lazy ~~~~ Everyone knows
So we only need to modify FV_AllowFromHDD_bool = true to see it (conjecture)
But how can it be modified? Sothink SWF Decompiler cannot be modified (maybe I didn't find pai_^)
We invite the protagonist of today: flasm html "> http://www.nowrap.de/flasm.html
Let's take a look at the help

Code :--------------------------------------------------------------------------------
Flasm command filename
Command
-D decompile the SWF file to the console (cmd)
-A: Compile the Flasm project
-U updates SWF and replace Flasm macros (not readable)
-Z compression SWF with zLib
-X decompress SWF
-D foo.swf
Disassemble foo.swf to the console.

-D foo.swf> foo. flm
Decompress foo.swf and save it to foo. flm. The simplest method is flasm foo.swf. Create foo. flm to the same folder.

-A foo. flm
Compile foo. flm and to update the definition in the SWF file.
Create a backup. $ wf.

-U foo.swf
Decompilation foo.swf

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.