拿到了某变态服游戏,打开lib看到了libcocos2djs.so,判断版本为2.4。游戏把资源文件下载到了/data下,因此需要root。目录结构如下:
g4-start/
├── config.json
├── import
│ ├── 1e
│ │ └── 1ea6e4bcd.json
│ └── e7
│ └── e76cb2d2-fa48-4916-8c8c-d7f64ee0c948.json
└── native
└── 1e
└── 1ea6e4bcd.png
可以看到,文件名全部被改为了UUID,不利于处理。打开config.json,uuid项里竟然是Base64(但不是)!在cocos2d/core/utils/decode-uuid看到了对应的源码,成功还原uuid,再通过paths项还原目录结构。
贴一下还原uuid的python代码
#!/usr/bin/python3
import sys
# static sheets
i = [64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,62,64,64,64,63,52,53,54,55,56,57,58,59,60,61,64,64,64,64,64,64,64,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,64,64,64,64,64,64,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]
a = ["", "", "", "", "", "", "", "", "-", "", "", "", "", "-", "", "", "", "", "-", "", "", "", "", "-", "", "", "", "", "", "", "", "", "", "", "", ""]
n = '0123456789abcdef'
s = [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]
def decode_uuid(t):
if len(t) != 22:
return t #处理没有用uuid的情况
a[0] = t[0]
a[1] = t[1]
r = 2
for e in range(2, 22, 2):
o = i[ord(t[e])]
l = i[ord(t[e + 1])]
a[s[r]] = n[o >> 2]
a[s[r + 1]] = n[(3 & o) << 2 | l >> 4]
a[s[r + 2]] = n[15 & l]
r += 3
return ''.join(a)
print(decode_uuid(sys.argv[1]))
完整代码整理中...
标签:Cocos,uuid,22,Creator,js,decode,json,64,还原 From: https://www.cnblogs.com/tianpanyu/p/18015389