1.添加mavenCentral
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
2.添加Gradle依赖
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.alibaba:fastjson:2.0.23'
implementation("org.greenrobot:eventbus:3.3.1")
implementation 'com.appsflyer:af-android-sdk:6.9.0'
implementation "com.android.installreferrer:installreferrer:2.2"
implementation("org.greenrobot:eventbus:3.3.1")
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.10'
implementation 'io.github.loper7:miit-rule-checker:0.2.0'
}
二、使用方法
1.检查APP内是否存在不合规的方法调用
检查MIITRuleChecker内置的不合规的方法
MIITRuleChecker.checkDefaults()
val list = MIITMethods.getDefaultMethods()
list.add(MainActivity::class.java.getDeclaredMethod("onCreate" , Bundle::class.java))
MIITRuleChecker.check(list)
2.检查指定方法调用并查看调用栈堆
//查看 WifiInfo class 内 getMacAddress 的调用栈堆
MIITRuleChecker.check(MIITMethods.WifiInfo.getMacAddress)
//多个方法统计 (deadline 为从方法调用开始到多少毫秒后截至统计)
val list = mutableListOf<Member?>().apply {
add(MIITMethods.LocationManager.getLastKnownLocation)
add(MIITMethods.LocationManager.requestLocationUpdates)
add(MIITMethods.Secure.getString)
}
MIITMethodCountChecker.startCount( 20 * 1000,list)
//单个方法统计(deadline 为从方法调用开始到多少毫秒后截至统计)
MIITMethodCountChecker.startCount(20 * 1000,MIITMethods.LocationManager.getLastKnownLocation)
三、内置方法表
https://github.com/loper7/miit-rule-checker
APP逆向分析/渗透测试/安全检测/隐私合规如何选择手机机型或系统
Gradle Plugin+Transform+ASM Hook并替换隐私方法调用(彻底解决隐私不合规问题)