Skip to content

Commit 3858ba2

Browse files
committed
Fix root-detection java.io.File case
1 parent f6c0520 commit 3858ba2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

android/android-disable-root-detection.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,13 @@
233233

234234
const FileInputStream = Java.use("java.io.FileInputStream");
235235
FileInputStream.$init.overload('java.io.File').implementation = function(file) {
236-
const filename = file.getAbsolutePath();
237-
if (ROOT_INDICATORS.paths.has(filename) || filename.includes("magisk") || filename.includes("su")) {
236+
const path = file.getAbsolutePath();
237+
const filename = file.getName();
238+
if (ROOT_INDICATORS.paths.has(path) || path.includes("magisk") || filename.includes("su")) {
238239
if (DEBUG_MODE) {
239-
console.debug(`Blocked possible root detection: file stream for ${filename}`);
240+
console.debug(`Blocked possible root detection: file stream for ${path}`);
240241
} else logFirstRootDetection();
241-
throw new Java.use("java.io.FileNotFoundException").$new(filename);
242+
throw Java.use("java.io.FileNotFoundException").$new(path);
242243
}
243244
return this.$init(file);
244245
};

0 commit comments

Comments
 (0)