コード例 #1
0
ファイル: compile.py プロジェクト: sldr23876/unrpyc
from renpy import script_version
from renpy.game import script
({'version': script_version, 'key': script.key}, [])
""", (Module("util", path.join(base_folder, "decompiler/util.py")),
      Module("magic", path.join(base_folder, "decompiler/magic.py"), False),
      Module("codegen", path.join(base_folder, "decompiler/codegen.py")),
      Module("testcasedecompiler",
             path.join(base_folder, "decompiler/testcasedecompiler.py")),
      Module("screendecompiler",
             path.join(base_folder, "decompiler/screendecompiler.py")),
      Module("sl2decompiler",
             path.join(base_folder, "decompiler/sl2decompiler.py")),
      Module("decompiler", path.join(base_folder, "decompiler/__init__.py")),
      Module("unrpyc", path.join(pack_folder, "unrpyc-compile.py"))))

unrpyc = zlib.compress(p.optimize(p.dumps(decompiler, protocol), protocol), 9)

with open(path.join(pack_folder, "un.rpyc"), "wb") as f:
    f.write(unrpyc)

if args.debug:
    print("File length = {0}".format(len(unrpyc)))

    import pickletools

    data = zlib.decompress(unrpyc)

    with open(path.join(pack_folder, "un.dis"), "wb" if p.PY2 else "w") as f:
        pickletools.dis(data, f)

    for com, arg, _ in pickletools.genops(data):
コード例 #2
0
ファイル: compile.py プロジェクト: AndrewSkat/unrpyc
({'version': script_version, 'key': script.key}, [])
""", (
    Module("util", path.join(base_folder, "decompiler/util.py")),
    Module("magic", path.join(base_folder, "decompiler/magic.py"), False),
    Module("codegen", path.join(base_folder, "decompiler/codegen.py")),
    Module("testcasedecompiler", path.join(base_folder, "decompiler/testcasedecompiler.py")),
    Module("screendecompiler", path.join(base_folder, "decompiler/screendecompiler.py")),
    Module("sl2decompiler", path.join(base_folder, "decompiler/sl2decompiler.py")),
    Module("decompiler", path.join(base_folder, "decompiler/__init__.py")),
    Module("unrpyc", path.join(pack_folder, "unrpyc-compile.py"))
))


unrpyc = zlib.compress(
             p.optimize(
                 p.dumps(decompiler, protocol),
             protocol),
         9)

with open(path.join(pack_folder, "un.rpyc"), "wb") as f:
    f.write(unrpyc)

if args.debug:
    print("File length = {0}".format(len(unrpyc)))

    import pickletools

    data = zlib.decompress(unrpyc)

    with open(path.join(pack_folder, "un.dis"), "wb" if p.PY2 else "w") as f:
        pickletools.dis(data, f)
コード例 #3
0
ファイル: compile.py プロジェクト: titan5555/unrpyc
                    Module("sl2decompiler", path.join(base_folder, "decompiler/sl2decompiler.py")),
                    Module("decompiler", path.join(base_folder, "decompiler/__init__.py")),
                    Module("unrpyc", path.join(pack_folder, "unrpyc-compile.py")),
                    p.Imports("unrpyc", "decompile_game")(),
                    p.Imports("magic", "remove_fake_package")("renpy"),
                    p.Imports("sys", "modules").update(p.Load("renpy_modules")),
                    p.Imports("sys", "meta_path").append(p.Load("renpy_loader")),
                    p.AssignGlobal("__package__", p.Load("package"), False),
                    p.Imports("renpy", "script_version") # I wonder why I even bother with this since by the time this is checked, we've already done damage
                    )

rpyc = ({'version': decompiler, 'key': p.Imports("renpy.game", "script").key}, [])

unrpyc = zlib.compress(
             p.optimize(
                 p.dumps(rpyc, protocol),
             protocol),
         9)

with open(path.join(pack_folder, "un.rpyc"), "wb") as f:
    f.write(unrpyc)

