好友
阅读权限10
听众
最后登录1970-1-1
|
感谢老师回复,按照您的指点,搜索DEX文件,找到了DeviceUtils.java中的代码区,确实有相关内容:
public final class DeviceUtils {
private DeviceUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
//isDeviceRooted: 检查设备是否ROOT.
public static boolean isDeviceRooted() {
String[] strArr = {"/system/bin/", "/system/xbin/", "/sbin/", "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/xbin/", "/data/local/bin/", "/data/local/"};
for (int i = 0; i < 8; i++) {
String str = strArr;
if (new File(str + "su").exists()) {
return true;
}
}
return false;
}
//isAdbEnabled: 检查设备是否启用ABD
public static boolean isAdbEnabled() {
return Settings.Secure.getInt(Utils.getApp().getContentResolver(), "adb_enabled", 0) > 0;
}
================================================================
回到Smali模式,发现是这样写的:
.method public static isDeviceRooted()Z
.registers 8
const-string v0, "/system/bin/"
const-string v1, "/system/xbin/"
const-string v2, "/sbin/"
const-string v3, "/system/sd/xbin/"
const-string v4, "/system/bin/failsafe/"
const-string v5, "/data/local/xbin/"
const-string v6, "/data/local/bin/"
const-string v7, "/data/local/"
.line 45
filled-new-array/range {v0 .. v7}, [Ljava/lang/String;
move-result-object v0
const/4 v1, 0x0
const/4 v2, 0x0
:goto_16
const/16 v3, 0x8
if-ge v2, v3, :cond_3d
.line 47
aget-object v3, v0, v2
.line 48
new-instance v4, Ljava/io/File;
new-instance v5, Ljava/lang/StringBuilder;
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v3, "su"
invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-direct {v4, v3}, Ljava/io/File;-><init>(Ljava/lang/String;)V
invoke-virtual {v4}, Ljava/io/File;->exists()Z
move-result v3
if-eqz v3, :cond_3a
const/4 v0, 0x1
return v0
:cond_3a
add-int/lit8 v2, v2, 0x1
goto :goto_16
:cond_3d
return v1
.end method
对比java代码和Smali代码,都有两个return,分别对应true和false.如果返回1就是真,0就是假。在Smali代码块中,V1的值在第14行就赋值了0,v0的值在倒数第8行,赋值了1,尝试吧V0该成0,重新签名,打包,安装,运行,点击添加目标软件,依旧弹出关闭开发者选项。,ε=(′ο`*)))唉,慢慢在想想 |
|