迷你世界全解密代码

# 本程序原创:SanYan(请尊重原创!)
# 完善作者:王鹏
# 使用教程:创建一个目录
# /storage/emulated/0/qpython/解密/
# 把要解密的文件或者文件夹解压进去
# 执行程序
# 即可全部解密(能直接把assets丢进去)
import zlib
import os
import time
import shutil

# 定义zlib解压函数
def decompress(infile, dst):
    with open(infile, 'rb') as in_file, open(dst, 'wb') as out_file:
        decompress_obj = zlib.decompressobj()
        data = in_file.read(1024)
        while data:
            out_file.write(decompress_obj.decompress(data))
            data = in_file.read(1024)
        out_file.write(decompress_obj.flush())

# 定义解密函数
def xor(data, key):
    key_len = len(key)
    data_len = len(data)
    key = (data_len // key_len) * key + key[:data_len % key_len]
    return bytearray(a ^ b for a, b in zip(data, key))

# 解密需要用到的key
key = b"\xd6\x02\x08\x00\xf4\xfe\xff\x3f\x01\x00\x00\x00\xd0\xca\x01\x00"

# 解密路径
folder_path = '/storage/emulated/0/qpython/解密/'

# 通用文件处理函数
def process_file(file_path, ext):
    backup_path = file_path + ".bak"
    try:
        # 创建文件备份
        shutil.copyfile(file_path, backup_path)

        with open(file_path, 'rb') as in_file:
            data = in_file.read()[8:]  # 去掉前8个字节
        with open(file_path + "*", 'wb') as out_file:
            out_file.write(data)
        with open(file_path + "*", 'rb') as in_file:
            data = in_file.read()
        with open(file_path + "dec", 'wb') as out_file:
            out_file.write(xor(data, key))
        decompress(file_path + "dec", file_path[:-4] + ext)
        os.remove(file_path + "*")
        os.remove(file_path + "dec")

        # 解密成功,删除备份文件和临时文件
        os.remove(backup_path)
    except Exception as e:
        print(f"处理文件 {file_path} 时出错: {e}")
        # 还原文件并删除备份文件
        shutil.copyfile(backup_path, file_path)
        os.remove(backup_path)

# 递归遍历文件夹及其子目录
def process_files(folder_path):
    for filename in os.listdir(folder_path):
        file_path = os.path.join(folder_path, filename)
        if os.path.isfile(file_path):
            if filename.endswith(".csv"):
                process_file(file_path, ".csv")
            elif filename.endswith(".lua"):
                process_file(file_path, ".lua")
            elif filename.endswith(".ktx"):
                process_file(file_path, ".ktx")
            elif filename.endswith(".xml"):
                process_file(file_path, ".xml")
            elif filename.endswith(".ogg"):
                process_file(file_path, ".ogg")
        elif os.path.isdir(file_path):
            process_files(file_path)

# 删除解密后的文件名中的%号
def rename_files(folder_path):
    for filename in os.listdir(folder_path):
        file_path = os.path.join(folder_path, filename)
        if '%' in filename:
            new_filename = filename.replace('%', '')
            os.rename(file_path, os.path.join(folder_path, new_filename))
        if os.path.isdir(file_path):
            rename_files(file_path)

# 删除包含*和dec的文件
def delete_temp_files(folder_path):
    for filename in os.listdir(folder_path):
        file_path = os.path.join(folder_path, filename)
        if '*' in filename or 'dec' in filename:
            os.remove(file_path)
        if os.path.isdir(file_path):
            delete_temp_files(file_path)

# 主函数
def main():
    start_time = time.time()  # 记录开始时间
    print("————解密中,请稍后...————")
    process_files(folder_path)
    rename_files(folder_path)
    delete_temp_files(folder_path)
    end_time = time.time()  # 记录结束时间
    elapsed_time = end_time - start_time  # 计算耗时
    print(f"————解密成功, 总耗时: {elapsed_time:.2f} 秒————")  # 输出总耗时
    print("————原创作者:SanYan————")  # 请保留此条信息,谢谢!
    print("————完善作者:王鹏————")  

if __name__ == "__main__":
    main()

 

请登录后发表评论

    没有回复内容