ios 游戏《魂斗罗》 AL资料素材破解

ios 游戏《魂斗罗》 AL文件素材破解


1、破解原理非常简单就是找png的8字节的前缀(baidu png 文件编码格式)。

     ios 游戏《魂斗罗》  AL资料素材破解

  2、破解就图就可以看见了

      ios 游戏《魂斗罗》  AL资料素材破解

3、这样一个个个的改是不是非常麻烦,所有我专门写了个py脚本在干这事!ios 游戏《魂斗罗》  AL资料素材破解一步搞定!

 源码如下:

import sys
import os

sys.path.append('.')
currDir = os.getcwd()

print currDir

toSearchPngHead = [0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a]

def doFileRead(file_):
   """
   Find 89 50 4e 47 0d 0a 1a 0a and write
   """
   
   sourceFile = file_
 
   targetFile = os.path.splitext(file_)[0]+'.png'
   print  sourceFile + ' targetFile = ' +targetFile
   fr = open(file_,'rb')
   sourceFile = file_

   data = fr.read()
   offset = 0
   tmpBuf = []
   for byte in data:
      offset+=1
      #print byte.encode('hex')
      tmpBuf.append(int(byte.encode('hex'),16))
      if len(tmpBuf) == len(toSearchPngHead):
          if tmpBuf == toSearchPngHead:
             print offset-8
             fr.seek(offset-8)
             open(targetFile, "wb").write(fr.read())
             break
          else:
             tmpBuf.pop(0)

   fr.close()


def listAll(path):
   for f in os.listdir(path):
       #print f
       if os.path.isdir(f) :
           listAll(path+"/"+f)
       else:
           if os.path.splitext(f)[1]=='.AL':
               doFileRead(path + os.sep + f)

listAll(currDir)
print '----------- all dir'