参考教程
https://github.com/noidsirius/SootTutorial
Windows Soot 环境配置
下载代码
git 拷贝仓库
git init
git clone https://github.com/noidsirius/SootTutorial.git
./gradlew.bat build
报错:Unsupported class file major version 57
./gradlew.bat build时,报错如下:
* What went wrong:
Could not compile settings file 'E:\AcademicWorkplace\Soot\Soot1\SootTutorial\settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 57
原因:
这是因为Gradle 5 is incompatible with Java 13
需要:
或者update Gradle (the wrapped version in your project) to Gradle 6 or later
或者use a lower version of the JRE
解决方法:
需要进入\SootTutorial\gradle\wrapper
修改gradle-wrapper.properties
改为:distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
参考:https://stackoverflow.com/a/63548566
报错:\Library\Android\sdk\platforms does not exist!
./gradlew.bat build时,报错如下:
例如
dev.navids.soottutorial.android.CGPTATest > testPointsToAnalysis FAILED
soot.AndroidPlatformException: Android platform directory 'C:\Users\juruo\Library\Android\sdk\platforms' does not exist!
原因:
Soot代码中使用了Android-SDK,但是系统环境变量中没有"ANDROID_HOME"
例如AndroidCallgraph.java中:
解决方法:
添加系统环境变量:
build成功
生成Android app的call graph
命令格式:
./gradlew.bat run --args="AndroidCallGraph <CG_Algorithm> (draw)"
例如:
./gradlew.bat run --args="AndroidCallGraph SPARK draw"
Soot Code在AndroidCallgraph.java
Example APK在/SootTutorial/demo/Android/st_demo.apk
结果: