def decompile_rpyc(input_filename, overwrite=False, dump=False, decompile_python=False, comparable=False, no_pyexpr=False, translator=None): # Output filename is input filename but with .rpy extension filepath, ext = path.splitext(input_filename) out_filename = filepath + ('.txt' if dump else '.rpy') with printlock: print "Decompiling %s to %s..." % (input_filename, out_filename) if not overwrite and path.exists(out_filename): print "Output file already exists. Pass --clobber to overwrite." return False # Don't stop decompiling if one file already exists with open(input_filename, 'rb') as in_file: ast = read_ast_from_file(in_file) with codecs.open(out_filename, 'w', encoding='utf-8') as out_file: if dump: astdump.pprint(out_file, ast, decompile_python=decompile_python, comparable=comparable, no_pyexpr=no_pyexpr) else: decompiler.pprint(out_file, ast, decompile_python=decompile_python, printlock=printlock, translator=translator) return True
def decompile_rpyc(input_filename, overwrite=False, dump=False, decompile_python=False, comparable=False, no_pyexpr=False): # Output filename is input filename but with .rpy extension filepath, ext = path.splitext(input_filename) out_filename = filepath + ('.txt' if dump else '.rpy') printlock.acquire() print "Decompiling %s to %s..." % (input_filename, out_filename) if not overwrite and path.exists(out_filename): print "Output file already exists. Pass --clobber to overwrite." printlock.release() return False # Don't stop decompiling if one file already exists printlock.release() with open(input_filename, 'rb') as in_file: ast = read_ast_from_file(in_file) with codecs.open(out_filename, 'w', encoding='utf-8') as out_file: if dump: astdump.pprint(out_file, ast, decompile_python=decompile_python, comparable=comparable, no_pyexpr=no_pyexpr) else: decompiler.pprint(out_file, ast, decompile_python=decompile_python, printlock=printlock) return True
def decompile_rpyc(input_filename, overwrite=False, dump=False, decompile_python=False, comparable=False, no_pyexpr=False, translator=None, init_offset=False): # Output filename is input filename but with .rpy extension filepath, ext = path.splitext(input_filename) if dump: out_filename = filepath + ".txt" elif ext == ".rpymc": out_filename = filepath + ".rpym" else: out_filename = filepath + ".rpy" with printlock: print("Decompiling %s to %s..." % (input_filename, out_filename)) if not overwrite and path.exists(out_filename): print("Output file already exists. Pass --clobber to overwrite.") return False # Don't stop decompiling if one file already exists with open(input_filename, 'rb') as in_file: ast = read_ast_from_file(in_file) with codecs.open(out_filename, 'w', encoding='utf-8') as out_file: if dump: astdump.pprint(out_file, ast, decompile_python=decompile_python, comparable=comparable, no_pyexpr=no_pyexpr) else: decompiler.pprint(out_file, ast, decompile_python=decompile_python, printlock=printlock, translator=translator, init_offset=init_offset) return True
def decompile_rpyc(input_filename, overwrite=False, dump=False, decompile_python=False, comparable=False, no_pyexpr=False, translator=None, tag_outside_block=False, init_offset=False, try_harder=False): # Output filename is input filename but with .rpy extension filepath, ext = path.splitext(input_filename) if dump: out_filename = filepath + ".txt" elif ext == ".rpymc": out_filename = filepath + ".rpym" else: out_filename = filepath + ".rpy" with printlock: print("Decompiling %s to %s..." % (input_filename, out_filename)) if not overwrite and path.exists(out_filename): print("Output file already exists. Pass --clobber to overwrite.") return False # Don't stop decompiling if one file already exists with open(input_filename, 'rb') as in_file: if try_harder: ast = deobfuscate.read_ast(in_file) else: ast = read_ast_from_file(in_file) with codecs.open(out_filename, 'w', encoding='utf-8') as out_file: if dump: astdump.pprint(out_file, ast, decompile_python=decompile_python, comparable=comparable, no_pyexpr=no_pyexpr) else: decompiler.pprint(out_file, ast, decompile_python=decompile_python, printlock=printlock, translator=translator, tag_outside_block=tag_outside_block, init_offset=init_offset) return True
def decompile_rpyc(input_filename, overwrite=False, dump=False, decompile_python=False, comparable=False, no_pyexpr=False, translator=None, init_offset=False): # Output filename is input filename but with .rpy extension filepath, ext = path.splitext(input_filename) if dump: out_filename = filepath + ".txt" elif ext == ".rpymc": out_filename = filepath + ".rpym" else: out_filename = filepath + ".rpy" if not overwrite and path.exists(out_filename): print(" Output file already exists") return False # Don't stop decompiling if one file already exists with open(input_filename, 'rb') as in_file: ast = read_ast_from_file(in_file) with codecs.open(out_filename, 'w', encoding='utf-8') as out_file: if dump: astdump.pprint(out_file, ast, decompile_python=decompile_python, comparable=comparable, no_pyexpr=no_pyexpr) else: decompiler.pprint(out_file, ast, decompile_python=decompile_python, printlock=None, translator=translator, init_offset=init_offset) return True
def decompile_rpyc(input_filename, overwrite=False, dump=False, decompile_screencode=True, decompile_python=True, force_multiline_kwargs=True): # Output filename is input filename but with .rpy extension filepath, ext = path.splitext(input_filename) out_filename = filepath + ('.txt' if dump else '.rpy') print "Decompiling %s to %s..." % (input_filename, out_filename) if not overwrite and path.exists(out_filename): print "Output file already exists. Pass --clobber to overwrite." return False # Don't stop decompiling if one file already exists with open(input_filename, 'rb') as in_file: ast = read_ast_from_file(in_file) with codecs.open(out_filename, 'w', encoding='utf-8') as out_file: if dump: astdump.pprint(out_file, ast, decompile_python=decompile_python) else: decompiler.pprint(out_file, ast, force_multiline_kwargs=force_multiline_kwargs, decompile_screencode=decompile_screencode, decompile_python=decompile_python) return True