To review, this is the CreateString function (again, working in com.tencent.hlfish for now) located at 0x0154edec:
Code: Select all
int System.String$$CreateString(undefined4 param_1,int param_2)
{
int iVar1;
int iVar2;
int iVar3;
if (DAT_0298d2d8 == '\0') {
thunk_FUN_006b1bd0(0x8ae8);
DAT_0298d2d8 = '\x01';
}
if ((param_2 == 0) || (iVar1 = System.String$$wcslen(param_2), iVar1 == 0)) {
iVar2 = **(int **)(string_TypeInfo + 0x5c);
}
else {
iVar2 = thunk_FUN_006ba618();
iVar3 = iVar2;
if (iVar2 != 0) {
iVar3 = System.Runtime.CompilerServices.RuntimeHelpers$$get_OffsetToStringData(0);
iVar3 = iVar3 + iVar2;
}
System.Buffer$$Memcpy(iVar3,param_2,iVar1 << 1,0);
}
return iVar2;
}
Code: Select all
var moduleName = "libil2cpp.so";
var moduleBase = Module.findBaseAddress(moduleName);
var careate_str = ptr(parseInt(moduleBase) + 0x0154edec)
var careate_str_f = new NativeFunction(careate_str, 'pointer' , [ 'pointer' , 'pointer' ]);
var root = '/storage/emulated/0/Android/data/com.tencent.hlfish/files/AssetBundles/'
var path = 'kernel'
var path_str_utf8 = Memory.allocUtf8String(root + path)
var path_str = careate_str_f(new NativePointer(path_str_utf8), path_str_utf8);
Memory.readByteArray(new NativePointer(path_str), 0x100);
Code: Select all
0000 80 98 ce 98 00 00 00 00 27 00 00 00 2f 73 74 6f ........'.../sto
0010 72 61 67 65 2f 65 6d 75 6c 61 74 65 64 2f 30 2f rage/emulated/0/
0020 41 6e 64 72 6f 69 64 2f 64 61 74 61 2f 63 6f 6d Android/data/com
0030 2e 74 65 6e 63 65 6e 74 2e 68 6c 66 69 73 68 2f .tencent.hlfish/
0040 66 69 6c 65 73 2f 41 73 73 65 74 42 75 6e 64 6c files/AssetBundl
0050 65 73 2f 6b 65 72 6e 65 6c 00 00 00 74 00 69 00 es/kernel...t.i.
0060 80 98 ce 98 00 00 00 00 25 00 00 00 41 00 70 00 ........%...A.p.
0070 6f 00 6c 00 6c 00 6f 00 2e 00 50 00 6c 00 75 00 o.l.l.o...P.l.u.
0080 67 00 69 00 6e 00 73 00 2e 00 4d 00 73 00 64 00 g.i.n.s...M.s.d.
0090 6b 00 2e 00 41 00 70 00 6f 00 6c 00 6c 00 6f 00 k...A.p.o.l.l.o.
00a0 53 00 65 00 72 00 76 00 69 00 63 00 65 00 54 00 S.e.r.v.i.c.e.T.
00b0 79 00 70 00 65 00 00 00 6c 00 65 00 73 00 5f 00 y.p.e...l.e.s._.
00c0 40 19 d3 8c 00 00 00 00 00 00 00 00 13 00 00 00 @...............
00d0 06 00 00 00 0e 00 00 00 00 00 00 00 00 00 00 00 ................
00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[Nexus 5::com.tencent.hlfish]->
Construction Parameter 3/Decyrpt portion of code (replace tutorial's 0x00683014 with 0x00c0eb94, which as a reminder is the DecryptFileNew function):
Code: Select all
//Construction parameter 3
var arg3_ptr = Memory.alloc( 0x4 )
Memory.writeInt(arg3_ptr, 0x0 )
//decrypt
var decrypt = parseInt(moduleBase) + 0x00c0eb94;
var decrypt_f = new NativeFunction(ptr(decrypt), 'pointer', ['int','pointer', 'pointer']);
var retval = decrypt_f(0,path_str, arg3_ptr)
var file_bgein = retval.add(0x10)