if args.debug:
    print("File length = {0}".format(len(unrpyc)))

    import pickletools

    data = zlib.decompress(unrpyc)

    with open(path.join(pack_folder, "un.dis"), "wb" if p.PY2 else "w") as f:
        pickletools.dis(data, f)
コード例 #4
0
ファイル: compile.py プロジェクト: Gouvernathor/unrpyc
    magic.FakeModule(b"astdump")
    magic.FakeModule(b"translate")

    # ?????????
    unrpyc = pickle.loads(base64.b64decode({}))
    unrpyc.decompile_game()

    magic.remove_fake_package(b"renpy")

    sys.modules.update(renpy_modules)
    sys.meta_path.append(renpy_loader)
"""

unrpyc = zlib.compress(
    p.optimize(
        p.dumps(decompiler_rpyc, protocol),
    protocol),
9)

bytecoderpyb = zlib.compress(
    p.optimize(
        p.dumps(decompiler_rpyb, protocol),
    protocol),
9)

unrpy = rpy_base.format(
    repr(base64.b64encode(p.optimize(p.dumps(rpy_one, protocol), protocol))),
    repr(base64.b64encode(p.optimize(p.dumps(rpy_two, protocol), protocol)))
)

コード例 #5
0
ファイル: compile.py プロジェクト: Alex-fuelx/unrpyc
({'version': script_version, 'key': script.key}, [])
""", (
    Module("util", path.join(base_folder, "decompiler/util.py")),
    Module("magic", path.join(base_folder, "decompiler/magic.py"), False),
    Module("codegen", path.join(base_folder, "decompiler/codegen.py")),
    Module("testcasedecompiler", path.join(base_folder, "decompiler/testcasedecompiler.py")),
    Module("screendecompiler", path.join(base_folder, "decompiler/screendecompiler.py")),
    Module("sl2decompiler", path.join(base_folder, "decompiler/sl2decompiler.py")),
    Module("decompiler", path.join(base_folder, "decompiler/__init__.py")),
    Module("unrpyc", path.join(pack_folder, "unrpyc-compile.py"))
))


unrpyc = zlib.compress(
             p.optimize(
                 p.dumps(decompiler, protocol),
             protocol),
         9)

with open(path.join(pack_folder, "un.rpyc"), "wb") as f:
    f.write(unrpyc)

if args.debug:
    print("File length = {0}".format(len(unrpyc)))

    import pickletools

    data = zlib.decompress(unrpyc)

    with open(path.join(pack_folder, "un.dis"), "wb" if p.PY2 else "w") as f:
        pickletools.dis(data, f)
コード例 #6
0
decompiler_rpyb = p.ExecTranspile(
    base + "(None, [])\n",
    (Module("util", path.join(base_folder, "decompiler/util.py")),
     Module("magic", path.join(base_folder, "decompiler/magic.py"), False),
     Module("codegen", path.join(base_folder, "decompiler/codegen.py")),
     Module("testcasedecompiler",
            path.join(base_folder, "decompiler/testcasedecompiler.py")),
     Module("screendecompiler",
            path.join(base_folder, "decompiler/screendecompiler.py")),
     Module("sl2decompiler",
            path.join(base_folder, "decompiler/sl2decompiler.py")),
     Module("decompiler", path.join(base_folder, "decompiler/__init__.py")),
     Module("unrpyc", path.join(pack_folder, "unrpyc-compile.py"))))

unrpyc = zlib.compress(
    p.optimize(p.dumps(decompiler_rpyc, protocol), protocol), 9)

bytecoderpyb = zlib.compress(
    p.optimize(p.dumps(decompiler_rpyb, protocol), protocol), 9)

with open(path.join(pack_folder, "un.rpyc"), "wb") as f:
    f.write(unrpyc)

with open(path.join(pack_folder, "bytecode.rpyb"), "wb") as f:
    f.write(bytecoderpyb)

if args.debug:
    print("File length = {0}".format(len(unrpyc)))

    import pickletools