一个解密.dat文件的Py代码,如何重新加密成.dat
shaderPack = r'C:\ShaderData.dat'from struct import unpack
import os
shaderdataFloder = r'ShaderData'
os.makedirs(shaderdataFloder,exist_ok=True)
def dint(b):
return unpack("i",b)
def decodeData(data,factor):
factor = factor & 0xff
result = b''
for v3 in range(len(data)):
v4 = data
eax = v3 + v4
result += bytes()
factor = eax & 0xff
return result
shaders = {}
with open(shaderPack,'rb') as fp:
shaderNum = dint(fp.read(4))
for v6 in range(shaderNum):
nameLength = dint(fp.read(4))
cryptedName = fp.read(nameLength)
name = decodeData(cryptedName,v6)
size = dint(decodeData(fp.read(4),v6))
offset = dint(decodeData(fp.read(4),v6))
shaders = {
"offset":offset,
"size":size,
"factor":v6
}
for filename in shaders:
shader = shaders
fp.seek(shader["offset"])
data = fp.read(shader["size"])
with open(os.path.join(shaderdataFloder,filename),"wb") as wfp:
wfp.write(decodeData(data,shader["factor"]))
这是Py解密.dat文件的代码,解密后得到几百个.bin文件,请问高手们,如何把解密后的文件又重新打包成.dat文件呢? 好的 我还要研究研究 def dint(b):
return unpack("i",b)
unpack函数在哪里? ciker_li 发表于 2020-9-19 21:50
def dint(b):
return unpack("i",b)
第二行,从struct模块引入了unpack struct模块也贴出来啊 学习一下,没找到struct这个包。。 看上去不是很难
怎么解密的啊,用什么工具啊!
页:
[1]