1Metadata-Version: 1.0
2Name: yaswfp
3Version: 0.9.3
4Summary: Yet Another SWF Parser.
5Home-page: http://github.com/facundobatista/yaswfp
6Author: Facundo Batista
7Author-email: facundo@taniquetil.com.ar
8License: GPL-3
9Description: yaswfp
10        ======
11
12        Yet Another SWF Parser.
13
14        You can pronounce whatever you like :)
15
16
17        How to use it
18        -------------
19
20        You can use ``swfparser.py`` as command line program or as a module.
21
22        If you execute directly the usage is::
23
24            swfparser.py [-h] [-t] [-e] filepath
25
26            positional arguments:
27              filepath         the SWF file to parse
28
29            optional arguments:
30              -h, --help       show this help message and exit
31              -t, --show-tags  show the first level tags of the file
32              -e, --extended   show all objects with full detail and nested
33
34        If you want to use it as a module, you can use the ``SWFParser`` class
35        directly or the handy ``parsefile`` function::
36
37            >>> swf = swfparser.parsefile(<yourSWFfile>)
38            >>> swf.header
39            Header(name=Header, FileLength=4228, ...)
40            >>> len(swf.tags)
41            365
42            >>> swf.tags[0]
43            UnknownObject(name=SetBackgroundColor, raw_payload=b'\xff\xff\xff')
44            >>> swf.tags[3]
45            >>> obj = swf.tags[3]
46            >>> obj
47            PlaceObject2(name=PlaceObject2, CharacterId=1, ...)
48            >>> obj.CharacterId
49            1
50            >>> obj.Matrix.ScaleX
51            65536
52
53        This follows the `SWF File Format Specification Version 19`_, but it is
54        not (yet) 100% covered, so you may find some *unknown objects*.
55
56
57        How to deal with still-unknown-objects
58        --------------------------------------
59
60        Not all the spec is covered (this is a work in progress!).
61
62        When the parser finds a structure that still can't process (because more
63        programming is needed), will just return an UnknownObject object with
64        the unparsed bytes, or will raise an exception if you set
65        the unknown_alert flag::
66
67            SWFParser.unknown_alert = True
68
69        Add new structures to the parser is very simple. I'll be very glad to
70        do it if you offer a real stream of bytes as an example or even
71        a sample SWF file with the still missing object inside.
72
73
74        Checking coverage
75        -----------------
76
77        There is an easy way of checking how many of the objects (tags, actions,
78        structures, etc) are properly covered by the parser: just use the
79        ``coverage`` parameter::
80
81            $ python3 yaswfp/swfparser.py -c yaswfp/tests/samples/1252533834.swf
82            Header(Signature='CWS', ...)
83            Tags count: 55
84            Coverage is 97.3% of 74 total items
85            Most common parsed objects:
86               22 PlaceObject2
87               21 ShowFrame
88               10 LineStyleArray
89            Most common Unknown objects
90                2 DefineMorphShape2
91
92
93        Development
94        -----------
95
96        To run the tests:
97
98            ./test
99
100        You'll need ``python3-flake8`` and ``python3-nose``. Of course, this is
101        Python 3.
102
103        To complete some methods or be able to parse new structures, we should add
104        examples that show that new stuff, see current "sanity" tests. Yes, unit tests
105        are desirable, feel free to add those too.
106
107        The project is hosted in GitHub::
108
109          https://github.com/facundobatista/yaswfp
110
111
112        Contact
113        -------
114
115        Any doubt, any question, any suggestion, or whatever, feel free to open
116        an issue in GitHub or find me in IRC, I'm ``facundobatista`` in Freenode.
117
118        Thanks!
119
120
121        .. _SWF File Format Specification Version 19: http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf-file-format-spec.pdf
122
123Platform: UNKNOWN
124