import sys
import imp
import glob
import marshal
import uncompyle2
files = glob.glob(r'./code/*.txt')
for plug in files:
txt = ''
with open(plug, 'r') as f:
txt = f.read()
try:
arr = eval(txt)
if imp.get_magic() == arr[1][:4]:
code = marshal.dumps(arr[1])
bin = marshal.loads(code[13:])
with open(bin.co_filename, 'w') as f:
uncompyle2.uncompyle('2.7.3', bin, f);
except:
print 'str 2 code err in file: %s' % plug