Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing strings inside SWF [closed]

Tags:

flash

We've got dozens of versions of an SWF modified for different customers of a big Flash project, and now would have to replace some strings embedded in scripts in each copy. The FLA file for some of these is very difficult to locate or even missing (I inherited this mess and refactoring it is currently not an option).

Is there a (free) tool to replace strings used inside ActionScript? I tried swfmill to convert the files to XML and back but it can't handle international characters contained in the strings so I could get them only partially converted. Most of the strings were correctly extracted so another tool might do the job.

like image 692
jjrv Avatar asked Sep 23 '08 07:09

jjrv


3 Answers

You could try Burak's URL Action Editor -- it says URL, but I'm pretty sure it lets you edit any text in a SWF. I haven't used it, but I have used his ActionScript Viewer, which works wonderfully.

like image 176
davr Avatar answered Oct 20 '22 16:10

davr


You can use Apparat for this kind of task. It allows you to alter ActionScript 3 bytecode in SWF and SWC files.

I would prefer the Scala source branch for your task. Basically the code would look like this:

val swf = Swf from "in.swf"
for(tag <- swf.tags) {
  (Abc fromTag tag) match {
    case Some(abc) => {
      val strings = abc.cpool.strings
      for(i <- 1 until strings.length) {
        if(strings(i) == 'search) {
          strings(i) = 'replacement
        }
      }
      abc write tag
    }
    case None =>
}
swf write "out.swf"
like image 37
Joa Ebert Avatar answered Oct 20 '22 16:10

Joa Ebert


Well the only advice I can come up with is to fix swfmill to support international characters. You might want to ask in swfmill mailing list ([email protected] as far as I know) for a best way how to do it, shouldn't be too difficult if you know C/C++ a bit.

like image 33
Michael Pliskin Avatar answered Oct 20 '22 15:10

Michael Pliskin