- 0. Unidbg删除unidbg-ios模块
- 1. 添加Server模块
- 方法① unidbg作为模块引入
- 方法② Web作为模块引入
- 2. 配置Server模块
- 3. 编写Unidbg代码
- 4. 修改SpringBoot配置、服务
- 项目传至Git
项目结构中删除unidbg-ios模块
本地删除unidbg/unidbg-ios文件夹
unidbg-parent模块(根目录unidbg)的pom文件中删除
IDEA新建SpringBoot项目
从已存在的模块中导入Unidbg
IDEA打开Unidbg项目,新建SpringBoot模块
2. 配置Server模块修改pom.xml文件,添加依赖
org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test com.github.zhkl0228 unidbg-android 0.9.7-SNAPSHOT compile com.github.zhkl0228 unidbg-api 0.9.7-SNAPSHOT compile net.dongliu apk-parser 2.6.10 compile com.github.zhkl0228 unidbg-dynarmic 0.9.7-SNAPSHOT compile com.github.zhkl0228 unidbg-hypervisor 0.9.7-SNAPSHOT compile com.github.zhkl0228 unidbg-kvm 0.9.7-SNAPSHOT compile com.github.zhkl0228 unidbg-unicorn2 0.9.7-SNAPSHOT compile
版本号进行相应的更改
在pom中添加构建配置
3. 编写Unidbg代码src/main/java ***.so
正常在WebServer的src目录中编写Unidbg代码即可。
可以将APK和so文件放在类的同目录,引用文件时使用以下代码:
new File(MainActivity.class.getResource("libnative.so").getFile())
4. 修改SpringBoot配置、服务
修改src/main/resources/application.properties文件改为src/main/resources/application.yml
添加SpringBoot配置
server: port: 7788
新建服务类server.HelloServer,代码如下
@RestController
public class HelloServer {
@RequestMapping("/hello")
public String hello() {
return "Hello World";
}
}
测试服务可以正常开启
新建一个Controller,新建对象模拟执行返回结果即可
项目传至GitClone下来后
方法①需要重新导入Unidbg模块,并再次同步maven
方法②同理
resources文件夹作为Resources Root标识会不见,重新设置一下即可,暂未发现其他问题
附项目结构



