求助《重构:阿塔提斯》有没有大佬会解包的

from typing import Union
from pathlib import Path
from io import BufferedReader
from ctea import decrypt as ctea
from lzma import decompress as dlzma

def checkbytes(data: bytes) -> Union[bytes, bytearray]:
    if data[:5] == b'\x5D\x00\x00\x80\x00':
        try: decd = dlzma(data)
        except: return data
        return checkbytes(decd)
    elif data[:8] == b'\xDB\x86\xE3\xD0\xE5\x6C\x26\x70':
        decd = bytearray(data)
        ctea(decd)
        if decd[:8] != b'UnityFS\x00': return data
        return decd
    else:
        return data

def split7z(f: BufferedReader, fp: Path):
    gint = lambda f=f, i=4, b='little', s=False: int.from_bytes(f.read(i), byteorder=b, signed=s)
    gstr = lambda f=f, i=256, e='utf-8': f.read(i).rstrip(b'\x00').decode(e)
    path = fp.parent.joinpath('extract')
    f.seek(-4, 2)
    count = gint()
    f.seek(0)
    for _ in range(count):
        blen = gint()
        bty = gint()
        name = gstr()
        if blen <= 0: continue
        data = f.read(blen)
        head = data[:16]
        data = checkbytes(data)
        snm = path.joinpath(f'{name}@{bty}.ab')
        n = 1
        while snm.exists():
            n += 1
            snm = path.joinpath(f'{name}@{bty}_{n}.ab')
        snmp = snm.parent
        snmp.mkdir(parents=True, exist_ok=True)
        with open(snm, 'wb') as ff:
            ff.write(data)
        if data == head: print('Error - ', snm, f.tell(), blen, bty, name)

def open7z(fp: Path):
    with open(fp, 'rb') as f:
        split7z(f, fp)

def checkfile(tgpath: str):
    path = Path(tgpath)
    for i in path.rglob('*'):
        if not i.is_file(): continue
        if i.suffix == '.7z':
            open7z(i)
        else:
            with open(i, 'rb') as f:
                check = f.read(8)
                if not check.startswith((b'\x5D\x00\x00\x80\x00', b'\xDB\x86\xE3\xD0\xE5\x6C\x26\x70')): continue
                f.seek(0)
                data = f.read()
            check = data[:16]
            decd = checkbytes(data)
            if decd[:16] == check:
                print('Error - ', i.as_posix())
                continue
            with open(i, 'wb') as f:
                f.write(decd)

if __name__ == '__main__':
    path = Path.cwd().as_posix()
    checkfile(path)

1 个赞

谢谢大佬,冒昧的问一下这个代码该怎么用

复制到文本,然后改后缀名为.py 前提是你已经安装python,站内有其他大佬喂饭级python教程 一切安装好了后 把apk解压 把.py文件复制到APKAssets文件夹内,在地址栏输入CMD 进去后输入python空格把py文件拖进去回车 如果你刚装python 肯定会报错缺东西 No module named xxx 你就输入 pip install xxx 有些安装不了的 你就百度 这些都弄好以后 运行完成后就可以用AS 选Fakehead解开了

2 个赞