文章目录
0. Unidbg删除unidbg-ios模块
项目结构中删除unidbg-ios
模块
本地删除unidbg/unidbg-ios
文件夹
unidbg-parent
模块(根目录unidbg)的pom文件中删除<module>unidbg-ios</module>
0.0 推荐Unidbg打Jar包后导入IDEA项目
推荐Unidbg打Jar包后导入IDEA项目https://blog.csdn.net/Palmer9/article/details/125220599
1. 添加Server模块
方法① unidbg作为模块引入
IDEA新建SpringBoot项目
从已存在的模块中导入Unidbg
方法② Web作为模块引入
IDEA打开Unidbg项目,新建SpringBoot模块
2. 配置Server模块
修改pom.xml文件,添加依赖
<dependencies>
<!-- SpringBoot 所需要的-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- unidbg-android-->
<dependency>
<groupId>com.github.zhkl0228</groupId>
<artifactId>unidbg-android</artifactId>
<version>0.9.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- 以下是unidbg-android模块中所有的依赖-->
<dependency>
<groupId>com.github.zhkl0228</groupId>
<artifactId>unidbg-api</artifactId>
<version>0.9.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.dongliu</groupId>
<artifactId>apk-parser</artifactId>
<version>2.6.10</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.zhkl0228</groupId>
<artifactId>unidbg-dynarmic</artifactId>
<version>0.9.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.zhkl0228</groupId>
<artifactId>unidbg-hypervisor</artifactId>
<version>0.9.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.zhkl0228</groupId>
<artifactId>unidbg-kvm</artifactId>
<version>0.9.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.zhkl0228</groupId>
<artifactId>unidbg-unicorn2</artifactId>
<version>0.9.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
版本号进行相应的更改
在pom中添加构建配置
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.apk</include>
<include>**/*.so</include>
</includes>
</resource>
</resources>
</build>
3. 编写Unidbg代码
正常在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,新建对象模拟执行返回结果即可
项目传至Git
Clone下来后
方法①需要重新导入Unidbg模块,并再次同步maven
方法②同理
resources文件夹作为Resources Root标识会不见,重新设置一下即可,暂未发现其他问题
附项目结构