Skip to content

Commit f949be6

Browse files
committed
fix jailbreak monkey
1 parent fb231d5 commit f949be6

File tree

4 files changed

+95
-5
lines changed

4 files changed

+95
-5
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
diff --git a/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java b/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java
2+
index 018d7051a57a2250c738e018ba8e1518d1b9525a..e89a135c10edc50174315c5cf0a3c9871fe65e6a 100644
3+
--- a/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java
4+
+++ b/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java
5+
@@ -74,11 +74,7 @@ public class JailMonkeyModule extends ReactContextBaseJavaModule {
6+
final Map<String, Object> constants = new HashMap<>();
7+
8+
constants.put("isJailBroken", rootedCheck.isJailBroken());
9+
- constants.put("rootedDetectionMethods", rootedCheck.getResultByDetectionMethod());
10+
- constants.put("hookDetected", hookDetected(context));
11+
- constants.put("canMockLocation", isMockLocationOn(context));
12+
- constants.put("isOnExternalStorage", isOnExternalStorage(context));
13+
- constants.put("AdbEnabled", AdbEnabled(context));
14+
return constants;
15+
}
16+
}
17+
+
18+
diff --git a/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java b/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java
19+
index bf75f27fd11293205bf6d58de4f8069ea0a155fe..d63ac51b87e456bd13e252c7ca691c07e28704a5 100644
20+
--- a/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java
21+
+++ b/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java
22+
@@ -4,25 +4,44 @@ import android.content.Context;
23+
import com.scottyab.rootbeer.RootBeer;
24+
import java.util.HashMap;
25+
import java.util.Map;
26+
+import java.util.concurrent.CountDownLatch;
27+
+
28+
+import androidx.tracing.Trace;
29+
30+
public class RootedCheck {
31+
private static boolean checkWithJailMonkeyMethod() {
32+
- CheckApiVersion check;
33+
-
34+
- if (android.os.Build.VERSION.SDK_INT >= 23) {
35+
- check = new GreaterThan23();
36+
- } else {
37+
- check = new LessThan23();
38+
+ Trace.beginSection("[JailMonkey] checkWithJailMonkeyMethod");
39+
+ try {
40+
+ CheckApiVersion check;
41+
+
42+
+ if (android.os.Build.VERSION.SDK_INT >= 23) {
43+
+ check = new GreaterThan23();
44+
+ } else {
45+
+ check = new LessThan23();
46+
+ }
47+
+ return check.checkRooted();
48+
+ } finally {
49+
+ Trace.endSection();
50+
}
51+
- return check.checkRooted();
52+
}
53+
54+
- private final boolean jailMonkeyResult;
55+
- private final RootBeerResults rootBeerResults;
56+
+ private static boolean jailMonkeyResult;
57+
+ private static RootBeerResults rootBeerResults;
58+
+ private static CountDownLatch latch = new CountDownLatch(1);
59+
+ public static void precompute(Context context) {
60+
+ new Thread(() -> {
61+
+ jailMonkeyResult = checkWithJailMonkeyMethod();
62+
+ rootBeerResults = new RootBeerResults(context);
63+
+ latch.countDown();
64+
+ }).start();
65+
+ }
66+
67+
public RootedCheck(Context context) {
68+
- jailMonkeyResult = checkWithJailMonkeyMethod();
69+
- rootBeerResults = new RootBeerResults(context);
70+
+ try {
71+
+ latch.await();
72+
+ } catch (InterruptedException e) {
73+
+ throw new RuntimeException(e);
74+
+ }
75+
}
76+
77+
public boolean isJailBroken() {
78+
@@ -87,3 +106,4 @@ public class RootedCheck {
79+
}
80+
}
81+
}
82+
+

.yarnrc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
checksumBehavior: update
2+
13
enableScripts: false
24

35
enableTelemetry: false
@@ -6,12 +8,10 @@ nmHoistingLimits: workspaces
68

79
nmSelfReferences: false
810

9-
checksumBehavior: update
10-
1111
nodeLinker: node-modules
1212

1313
plugins:
1414
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
15-
spec: '@yarnpkg/plugin-workspace-tools'
15+
spec: "@yarnpkg/plugin-workspace-tools"
1616

1717
yarnPath: .yarn/releases/yarn-3.6.4.cjs

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
"@scure/bip39/@noble/hashes": "1.8.0",
5252
"@scure/btc-signer/@noble/hashes": "1.8.0",
5353
"[email protected]": "4.17.21",
54-
"@ledgerhq/hw-transport": "6.31.0"
54+
"@ledgerhq/hw-transport": "6.31.0",
55+
"[email protected]": "patch:jail-monkey@npm%3A2.8.0#./.yarn/patches/jail-monkey-npm-2.8.0-77e4d06b40.patch"
5556
},
5657
"engines": {
5758
"node": ">=20.18.0",

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22949,6 +22949,13 @@ __metadata:
2294922949
languageName: node
2295022950
linkType: hard
2295122951

22952+
"jail-monkey@patch:jail-monkey@npm%3A2.8.0#./.yarn/patches/jail-monkey-npm-2.8.0-77e4d06b40.patch::locator=mobile-monorepo%40workspace%3A.":
22953+
version: 2.8.0
22954+
resolution: "jail-monkey@patch:jail-monkey@npm%3A2.8.0#./.yarn/patches/jail-monkey-npm-2.8.0-77e4d06b40.patch::version=2.8.0&hash=225a6a&locator=mobile-monorepo%40workspace%3A."
22955+
checksum: c5caacdc4a38dcdd45209f55c3376d39cd2ea7ae788f90e4bdb270838cb8f13c1b5001a79cd7c6f1ed7f0d462c9ef2d0fbc959e1e48a26dff4dd9aa7ab9ab4f4
22956+
languageName: node
22957+
linkType: hard
22958+
2295222959
"jake@npm:^10.8.5":
2295322960
version: 10.9.2
2295422961
resolution: "jake@npm:10.9.2"
@@ -28746,7 +28753,7 @@ react-native-webview@ava-labs/react-native-webview:
2874628753
peerDependencies:
2874728754
react: "*"
2874828755
react-native: "*"
28749-
checksum: 44ee8c8ebc4dc4d3423e9045e1aebac31829eb518824e24f41b2bd10ab1e8343e824e9d912f259bfec7bfa798e96513cc05dbdcdf36087b2a43806f74a3b0fa2
28756+
checksum: df3e07107bec2bab08ffe837b81a8e9d4b8f8a3940833dead94a6d994aa38253cfd5d4d9484ad24efe3bf2b89a6697fd6bf0750785e168b58f5ed5f74ff8383a
2875028757
languageName: node
2875128758
linkType: hard
2875228759

0 commit comments

Comments
 (0)