Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Requires parallel, jpexs, and uncrustify
- For use on Linux, but I'm sure you can convert it
- Could probably be optimized quite a bit, it was done relatively quick
- """
- import subprocess
- from urllib.request import urlretrieve
- import sys
- import fileinput
- import glob
- import string
- import os
- import re
- import json
- import pprint
- import traceback
- def getLatest():
- try:
- print("Getting latest chat version from chat.swf...",)
- urlretrieve("http://xatech.com/web_gear/chat/chat2.swf", "chat.swf")
- chat = subprocess.check_output("swfdump -a chat.swf | grep chat", shell=True).decode('utf-8')
- subprocess.call("ls | grep -v latest.py | grep -v uncrustify.cfg | parallel rm -rf", shell=True)
- chat = re.search("//www.xatech.com/web_gear/flash/(.*).swf", chat).group(1)
- print("Got", chat)
- return chat
- except Exception as e:
- print("Download failed 1")
- print(e)
- traceback.print_exc()
- sys.exit(0)
- def download(chat):
- print("Downloading http://www.xatech.com/web_gear/flash/" + chat.lower() + ".swf")
- try:
- urlretrieve("http://www.xatech.com/web_gear/flash/" +
- chat.lower() + ".swf", chat.lower() + ".swf")
- print("Download successful")
- return chat.lower() + ".swf"
- except Exception as e:
- print("Download failed 2")
- print(e)
- traceback.print_exc()
- sys.exit()
- def decompile(chat):
- print("Decompiling ./" + chat.lower() + ".swf")
- subprocess.call("ffdec -export fla \"./\" ./" + chat + ".swf", shell=True)
- print('Decompiled')
- return
- def beautify():
- subprocess.call('find . -name "*.as" | parallel uncrustify -c uncrustify.cfg --replace --no-backup', shell=True)
- print("Done beautifying")
- return
- chat = getLatest()
- download(chat)
- decompile(chat)
- beautify()
- subprocess.call("find . -name '*.swf' | gawk -F. '{print $2}' | gawk -F/ '{print $2}' | xargs git commit -am", shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement