Closed sanqudui8ban closed 5 years ago
重新上传测试代码 testcode.zip
日志: log.txt
660.apk 这个apk在哪下载?
就是抖音6.6的apk 太大了 我上传不了 http://www.anzhi.com/pkg/2332_com.ss.android.ugc.aweme.html
/proc/meminfo 这个文件发我
socket net_link 那个我加了
LDREX.W R2, [R3] SUBS R4, R2, #1 STREX.W R5, R4, [R3] 这种ldrex 和strex 指令 unicorn 有没有模拟
有模拟
我调用的那个n0函数是不会因为APP环境问题退出的,调试的时候也没出现过内存不可读,所以我觉得问题还是unidbg的问题
看下前后10条读写内存的指令,结合unidbg设断点调试
有没有单步trace的接口 我打印下他指令流程
看到trace接口了
断点以后用命令s执行单步,n命令跳过函数
不好意思 刚才看错了
搞定了 谢谢作者
@sanqudui8ban 大佬可以请教一下你怎么解决的吗
unicorn.UnicornException: Invalid memory read (UC_ERR_READ_UNMAPPED) at unicorn.Unicorn.emu_start(Native Method) at cn.banny.unidbg.AbstractEmulator.emulate(AbstractEmulator.java:268) at cn.banny.unidbg.AbstractEmulator.eFunc(AbstractEmulator.java:367) at cn.banny.unidbg.arm.AbstractARMEmulator.eFunc(AbstractARMEmulator.java:203) at cn.banny.unidbg.linux.LinuxModule.emulateFunction(LinuxModule.java:203) at cn.banny.unidbg.linux.android.dvm.DvmClass.callStaticJniMethod(DvmClass.java:189) at com.ss.sys.secuni.b.cms.sign(cms.java:97) at com.ss.sys.secuni.b.cms.main(cms.java:85) debugger break at: 0x40012a54
r0=0x0 r1=0x414e1111 r2=0x574598f8, r3=0x0 r4=0xf72315d4 r5=0x18353522 r6=0x574598f7 r7=0xd7977dd5 sb=0x61cad990 sl=0x414e1112 fp=0x1 ip=0x0 sp=0xbfffe15c lr=0x61cad990 pc=0x40012a54 cpsr: N=0, Z=1, C=1, V=0, T=1, mode=0b10000 => [ libcms.so][0x12a55][ 01 9b ]0x40012a54:ldr r3, [sp, #4] [ libcms.so] [0x12a57] [ 03 93 ] 0x40012a56: str r3, [sp, #0xc] [ libcms.so] [0x12a59] [ 03 9b ] 0x40012a58: ldr r3, [sp, #0xc] [ libcms.so] [0x12a5b] [ 1b 78 ] 0x40012a5a: ldrb r3, [r3] [ libcms.so] [0x12a5d] [ 00 2b ] 0x40012a5c: cmp r3, #0 [ libcms.so] [0x12a5f] [ 23 46 ] 0x40012a5e: mov r3, r4 [ libcms.so] [0x12a61] [ 04 bf ] 0x40012a60: itt eq [ libcms.so] [0x12a63] [ 43 f2 22 53 ] 0x40012a62: movweq r3, #0x3522 [ libcms.so] [0x12a67] [ c1 f6 35 03 ] 0x40012a66: movteq r3, #0x1835 [ libcms.so] [0x12a6b] [ 21 e0 ] 0x40012a6a: b #0x40012ab0
在我测试抖音时,遇到如下崩溃日志: getString pointer=unicorn@0xbfffe22c, size=14, encoding=UTF-8, ret=/system/bin/su fstatat64 dirfd=-100, pathname=\system\bin\su, statbuf=unicorn@0xbfffe1c4, flags=0 [21:42:48 095] WARN [cn.banny.unidbg.linux.ARMSyscallHandler] (ARMSyscallHandler:1446) - fstatat64 dirfd=-100, pathname=\system\bin\su, statbuf=unicorn@0xbfffe1c4, flags=0 memory failed: address=0x0, size=1, value=0x0, user=null unicorn.UnicornException: Invalid memory read (UC_ERR_READ_UNMAPPED) at unicorn.Unicorn.emu_start(Native Method) at cn.banny.unidbg.AbstractEmulator.emulate(AbstractEmulator.java:237) at cn.banny.unidbg.AbstractEmulator.eFunc(AbstractEmulator.java:328) at cn.banny.unidbg.arm.AbstractARMEmulator.eFunc(AbstractARMEmulator.java:201) at cn.banny.unidbg.linux.LinuxModule.emulateFunction(LinuxModule.java:154) at cn.banny.unidbg.linux.android.dvm.DvmClass.callStaticJniMethod(DvmClass.java:141) at com.bytedance.frameworks.core.encrypt.cms.sign(cms.java:108) at com.bytedance.frameworks.core.encrypt.cms.main(cms.java:96) debugger break at: 0x40012a54
我的测试代码如下: package com.bytedance.frameworks.core.encrypt;
import cn.banny.auxiliary.Inspector; import cn.banny.unidbg.LibraryResolver; import cn.banny.unidbg.Module; import cn.banny.unidbg.arm.ARMEmulator; import cn.banny.unidbg.linux.android.AndroidARMEmulator; import cn.banny.unidbg.linux.android.AndroidResolver; import cn.banny.unidbg.linux.android.dvm.DalvikModule; import cn.banny.unidbg.linux.android.dvm.DvmClass; import cn.banny.unidbg.linux.android.dvm.VM; import cn.banny.unidbg.memory.Memory;
import java.io.File; import java.io.IOException;
import cn.banny.unidbg.file.FileIO; import cn.banny.unidbg.file.IOResolver;
import cn.banny.unidbg.linux.android.dvm.*; import cn.banny.unidbg.linux.android.dvm.api.SystemService; import cn.banny.unidbg.linux.file.ByteArrayFileIO; import cn.banny.unidbg.linux.file.SimpleFileIO;
import org.apache.log4j.Level; import org.apache.log4j.Logger;
import java.io.; import java.net.;
public class cms extends AbstractJni implements IOResolver {
// IHookZz hookZz = HookZz.getInstance(emulator); // hookZz.replace(module.base + 0x000733A0 + 1, new ReplaceCallback() { // @Override // public HookStatus onCall(Emulator emulator, long originFunction) { // long currentTimeMillis = System.currentTimeMillis(); // EditableArm32RegisterContext context = emulator.getContext(); // context.setR1((int) currentTimeMillis); // return HookStatus.LR(emulator, (int) (currentTimeMillis >> 32)); // } // });
// emulator.attach().debug(emulator); }
// Number ret = cmsDVM.callStaticJniMethod(emulator, "e([B)[B", // vm.addLocalObject(new ByteArray("888888888".getBytes()))); DvmObject context = vm.resolveClass("android/content/Context").newObject(null); Number ret = tongdunDVM.callStaticJniMethod(emulator, "n0(Landroid/content/Context;)[B", vm.addLocalObject(context)); long hash = ret.intValue() & 0xffffffffL; ByteArray array = vm.getObject(hash);
}
libcms.zip