안드로이드 루팅 체크

 


  
fun isDeviceRooted(): Boolean {
val paths = arrayOf(
"/sbin/su", "/system/bin/su", "/system/xbin/su", "/system/sd/xbin/su",
"/system/bin/failsafe/su", "/data/local/su", "/su/bin/su"
)
for (path in paths) {
try {
val file = File(path)
if (file.exists()) {
return true
}
} catch (_: Exception) {
}
}
try {
val file = File("/system/app/Superuser.apk")
if (file.exists()) {
return true
}
} catch (_: Exception) {
}
val buildTags = android.os.Build.TAGS
if (buildTags != null && buildTags.contains("test-keys")) {
return true
}
return false
}

 

참고

https://blog.yena.io/studynote/2023/03/05/Android-Check-Rooted.html

'android' 카테고리의 다른 글

apk 서명 확인...  (0) 2018.04.06
코드에서 해시키 얻기...  (0) 2018.01.12
안드로이드 APK 파일에서 HASH KEY 추출  (0) 2017.05.24
안드로이드 설치된 APK 추출.  (0) 2017.05.24
코드에서 셀렉터 적용  (0) 2016.11.16

댓글