SWFTools/swfdump

From aldeid
Jump to navigation Jump to search
DRAFT
This page is still a draft. Thank you for your understanding.
You are here:
swfdump

Description

INCOMPLETE SECTION OR ARTICLE
This section/article is being written and is therefore not complete.
Thank you for your comprehension.

Usage

Syntax

Usage: swfdump [-atpdu] file.swf

Options

-h, --help
Print short help message and exit
-D, --full
Show everything. Same as -atp
-V, --version
Print version info and exit
-e, --html
Print out html code for embedding the file
-E, --xhtml
Print out xhtml code for embedding the file
-a, --action
Disassemble action tags
-t, --text
Show text fields (like swfstrings).
-s, --shapes
Show shape coordinates/styles
-F, --fonts
Show font information
-p, --placements
Show placement information
-B, --buttons
Show button information
-b, --bbox
Print tag's bounding boxes
-X, --width
Prints out a string of the form "-X width".
-Y, --height
Prints out a string of the form "-Y height".
-r, --rate
Prints out a string of the form "-r rate".
-f, --frames
Prints out a string of the form "-f framenum".
-d, --hex
Print hex output of tag data, too.
-u, --used
Show referred IDs for each Tag.

Example

Our example is about a Flash file that is using ActionScript 3 (refer to this table). Let's use swfdump to disassemble our file:

$ swfdump -Ddu clipboard-poc.swf 
[HEADER]        File version: 9
[HEADER]        File is zlib compressed. Ratio: 71%
[HEADER]        File size: 606
[HEADER]        Frame rate: 12.000000
[HEADER]        Frame count: 1
[HEADER]        Movie width: 550.00
[HEADER]        Movie height: 400.00
[045]         4 FILEATTRIBUTES as3
                -=> 08 00 00 00                                         ....
[009]         3 SETBACKGROUNDCOLOR (ff/ff/ff)
                -=> ff ff ff                                            ���
[056]        11 SCENEDESCRIPTION
                -=> 01 00 53 63 65 6e 65 20 31 00 00                    ..Scene 1..
[052]       515 DOABC, lazy load
protectedNS([protected]test_fla:MainTimeline) class <q>[public]test_fla::MainTimeline extends <q>[public]flash.display::MovieClip{
     staticconstructor * =()(0 params, 0 optional)
    [stack:1 locals:1 scope:9-10 flags:]
    {
        00000) + 0:0 getlocal_0 
        00001) + 1:0 pushscope 
        00002) + 0:1 returnvoid 
    }

     constructor * <q>[public]test_fla::MainTimeline=()(0 params, 0 optional)
    [stack:3 locals:1 scope:10-11 flags:]
    {
        00000) + 0:0 getlocal_0 
        00001) + 1:0 pushscope 
        00002) + 0:1 getlocal_0 
        00003) + 1:1 constructsuper 0 params
        00004) + 0:1 findpropstrict <q>[public]::addFrameScript
        00005) + 1:1 pushbyte 0
        00006) + 2:1 getlex <q>[packageinternal]test_fla::frame1
        00007) + 3:1 callpropvoid <q>[public]::addFrameScript, 2 params
        00008) + 0:1 returnvoid 
    }

     method * <q>[packageinternal]test_fla::frame1=()(0 params, 0 optional)
    [stack:3 locals:1 scope:10-11 flags:] slot:0
    {
        00000) + 0:0 getlocal_0 
        00001) + 1:0 pushscope 
        00002) + 0:1 findpropstrict <q>[public]flash.utils::setInterval
        00003) + 1:1 getlex <q>[public]::setClip
        00004) + 2:1 pushbyte 1
        00005) + 3:1 callpropvoid <q>[public]flash.utils::setInterval, 2 params
        00006) + 0:1 returnvoid 
    }

     method * <q>[public]::setClip=()(0 params, 0 optional)
    [stack:2 locals:1 scope:10-11 flags:] slot:0
    {
        00000) + 0:0 getlocal_0 
        00001) + 1:0 pushscope 
        00002) + 0:1 getlex <q>[public]flash.system::System
        00003) + 1:1 pushstring "http://www.evil.com"
        00004) + 2:1 callpropvoid <q>[public]::setClipboard, 1 params
        00005) + 0:1 returnvoid 
    }

}

 initmethod * init=()(0 params, 0 optional)
[stack:2 locals:1 scope:1-9 flags:]
{
    00000) + 0:0 getlocal_0 
    00001) + 1:0 pushscope 
    00002) + 0:1 getscopeobject 0
    00003) + 1:1 getlex <q>[public]::Object
    00004) + 2:1 pushscope 
    00005) + 1:2 getlex <q>[public]flash.events::EventDispatcher
    00006) + 2:2 pushscope 
    00007) + 1:3 getlex <q>[public]flash.display::DisplayObject
    00008) + 2:3 pushscope 
    00009) + 1:4 getlex <q>[public]flash.display::InteractiveObject
    00010) + 2:4 pushscope 
    00011) + 1:5 getlex <q>[public]flash.display::DisplayObjectContainer
    00012) + 2:5 pushscope 
    00013) + 1:6 getlex <q>[public]flash.display::Sprite
    00014) + 2:6 pushscope 
    00015) + 1:7 getlex <q>[public]flash.display::MovieClip
    00016) + 2:7 pushscope 
    00017) + 1:8 getlex <q>[public]flash.display::MovieClip
    00018) + 2:8 newclass [classinfo 00000000 <q>[public]test_fla::MainTimeline]
    00019) + 2:8 popscope 
    00020) + 2:7 popscope 
    00021) + 2:6 popscope 
    00022) + 2:5 popscope 
    00023) + 2:4 popscope 
    00024) + 2:3 popscope 
    00025) + 2:2 popscope 
    00026) + 2:1 initproperty <q>[public]test_fla::MainTimeline
    00027) + 0:1 returnvoid 
}

