react-native-rootbeer-checkroot 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +799 -0
- package/RootBeer.podspec +20 -0
- package/android/build.gradle +52 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/rootbeer/RootBeerModule.kt +62 -0
- package/android/src/main/java/com/rootbeer/RootBeerPackage.kt +31 -0
- package/ios/RootBeer.h +5 -0
- package/ios/RootBeer.mm +21 -0
- package/lib/module/NativeRootBeer.js +5 -0
- package/lib/module/NativeRootBeer.js.map +1 -0
- package/lib/module/RootBeer.js +110 -0
- package/lib/module/RootBeer.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeRootBeer.d.ts +33 -0
- package/lib/typescript/src/NativeRootBeer.d.ts.map +1 -0
- package/lib/typescript/src/RootBeer.d.ts +82 -0
- package/lib/typescript/src/RootBeer.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +182 -0
- package/src/NativeRootBeer.ts +44 -0
- package/src/RootBeer.ts +118 -0
- package/src/index.tsx +1 -0
package/RootBeer.podspec
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "RootBeer"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://mrx.com.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
|
|
19
|
+
install_modules_dependencies(s)
|
|
20
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.RootBeer = [
|
|
3
|
+
kotlinVersion: "2.0.21",
|
|
4
|
+
minSdkVersion: 24,
|
|
5
|
+
compileSdkVersion: 36
|
|
6
|
+
]
|
|
7
|
+
|
|
8
|
+
ext.getExtOrDefault = { prop ->
|
|
9
|
+
if (rootProject.ext.has(prop)) {
|
|
10
|
+
return rootProject.ext.get(prop)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return RootBeer[prop]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
repositories {
|
|
17
|
+
google()
|
|
18
|
+
mavenCentral()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
dependencies {
|
|
22
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
23
|
+
// noinspection DifferentKotlinGradleVersion
|
|
24
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
apply plugin: "com.android.library"
|
|
30
|
+
apply plugin: "kotlin-android"
|
|
31
|
+
|
|
32
|
+
apply plugin: "com.facebook.react"
|
|
33
|
+
|
|
34
|
+
android {
|
|
35
|
+
namespace "com.rootbeer"
|
|
36
|
+
|
|
37
|
+
compileSdkVersion getExtOrDefault("compileSdkVersion")
|
|
38
|
+
|
|
39
|
+
defaultConfig {
|
|
40
|
+
minSdkVersion getExtOrDefault("minSdkVersion")
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
compileOptions {
|
|
44
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
45
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
dependencies {
|
|
50
|
+
implementation "com.facebook.react:react-android"
|
|
51
|
+
implementation "com.scottyab:rootbeer-lib:0.1.2"
|
|
52
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
package com.rootbeer
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
import com.scottyab.rootbeer.RootBeer as RootBeerLib
|
|
5
|
+
|
|
6
|
+
class RootBeerModule(reactContext: ReactApplicationContext) :
|
|
7
|
+
NativeRootBeerSpec(reactContext) {
|
|
8
|
+
|
|
9
|
+
private val rootBeer: RootBeerLib by lazy { RootBeerLib(reactContext) }
|
|
10
|
+
|
|
11
|
+
override fun isRooted(): Boolean {
|
|
12
|
+
return rootBeer.isRooted
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override fun isRootedWithoutBusyBoxCheck(): Boolean {
|
|
16
|
+
return rootBeer.isRootedWithoutBusyBoxCheck
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override fun detectPotentiallyDangerousApps(): Boolean {
|
|
20
|
+
return rootBeer.detectPotentiallyDangerousApps()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun detectRootManagementApps(): Boolean {
|
|
24
|
+
return rootBeer.detectRootManagementApps()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override fun detectTestKeys(): Boolean {
|
|
28
|
+
return rootBeer.detectTestKeys()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override fun checkForBinary(binaryName: String): Boolean {
|
|
32
|
+
return rootBeer.checkForBinary(binaryName)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override fun checkForDangerousProps(): Boolean {
|
|
36
|
+
return rootBeer.checkForDangerousProps()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override fun checkForRWPaths(): Boolean {
|
|
40
|
+
return rootBeer.checkForRWPaths()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override fun detectRootCloakingApps(): Boolean {
|
|
44
|
+
return rootBeer.detectRootCloakingApps()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override fun checkSuExists(): Boolean {
|
|
48
|
+
return rootBeer.checkSuExists()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
override fun checkForSuBinary(): Boolean {
|
|
52
|
+
return rootBeer.checkForSuBinary()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
override fun checkForMagiskBinary(): Boolean {
|
|
56
|
+
return rootBeer.checkForMagiskBinary()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
companion object {
|
|
60
|
+
const val NAME = NativeRootBeerSpec.NAME
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
package com.rootbeer
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
import java.util.HashMap
|
|
9
|
+
|
|
10
|
+
class RootBeerPackage : BaseReactPackage() {
|
|
11
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
12
|
+
return if (name == RootBeerModule.NAME) {
|
|
13
|
+
RootBeerModule(reactContext)
|
|
14
|
+
} else {
|
|
15
|
+
null
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
|
|
20
|
+
mapOf(
|
|
21
|
+
RootBeerModule.NAME to ReactModuleInfo(
|
|
22
|
+
name = RootBeerModule.NAME,
|
|
23
|
+
className = RootBeerModule.NAME,
|
|
24
|
+
canOverrideExistingModule = false,
|
|
25
|
+
needsEagerInit = false,
|
|
26
|
+
isCxxModule = false,
|
|
27
|
+
isTurboModule = true
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
}
|
package/ios/RootBeer.h
ADDED
package/ios/RootBeer.mm
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#import "RootBeer.h"
|
|
2
|
+
|
|
3
|
+
@implementation RootBeer
|
|
4
|
+
- (NSNumber *)multiply:(double)a b:(double)b {
|
|
5
|
+
NSNumber *result = @(a * b);
|
|
6
|
+
|
|
7
|
+
return result;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
11
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
12
|
+
{
|
|
13
|
+
return std::make_shared<facebook::react::NativeRootBeerSpecJSI>(params);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
+ (NSString *)moduleName
|
|
17
|
+
{
|
|
18
|
+
return @"RootBeer";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeRootBeer.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AA2CpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,UAAU,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import NativeRootBeer from "./NativeRootBeer.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A wrapper around the RootBeer Android root-detection library.
|
|
7
|
+
* All methods call through to `com.scottyab:rootbeer-lib` via JSI.
|
|
8
|
+
*
|
|
9
|
+
* On iOS (or any non-Android platform) these methods will throw because
|
|
10
|
+
* the TurboModule is enforcing — guard calls with `Platform.OS === 'android'`
|
|
11
|
+
* if cross-platform support is needed.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { Platform } from 'react-native';
|
|
16
|
+
* import { RootBeer } from 'react-native-root-beer';
|
|
17
|
+
*
|
|
18
|
+
* if (Platform.OS === 'android') {
|
|
19
|
+
* const rooted = RootBeer.isRooted();
|
|
20
|
+
* console.log('Device is rooted:', rooted);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export const RootBeer = {
|
|
25
|
+
/**
|
|
26
|
+
* Runs all RootBeer checks (includes BusyBox check).
|
|
27
|
+
* This is the main high-level check — prefer this for most use cases.
|
|
28
|
+
*/
|
|
29
|
+
isRooted() {
|
|
30
|
+
return NativeRootBeer.isRooted();
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Runs all RootBeer checks except the BusyBox check.
|
|
34
|
+
* Use this if BusyBox false-positives are a concern in your environment.
|
|
35
|
+
*/
|
|
36
|
+
isRootedWithoutBusyBoxCheck() {
|
|
37
|
+
return NativeRootBeer.isRootedWithoutBusyBoxCheck();
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Checks for the presence of known potentially-dangerous rooting apps
|
|
41
|
+
* (e.g. apps that typically accompany root access).
|
|
42
|
+
*/
|
|
43
|
+
detectPotentiallyDangerousApps() {
|
|
44
|
+
return NativeRootBeer.detectPotentiallyDangerousApps();
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Checks for the presence of known root management apps
|
|
48
|
+
* (e.g. SuperSU, Magisk Manager, KingRoot).
|
|
49
|
+
*/
|
|
50
|
+
detectRootManagementApps() {
|
|
51
|
+
return NativeRootBeer.detectRootManagementApps();
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Checks if the device build is signed with test-keys instead of
|
|
55
|
+
* release-keys. Test-key builds typically indicate a custom/rooted ROM.
|
|
56
|
+
*/
|
|
57
|
+
detectTestKeys() {
|
|
58
|
+
return NativeRootBeer.detectTestKeys();
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Checks for the presence of a specific binary by scanning common paths.
|
|
62
|
+
* @param binaryName - The binary to search for, e.g. `"su"`, `"busybox"`.
|
|
63
|
+
*/
|
|
64
|
+
checkForBinary(binaryName) {
|
|
65
|
+
return NativeRootBeer.checkForBinary(binaryName);
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* Checks for dangerous system properties that are commonly set on rooted
|
|
69
|
+
* devices (e.g. `ro.debuggable=1`, `ro.secure=0`).
|
|
70
|
+
*/
|
|
71
|
+
checkForDangerousProps() {
|
|
72
|
+
return NativeRootBeer.checkForDangerousProps();
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Checks for file-system paths that should be read-only on a stock device
|
|
76
|
+
* but are mounted as read-write — a strong indicator of root access.
|
|
77
|
+
*/
|
|
78
|
+
checkForRWPaths() {
|
|
79
|
+
return NativeRootBeer.checkForRWPaths();
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* Checks for the presence of known root-cloaking apps (e.g. RootCloak,
|
|
83
|
+
* Hide My Root) that try to hide root from other apps.
|
|
84
|
+
*/
|
|
85
|
+
detectRootCloakingApps() {
|
|
86
|
+
return NativeRootBeer.detectRootCloakingApps();
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* Attempts to execute `su` and returns `true` if it succeeds.
|
|
90
|
+
* This is a runtime probe rather than a static file check.
|
|
91
|
+
*/
|
|
92
|
+
checkSuExists() {
|
|
93
|
+
return NativeRootBeer.checkSuExists();
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* Scans a list of well-known binary paths for the `su` executable.
|
|
97
|
+
* Less invasive than `checkSuExists()` as it doesn't execute anything.
|
|
98
|
+
*/
|
|
99
|
+
checkForSuBinary() {
|
|
100
|
+
return NativeRootBeer.checkForSuBinary();
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Scans common binary paths for the Magisk binary.
|
|
104
|
+
* Useful for detecting Magisk-based root even when it hides itself.
|
|
105
|
+
*/
|
|
106
|
+
checkForMagiskBinary() {
|
|
107
|
+
return NativeRootBeer.checkForMagiskBinary();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=RootBeer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeRootBeer","RootBeer","isRooted","isRootedWithoutBusyBoxCheck","detectPotentiallyDangerousApps","detectRootManagementApps","detectTestKeys","checkForBinary","binaryName","checkForDangerousProps","checkForRWPaths","detectRootCloakingApps","checkSuExists","checkForSuBinary","checkForMagiskBinary"],"sourceRoot":"../../src","sources":["RootBeer.ts"],"mappings":";;AAAA,OAAOA,cAAc,MAAM,qBAAkB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAG;EACtB;AACF;AACA;AACA;EACEC,QAAQA,CAAA,EAAY;IAClB,OAAOF,cAAc,CAACE,QAAQ,CAAC,CAAC;EAClC,CAAC;EAED;AACF;AACA;AACA;EACEC,2BAA2BA,CAAA,EAAY;IACrC,OAAOH,cAAc,CAACG,2BAA2B,CAAC,CAAC;EACrD,CAAC;EAED;AACF;AACA;AACA;EACEC,8BAA8BA,CAAA,EAAY;IACxC,OAAOJ,cAAc,CAACI,8BAA8B,CAAC,CAAC;EACxD,CAAC;EAED;AACF;AACA;AACA;EACEC,wBAAwBA,CAAA,EAAY;IAClC,OAAOL,cAAc,CAACK,wBAAwB,CAAC,CAAC;EAClD,CAAC;EAED;AACF;AACA;AACA;EACEC,cAAcA,CAAA,EAAY;IACxB,OAAON,cAAc,CAACM,cAAc,CAAC,CAAC;EACxC,CAAC;EAED;AACF;AACA;AACA;EACEC,cAAcA,CAACC,UAAkB,EAAW;IAC1C,OAAOR,cAAc,CAACO,cAAc,CAACC,UAAU,CAAC;EAClD,CAAC;EAED;AACF;AACA;AACA;EACEC,sBAAsBA,CAAA,EAAY;IAChC,OAAOT,cAAc,CAACS,sBAAsB,CAAC,CAAC;EAChD,CAAC;EAED;AACF;AACA;AACA;EACEC,eAAeA,CAAA,EAAY;IACzB,OAAOV,cAAc,CAACU,eAAe,CAAC,CAAC;EACzC,CAAC;EAED;AACF;AACA;AACA;EACEC,sBAAsBA,CAAA,EAAY;IAChC,OAAOX,cAAc,CAACW,sBAAsB,CAAC,CAAC;EAChD,CAAC;EAED;AACF;AACA;AACA;EACEC,aAAaA,CAAA,EAAY;IACvB,OAAOZ,cAAc,CAACY,aAAa,CAAC,CAAC;EACvC,CAAC;EAED;AACF;AACA;AACA;EACEC,gBAAgBA,CAAA,EAAY;IAC1B,OAAOb,cAAc,CAACa,gBAAgB,CAAC,CAAC;EAC1C,CAAC;EAED;AACF;AACA;AACA;EACEC,oBAAoBA,CAAA,EAAY;IAC9B,OAAOd,cAAc,CAACc,oBAAoB,CAAC,CAAC;EAC9C;AACF,CAAU","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["RootBeer"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
/** Runs all RootBeer checks (includes BusyBox check). */
|
|
4
|
+
isRooted(): boolean;
|
|
5
|
+
/** Runs all RootBeer checks except the BusyBox check. */
|
|
6
|
+
isRootedWithoutBusyBoxCheck(): boolean;
|
|
7
|
+
/** Checks for the presence of known potentially-dangerous rooting apps. */
|
|
8
|
+
detectPotentiallyDangerousApps(): boolean;
|
|
9
|
+
/** Checks for the presence of known root management apps (e.g. SuperSU, Magisk Manager). */
|
|
10
|
+
detectRootManagementApps(): boolean;
|
|
11
|
+
/** Checks if the device is running a test-keys build (non-official ROM). */
|
|
12
|
+
detectTestKeys(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Checks for the presence of a specific binary (e.g. "su", "busybox").
|
|
15
|
+
* @param binaryName - The name of the binary to look for.
|
|
16
|
+
*/
|
|
17
|
+
checkForBinary(binaryName: string): boolean;
|
|
18
|
+
/** Checks for dangerous system properties that indicate rooting. */
|
|
19
|
+
checkForDangerousProps(): boolean;
|
|
20
|
+
/** Checks for writable paths that should be read-only on a stock device. */
|
|
21
|
+
checkForRWPaths(): boolean;
|
|
22
|
+
/** Checks for the presence of known root-cloaking apps (e.g. RootCloak). */
|
|
23
|
+
detectRootCloakingApps(): boolean;
|
|
24
|
+
/** Attempts to execute `su` and checks whether it succeeds. */
|
|
25
|
+
checkSuExists(): boolean;
|
|
26
|
+
/** Scans common binary paths for the `su` binary. */
|
|
27
|
+
checkForSuBinary(): boolean;
|
|
28
|
+
/** Scans common binary paths for the Magisk binary. */
|
|
29
|
+
checkForMagiskBinary(): boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const _default: Spec;
|
|
32
|
+
export default _default;
|
|
33
|
+
//# sourceMappingURL=NativeRootBeer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeRootBeer.d.ts","sourceRoot":"","sources":["../../../src/NativeRootBeer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,yDAAyD;IACzD,QAAQ,IAAI,OAAO,CAAC;IAEpB,yDAAyD;IACzD,2BAA2B,IAAI,OAAO,CAAC;IAEvC,2EAA2E;IAC3E,8BAA8B,IAAI,OAAO,CAAC;IAE1C,4FAA4F;IAC5F,wBAAwB,IAAI,OAAO,CAAC;IAEpC,4EAA4E;IAC5E,cAAc,IAAI,OAAO,CAAC;IAE1B;;;OAGG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5C,oEAAoE;IACpE,sBAAsB,IAAI,OAAO,CAAC;IAElC,4EAA4E;IAC5E,eAAe,IAAI,OAAO,CAAC;IAE3B,4EAA4E;IAC5E,sBAAsB,IAAI,OAAO,CAAC;IAElC,+DAA+D;IAC/D,aAAa,IAAI,OAAO,CAAC;IAEzB,qDAAqD;IACrD,gBAAgB,IAAI,OAAO,CAAC;IAE5B,uDAAuD;IACvD,oBAAoB,IAAI,OAAO,CAAC;CACjC;;AAED,wBAAkE"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A wrapper around the RootBeer Android root-detection library.
|
|
3
|
+
* All methods call through to `com.scottyab:rootbeer-lib` via JSI.
|
|
4
|
+
*
|
|
5
|
+
* On iOS (or any non-Android platform) these methods will throw because
|
|
6
|
+
* the TurboModule is enforcing — guard calls with `Platform.OS === 'android'`
|
|
7
|
+
* if cross-platform support is needed.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { Platform } from 'react-native';
|
|
12
|
+
* import { RootBeer } from 'react-native-root-beer';
|
|
13
|
+
*
|
|
14
|
+
* if (Platform.OS === 'android') {
|
|
15
|
+
* const rooted = RootBeer.isRooted();
|
|
16
|
+
* console.log('Device is rooted:', rooted);
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const RootBeer: {
|
|
21
|
+
/**
|
|
22
|
+
* Runs all RootBeer checks (includes BusyBox check).
|
|
23
|
+
* This is the main high-level check — prefer this for most use cases.
|
|
24
|
+
*/
|
|
25
|
+
readonly isRooted: () => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Runs all RootBeer checks except the BusyBox check.
|
|
28
|
+
* Use this if BusyBox false-positives are a concern in your environment.
|
|
29
|
+
*/
|
|
30
|
+
readonly isRootedWithoutBusyBoxCheck: () => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Checks for the presence of known potentially-dangerous rooting apps
|
|
33
|
+
* (e.g. apps that typically accompany root access).
|
|
34
|
+
*/
|
|
35
|
+
readonly detectPotentiallyDangerousApps: () => boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Checks for the presence of known root management apps
|
|
38
|
+
* (e.g. SuperSU, Magisk Manager, KingRoot).
|
|
39
|
+
*/
|
|
40
|
+
readonly detectRootManagementApps: () => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Checks if the device build is signed with test-keys instead of
|
|
43
|
+
* release-keys. Test-key builds typically indicate a custom/rooted ROM.
|
|
44
|
+
*/
|
|
45
|
+
readonly detectTestKeys: () => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Checks for the presence of a specific binary by scanning common paths.
|
|
48
|
+
* @param binaryName - The binary to search for, e.g. `"su"`, `"busybox"`.
|
|
49
|
+
*/
|
|
50
|
+
readonly checkForBinary: (binaryName: string) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Checks for dangerous system properties that are commonly set on rooted
|
|
53
|
+
* devices (e.g. `ro.debuggable=1`, `ro.secure=0`).
|
|
54
|
+
*/
|
|
55
|
+
readonly checkForDangerousProps: () => boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Checks for file-system paths that should be read-only on a stock device
|
|
58
|
+
* but are mounted as read-write — a strong indicator of root access.
|
|
59
|
+
*/
|
|
60
|
+
readonly checkForRWPaths: () => boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Checks for the presence of known root-cloaking apps (e.g. RootCloak,
|
|
63
|
+
* Hide My Root) that try to hide root from other apps.
|
|
64
|
+
*/
|
|
65
|
+
readonly detectRootCloakingApps: () => boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Attempts to execute `su` and returns `true` if it succeeds.
|
|
68
|
+
* This is a runtime probe rather than a static file check.
|
|
69
|
+
*/
|
|
70
|
+
readonly checkSuExists: () => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Scans a list of well-known binary paths for the `su` executable.
|
|
73
|
+
* Less invasive than `checkSuExists()` as it doesn't execute anything.
|
|
74
|
+
*/
|
|
75
|
+
readonly checkForSuBinary: () => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Scans common binary paths for the Magisk binary.
|
|
78
|
+
* Useful for detecting Magisk-based root even when it hides itself.
|
|
79
|
+
*/
|
|
80
|
+
readonly checkForMagiskBinary: () => boolean;
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=RootBeer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootBeer.d.ts","sourceRoot":"","sources":["../../../src/RootBeer.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ;IACnB;;;OAGG;6BACS,OAAO;IAInB;;;OAGG;gDAC4B,OAAO;IAItC;;;OAGG;mDAC+B,OAAO;IAIzC;;;OAGG;6CACyB,OAAO;IAInC;;;OAGG;mCACe,OAAO;IAIzB;;;OAGG;0CACwB,MAAM,KAAG,OAAO;IAI3C;;;OAGG;2CACuB,OAAO;IAIjC;;;OAGG;oCACgB,OAAO;IAI1B;;;OAGG;2CACuB,OAAO;IAIjC;;;OAGG;kCACc,OAAO;IAIxB;;;OAGG;qCACiB,OAAO;IAI3B;;;OAGG;yCACqB,OAAO;CAGvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-rootbeer-checkroot",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "RootBeer",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"react-native-rootbeer-checkroot-source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"example": "yarn workspace react-native-root-beer-example",
|
|
36
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
37
|
+
"prepare": "bob build",
|
|
38
|
+
"typecheck": "tsc",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"release": "release-it --only-version",
|
|
42
|
+
"web": "vite",
|
|
43
|
+
"build:web": "vite build"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"react-native",
|
|
47
|
+
"ios",
|
|
48
|
+
"android"
|
|
49
|
+
],
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://mrx.com.git"
|
|
53
|
+
},
|
|
54
|
+
"author": "mr:X <mrx43543543@gmail.com> (https://mrx.comtranslate.google.com)",
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://mrx.com/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://mrx.com#readme",
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"registry": "https://registry.npmjs.org/"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@commitlint/config-conventional": "^21.2.0",
|
|
65
|
+
"@eslint/compat": "^2.1.0",
|
|
66
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
67
|
+
"@eslint/js": "^10.0.1",
|
|
68
|
+
"@jest/globals": "^30.4.1",
|
|
69
|
+
"@react-native/babel-preset": "0.86.0",
|
|
70
|
+
"@react-native/eslint-config": "0.86.0",
|
|
71
|
+
"@react-native/jest-preset": "0.86.0",
|
|
72
|
+
"@release-it/conventional-changelog": "^11.0.1",
|
|
73
|
+
"@types/react": "^19.2.17",
|
|
74
|
+
"commitlint": "^21.2.0",
|
|
75
|
+
"del-cli": "^7.0.0",
|
|
76
|
+
"eslint": "^10.6.0",
|
|
77
|
+
"eslint-config-prettier": "^10.1.8",
|
|
78
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
79
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
80
|
+
"jest": "^30.4.2",
|
|
81
|
+
"lefthook": "^2.1.9",
|
|
82
|
+
"prettier": "^3.9.4",
|
|
83
|
+
"react": "19.2.7",
|
|
84
|
+
"react-native": "0.86.0",
|
|
85
|
+
"react-native-builder-bob": "^0.43.0",
|
|
86
|
+
"react-native-web": "~0.21.2",
|
|
87
|
+
"release-it": "^20.2.1",
|
|
88
|
+
"turbo": "^2.10.4",
|
|
89
|
+
"typescript": "^6.0.3"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"react": "*",
|
|
93
|
+
"react-native": "*"
|
|
94
|
+
},
|
|
95
|
+
"workspaces": [
|
|
96
|
+
"example"
|
|
97
|
+
],
|
|
98
|
+
"packageManager": "yarn@4.11.0",
|
|
99
|
+
"react-native-builder-bob": {
|
|
100
|
+
"source": "src",
|
|
101
|
+
"output": "lib",
|
|
102
|
+
"targets": [
|
|
103
|
+
[
|
|
104
|
+
"module",
|
|
105
|
+
{
|
|
106
|
+
"esm": true
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
"typescript",
|
|
111
|
+
{
|
|
112
|
+
"project": "tsconfig.build.json"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"codegenConfig": {
|
|
118
|
+
"name": "RootBeerSpec",
|
|
119
|
+
"type": "modules",
|
|
120
|
+
"jsSrcsDir": "src",
|
|
121
|
+
"android": {
|
|
122
|
+
"javaPackageName": "com.rootbeer"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"prettier": {
|
|
126
|
+
"quoteProps": "consistent",
|
|
127
|
+
"singleQuote": true,
|
|
128
|
+
"tabWidth": 2,
|
|
129
|
+
"trailingComma": "es5",
|
|
130
|
+
"useTabs": false
|
|
131
|
+
},
|
|
132
|
+
"jest": {
|
|
133
|
+
"preset": "@react-native/jest-preset",
|
|
134
|
+
"testEnvironmentOptions": {
|
|
135
|
+
"customExportConditions": [
|
|
136
|
+
"require",
|
|
137
|
+
"react-native",
|
|
138
|
+
"<%- project.sourceCondition -%>"
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"modulePathIgnorePatterns": [
|
|
142
|
+
"<rootDir>/example/node_modules",
|
|
143
|
+
"<rootDir>/lib/"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
"commitlint": {
|
|
147
|
+
"extends": [
|
|
148
|
+
"@commitlint/config-conventional"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
"release-it": {
|
|
152
|
+
"git": {
|
|
153
|
+
"commitMessage": "chore: release ${version}",
|
|
154
|
+
"tagName": "v${version}"
|
|
155
|
+
},
|
|
156
|
+
"npm": {
|
|
157
|
+
"publish": true
|
|
158
|
+
},
|
|
159
|
+
"github": {
|
|
160
|
+
"release": true
|
|
161
|
+
},
|
|
162
|
+
"plugins": {
|
|
163
|
+
"@release-it/conventional-changelog": {
|
|
164
|
+
"preset": {
|
|
165
|
+
"name": "angular"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"create-react-native-library": {
|
|
171
|
+
"type": "turbo-module",
|
|
172
|
+
"languages": "kotlin-objc",
|
|
173
|
+
"tools": [
|
|
174
|
+
"eslint",
|
|
175
|
+
"jest",
|
|
176
|
+
"lefthook",
|
|
177
|
+
"release-it",
|
|
178
|
+
"vite"
|
|
179
|
+
],
|
|
180
|
+
"version": "0.63.0"
|
|
181
|
+
}
|
|
182
|
+
}
|