Open nantian-dog opened 4 years ago
按照例子写测试,出现这个错误要怎么去调整?完整代码如下: `package com.jry.douyin;
import com.github.unidbg.AndroidEmulator; import com.github.unidbg.Module; import com.github.unidbg.linux.android.AndroidARMEmulator; import com.github.unidbg.linux.android.AndroidResolver; import com.github.unidbg.linux.android.dvm.*; import com.github.unidbg.linux.android.dvm.array.ByteArray; import com.github.unidbg.memory.Memory;
import java.io.File;
public class Xgorgon { private final AndroidEmulator emulator; private final VM vm; private final Module module;
private final DvmClass a; Xgorgon(){ emulator = new AndroidARMEmulator("com.qidian.dldl.official"); // 创建模拟器实例,要模拟32位或者64位,在这里区分 final Memory memory = emulator.getMemory(); // 模拟器的内存操作接口 memory.setLibraryResolver(new AndroidResolver(23)); // 设置系统类库解析 vm = emulator.createDalvikVM(null); // 创建Android虚拟机 DalvikModule dm = vm.loadLibrary(new File("unidbg-android/src/test/resources/example_binaries/libcms.so"), false); // 加载libttEncrypt.so到unicorn虚拟内存,加载成功以后会默认调用init_array等函数 dm.callJNI_OnLoad(emulator); // 手动执行JNI_OnLoad函数 module = dm.getModule(); // 加载好的libttEncrypt.so对应为一个模块。 a = vm.resolveClass("com/ss/sys/ces/a"); } public static void main(String[] args) throws Exception { Xgorgon test = new Xgorgon(); byte[] data = test.xgorgon(); System.out.println(new String(data)); } byte[] xgorgon() { int i = 1; int i2 = Integer.parseInt(System.currentTimeMillis()/1000+""); String r = "device_id=12121212"; byte[] data = r.getBytes(); ByteArray array = a.callStaticJniMethodObject(emulator, "leviathan(II[B)[B", i,i2,new ByteArray(vm, data)); // 执行Jni方法 return array.getValue(); }
} ` 请指导下,谢谢!
你的类需要extends AbstractJni,并在vm = emulator.createDalvikVM(null);这一行的下面增加vm.setJni(this);
extends AbstractJni
vm = emulator.createDalvikVM(null);
vm.setJni(this);
按照例子写测试,出现这个错误要怎么去调整?完整代码如下: `package com.jry.douyin;
import com.github.unidbg.AndroidEmulator; import com.github.unidbg.Module; import com.github.unidbg.linux.android.AndroidARMEmulator; import com.github.unidbg.linux.android.AndroidResolver; import com.github.unidbg.linux.android.dvm.*; import com.github.unidbg.linux.android.dvm.array.ByteArray; import com.github.unidbg.memory.Memory;
import java.io.File;
public class Xgorgon { private final AndroidEmulator emulator; private final VM vm; private final Module module;
} ` 请指导下,谢谢!