slot 1: class <q>[public]test_fla::MainTimeline=MainTimeline
                -=> 01 00 00 00 00 10 00 2e 00 00 00 00 17 08 74 65     ..............te
                -=> 73 74 5f 66 6c 61 0c 4d 61 69 6e 54 69 6d 65 6c     st_fla.MainTimel
                -=> 69 6e 65 0d 66 6c 61 73 68 2e 64 69 73 70 6c 61     ine.flash.displa
                -=> 79 09 4d 6f 76 69 65 43 6c 69 70 15 74 65 73 74     y.MovieClip.test
                -=> 5f 66 6c 61 3a 4d 61 69 6e 54 69 6d 65 6c 69 6e     _fla:MainTimelin
                -=> 65 06 66 72 61 6d 65 31 00 07 73 65 74 43 6c 69     e.frame1..setCli
                -=> 70 0c 66 6c 61 73 68 2e 73 79 73 74 65 6d 06 53     p.flash.system.S
                -=> 79 73 74 65 6d 13 68 74 74 70 3a 2f 2f 77 77 77     ystem.http://www
                -=> 2e 65 76 69 6c 2e 63 6f 6d 0c 73 65 74 43 6c 69     .evil.com.setCli
                -=> 70 62 6f 61 72 64 0b 66 6c 61 73 68 2e 75 74 69     pboard.flash.uti
                -=> 6c 73 0b 73 65 74 49 6e 74 65 72 76 61 6c 0e 61     ls.setInterval.a
                -=> 64 64 46 72 61 6d 65 53 63 72 69 70 74 06 4f 62     ddFrameScript.Ob
                -=> 6a 65 63 74 0c 66 6c 61 73 68 2e 65 76 65 6e 74     ject.flash.event
                -=> 73 0f 45 76 65 6e 74 44 69 73 70 61 74 63 68 65     s.EventDispatche
                -=> 72 0d 44 69 73 70 6c 61 79 4f 62 6a 65 63 74 11     r.DisplayObject.
                -=> 49 6e 74 65 72 61 63 74 69 76 65 4f 62 6a 65 63     InteractiveObjec
                -=> 74 16 44 69 73 70 6c 61 79 4f 62 6a 65 63 74 43     t.DisplayObjectC
                -=> 6f 6e 74 61 69 6e 65 72 06 53 70 72 69 74 65 09     ontainer.Sprite.
                -=> 16 01 16 03 18 05 17 01 16 07 16 09 16 0d 16 11     ................
                -=> 00 0f 07 01 02 07 02 04 07 04 06 07 05 08 07 06     ................
                -=> 0a 07 05 0c 07 07 0e 07 05 0f 07 05 10 07 08 12     ................
                -=> 07 02 13 07 02 14 07 02 15 07 02 16 05 00 00 00     ................
                -=> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00     ................
                -=> 00 00 01 01 02 08 03 00 03 02 03 01 00 02 04 01     ................
                -=> 00 01 00 00 01 04 01 01 04 01 00 05 00 01 01 09     ................
                -=> 0a 03 d0 30 47 00 00 01 02 01 0a 0b 0a d0 30 60     ..�0G........�0`
                -=> 05 2c 0b 4f 06 01 47 00 00 02 03 01 0a 0b 0c d0     .,.O..G........
                -=> 30 5d 07 60 04 24 01 4f 07 02 47 00 00 03 03 01     0].`.$.O..G.....
                -=> 0a 0b 0f d0 30 d0 49 00 5d 08 24 00 60 03 4f 08     ...�0�I.].$.`.O.
                -=> 02 47 00 00 04 02 01 01 09 27 d0 30 65 00 60 09     .G.......'�0e.`.
                -=> 30 60 0a 30 60 0b 30 60 0c 30 60 0d 30 60 0e 30     0`.0`.0`.0`.0`.0
                -=> 60 02 30 60 02 58 00 1d 1d 1d 1d 1d 1d 1d 68 01     `.0`.X........h.
                -=> 47 00 00                                            G..
[04c]        26 SYMBOLCLASS
                exports 0000 as "test_fla.MainTimeline"
                uses IDs: 0==== Error: Id 0000 is not yet defined.
 ====

                -=> 01 00 00 00 74 65 73 74 5f 66 6c 61 2e 4d 61 69     ....test_fla.Mai
                -=> 6e 54 69 6d 65 6c 69 6e 65 00                       nTimeline.
[001]         0 SHOWFRAME 1 (00:00:00,000)
[000]         0 END

Comments