Editing Text within SWF files!

Today I was faced with the problem of changing a string within an SWF file, though I took it more of as an interesting challenge.

A colleague of mine had compiled an SWF using Adobe Captivate – an educational material builder.

Unfortunately, some of the paths were hard-coded and hence it only worked correctly on his own laptop…and I was itching to test something out.

So what does someone do ?

1st Attempt: SWF Decompiler and Options

I opened up the file in SoThink SWF Decompiler and attempted to export as an FLV file.
As there was no actual flash version I decided to manually select the version.
An FLV file was created though the result was poor.

Following I exported the .as files and had a look at the various declarations and parameters for the timeline.

2nd Attempt: Hex editor

I opened the SWF file in the 01 hex editor and searched for the string I wanted to change.
To my surprise I found nothing until I realized SWF files come in two varieties: compressed and uncompressed.
For an intro on the topic have a look at: http://forum.cheatengine.org/viewtopic.php?p=1533490

Searching on the internet I found the CWS to FWS Flash file Decompressor which must be run on a linux install with perl to create an uncompressed SWF file.(http://zefonseca.com/cws2fws/)

Once the swf file was uncompressed suddenly ascii text was visible within the hex editor.

However, changing the number of characters resulted in a broken file.
Hence,  I came up with the solution to pad with spaces or other inconsequential characters e.g. “././.”  in order to maintain the same number of characters.

This worked as a quick solution. If anyone has found where the checksum or length is recorded it would be nice to know!

Thanks.



Menelaos Bakopoulos

Mr. Menelaos Bakopoulos is currently pursuing his PhD both at Center for TeleInFrastruktur (CTiF) at Aalborg University (AAU) in Denmark and Athens Information Technology (AIT) in Athens, Greece. He received a Master in Information Technology and Telecommunications Systems from Athens Information Technology and a B.Sc. in Computer Science & Management Information Systems from the American College of Thessaloniki. Since April 2008 he has been a member of the Multimedia, Knowledge, and Web Technologies Group.

More Posts