Commits

Alexander Konovalov committed 824536f

added injector

Comments (0)

Files changed (1)

+#!/usr/bin/python3.2
+
+import sys
+import base64
+from swf.structure import *
+from swf.reader import SWFReader
+from swf.writer import SWFWriter
+from swf.tags import *
+import io
+
+if __name__ == "__main__":
+    if len(sys.argv) == 4:
+        f = open(sys.argv[2], "rb")
+        bytecode = f.read()
+        f.close()
+        
+        tag = Tag()
+        tag.type = TAG_DOACTION
+        tag.rawData = bytecode
+        
+        swf = None
+        with io.FileIO(sys.argv[1]) as f:
+          swf = SWFReader(f).read()
+        swf.header.compressed = False
+        
+        swf.tags.insert(1, tag)
+        
+        with io.FileIO(sys.argv[3], 'w+') as out:
+          SWFWriter(out).write(swf)
+    else:
+        print("Usage: inject.py input bytecode output")