Skip to content

Instantly share code, notes, and snippets.

@computerfan
Created October 21, 2020 06:47
Show Gist options
  • Select an option

  • Save computerfan/1dff0d66fa8d475beb290888db71f2b5 to your computer and use it in GitHub Desktop.

Select an option

Save computerfan/1dff0d66fa8d475beb290888db71f2b5 to your computer and use it in GitHub Desktop.
pjsk_deobfus
# project sekai资源头文件反混淆。直接扔到资源文件根目录运行。
import os
def deobfus_asset(input, output):
with open(input, 'rb') as f:
if f.read(4) == b'\x10\x00\x00\x00':
with open(output, 'wb') as out:
for i in range(128):
d = f.read(1)
if i % 8 < 5:
d = ((~d[0]) & 0xff).to_bytes(1, 'little', signed=False)
out.write(d)
out.write(f.read())
if __name__ == "__main__":
g = os.walk(os.path.curdir)
for path, dir_list, file_list in g:
for file_name in file_list:
deobfus_asset(os.path.join(path, file_name),
os.path.join(path, file_name+'_new'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment