This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Yet Another SWF Parser.

You can pronounce whatever you like :)

How to use it

You can use swfparser.py as command line program or as a module.

If you execute directly the usage is:

swfparser.py [-h] [-t] [-e] filepath

positional arguments:
  filepath         the SWF file to parse

optional arguments:
  -h, --help       show this help message and exit
  -t, --show-tags  show the first level tags of the file
  -e, --extended   show all objects with full detail and nested

If you want to use it as a module, you can use the SWFParser class directly or the handy parsefile function:

>>> swf = swfparser.parsefile(<yourSWFfile>)
>>> swf.header
Header(name=Header, FileLength=4228, ...)
>>> len(swf.tags)
365
>>> swf.tags[0]
UnknownObject(name=SetBackgroundColor, raw_payload=b'\xff\xff\xff')
>>> swf.tags[3]
>>> obj = swf.tags[3]
>>> obj
PlaceObject2(name=PlaceObject2, CharacterId=1, ...)
>>> obj.CharacterId
1
>>> obj.Matrix.ScaleX
65536

This follows the SWF File Format Specification Version 19, but it is not (yet) 100% covered, so you may find some unknown objects.

How to deal with still-unknown-objects

Not all the spec is covered (this is a work in progress!).

When the parser finds a structure that still can’t process (because more programming is needed), will just return an UnknownObject object with the unparsed bytes, or will raise an exception if you set the unknown_alert flag:

SWFParser.unknown_alert = True

Add new structures to the parser is very simple. I’ll be very glad to do it if you offer a real stream of bytes as an example or even a sample SWF file with the still missing object inside.

Checking coverage

There is an easy way of checking how many of the objects (tags, actions, structures, etc) are properly covered by the parser: just use the coverage parameter:

$ python3 yaswfp/swfparser.py -c yaswfp/tests/samples/1252533834.swf
Header(Signature='CWS', ...)
Tags count: 55
Coverage is 97.3% of 74 total items
Most common parsed objects:
   22 PlaceObject2
   21 ShowFrame
   10 LineStyleArray
Most common Unknown objects
    2 DefineMorphShape2

Development

To run the tests:

./test

You’ll need python3-flake8 and python3-nose. Of course, this is Python 3.

To complete some methods or be able to parse new structures, we should add examples that show that new stuff, see current “sanity” tests. Yes, unit tests are desirable, feel free to add those too.

The project is hosted in GitHub:

https://github.com/facundobatista/yaswfp

Contact

Any doubt, any question, any suggestion, or whatever, feel free to open an issue in GitHub or find me in IRC, I’m facundobatista in Freenode.

Thanks!

Release History

Release History

0.9.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
yaswfp-0.9.3.tar.gz (29.8 kB) Copy SHA256 Checksum SHA256 Source Aug 27, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting