解析 so 依赖与符号(Python3,无需第三方库)
用法: python analyze.py <apk路径>
import struct, zipfile, sys
def dyn(data):
e_shoff = struct.unpack_from('<Q', data, 0x28)[0]
esz = struct.unpack_from('<H', data, 0x3A)[0]
enum = struct.unpack_from('<H', data, 0x3C)[0]
secs = []
for i in range(enum):
off = e_shoff + i esz
t = struct.unpack_from('<I', data, off + 4)[0]
o = struct.unpack_from('<Q', data, off + 0x18)[0]
sz = struct.unpack_from('<Q', data, off + 0x20)[0]
lk = struct.unpack_from('<I', data, off + 0x28)[0]
ent = struct.unpack_from('<Q', data, off + 0x38)[0]
secs.append(dict(t=t, o=o, sz=sz, lk=lk, ent=ent))
needed, dynstr = [], None
for s in secs:
if s['t'] == 6:
dynstr = secs[s['lk']]
for j in range(s['sz'] // s['ent']):
tag, val = struct.unpack_from('<qQ', data, s['o'] + j s['ent'])
if tag == 0: break
if tag == 1: needed.append(val)
break
rd = lambda b, o: data[b+o:data.index(b'\x00', b+o)].decode('utf-8', 'replace')
return [rd(dynstr['o'], x) for x in needed] if dynstr else []
z = zipfile.ZipFile(sys.argv[1])
for n in z.namelist():
if n.endswith('libuniappx.so'):
print('DT_NEEDED:', dyn(z.read(n)))
1 个回复
DCloud_App_Array
这个错误是加固工具破坏了动态库相互依赖加载导致的问题,可以尝试更新XopProtector到最新版本。
将 libc++_shared.so 强制配置为加固或同步至壳的解密目录。
libc++_shared.so是很常见的共用动态库,理论上加固工具应该支持的。