[MPlayer-users] CD .swf Data and Audio with Linux

Vladimir Mosgalin mosgalin at VM10124.spb.edu
Sun Jul 25 20:49:36 CEST 2004


On Sun, 25 Jul 2004, rcooley wrote:

r>On Sun, 25 Jul 2004 18:12:00 +0400 (MSD)
r>Vladimir Mosgalin <mosgalin at VM10124.spb.edu> wrote:
r>
r>> 
r>> And there is nothing "self-executing" about swf file... If it has
r>> executable flag, that's just because CD was made with windows
r>> software.
r>
r>I think you got the wrong idea.  Many SWF files are made into .exe
r>files, which I assume is what the poster is talking about.

Um.. Then he needs some program to strip off executable parts. I've
written one, but it is very simple and dumb, because I wrote it
especially for masyanya (flash series popular in Russia).

It is in attachment.
Though I've seen it work for over a hundred files, it tends to fail on
some, especially on newer or bigger ones. No complains!

-- 

Vladimir
-------------- next part --------------
#! /usr/bin/env python2

"""
Strip off executable headers and flash players from flash files. Optimized
for masyanya. May fail in complex situations

(c) Vladimir Mosgalin
"""

import sys

if len(sys.argv) < 2:
	print 'Syntax: %s exefile <swffile>' % sys.argv[0]
	sys.exit(0)

if len(sys.argv) > 2:
	swffilename = sys.argv[2]
else:
	swffilename = sys.argv[1][:sys.argv[1].rfind('.exe')] + '.swf'

exefile = open(sys.argv[1], 'rb')
swffile = open(swffilename, 'wb')

exefiledata = exefile.read()
exefiledata2 = exefiledata[exefiledata.find('FWS'):]
double_signature = exefiledata2.find('FWS',10,200000)
if double_signature != -1:
	swffile.write(exefiledata2[double_signature:])
else:
	swffile.write(exefiledata2)

exefile.close()
swffile.close()


More information about the MPlayer-users mailing list