idlechampimgrip.py 964 B

123456789101112131415161718192021222324
  1. import glob
  2. import re
  3. import zlib
  4. directory = '/home/txtsd/.local/share/Steam/steamapps/common/IdleChampions/IdleDragons_Data/StreamingAssets/downloaded_files/'
  5. filelist = glob.glob(directory + '*')
  6. for file in filelist:
  7. filename_segments = file.split('.')
  8. if (not 'json' in filename_segments) and (not 'txt' in filename_segments) and (not 'png' in filename_segments):
  9. with open(file, 'rb') as f:
  10. print('opened', file)
  11. loaded_file = f.read()
  12. res = re.search(b'(\\x89\\x50\\x4e\\x47\\x0d\\x0a\\x1a\\x0a.*)', loaded_file, re.MULTILINE|re.DOTALL)
  13. if res is not None:
  14. with open(file + '.png', 'wb') as g:
  15. g.write(res.group())
  16. else:
  17. data = zlib.decompress(loaded_file)
  18. res = re.search(b'(\\x89\\x50\\x4e\\x47\\x0d\\x0a\\x1a\\x0a.*)', data, re.MULTILINE|re.DOTALL)
  19. with open(file + '.png', 'wb') as g:
  20. g.write(res.group())