jailbreak-root-detection 0.0.1

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.
@@ -0,0 +1,17 @@
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 = 'JailbreakRootDetection'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '13.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Amarendra Kumar Pandey
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "JailbreakRootDetection",
6
+ platforms: [.iOS(.v13)],
7
+ products: [
8
+ .library(
9
+ name: "JailbreakRootDetection",
10
+ targets: ["JailbreakRootDetectionPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "JailbreakRootDetectionPlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
20
+ .product(name: "Cordova", package: "capacitor-swift-pm")
21
+ ],
22
+ path: "ios/Sources/JailbreakRootDetectionPlugin"),
23
+ .testTarget(
24
+ name: "JailbreakRootDetectionPluginTests",
25
+ dependencies: ["JailbreakRootDetectionPlugin"],
26
+ path: "ios/Tests/JailbreakRootDetectionPluginTests")
27
+ ]
28
+ )
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # jailbreak-root-detection
2
+
3
+ A plugin to detect integrity of the user device(iOS/Android)
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install jailbreak-root-detection
9
+ npx cap sync
10
+ ```
11
+
12
+ ## API
13
+
14
+ <docgen-index>
15
+
16
+ * [`echo(...)`](#echo)
17
+ * [`jailbroken(...)`](#jailbroken)
18
+
19
+ </docgen-index>
20
+
21
+ <docgen-api>
22
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
23
+
24
+ ### echo(...)
25
+
26
+ ```typescript
27
+ echo(options: { value: string; }) => Promise<{ value: string; }>
28
+ ```
29
+
30
+ | Param | Type |
31
+ | ------------- | ------------------------------- |
32
+ | **`options`** | <code>{ value: string; }</code> |
33
+
34
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
35
+
36
+ --------------------
37
+
38
+
39
+ ### jailbroken(...)
40
+
41
+ ```typescript
42
+ jailbroken(options: { verificationKey: string; decryptionKey: string; }) => Promise<{ isJailbroken: boolean; }>
43
+ ```
44
+
45
+ | Param | Type |
46
+ | ------------- | ---------------------------------------------------------------- |
47
+ | **`options`** | <code>{ verificationKey: string; decryptionKey: string; }</code> |
48
+
49
+ **Returns:** <code>Promise&lt;{ isJailbroken: boolean; }&gt;</code>
50
+
51
+ --------------------
52
+
53
+ </docgen-api>
@@ -0,0 +1,61 @@
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ google()
11
+ mavenCentral()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:8.2.1'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ namespace "com.smartwinnr.plugins.jailbreakrootdetection"
22
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
23
+ defaultConfig {
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
26
+ versionCode 1
27
+ versionName "1.0"
28
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
29
+ }
30
+ buildTypes {
31
+ release {
32
+ minifyEnabled false
33
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
34
+ }
35
+ }
36
+ lintOptions {
37
+ abortOnError false
38
+ }
39
+ compileOptions {
40
+ sourceCompatibility JavaVersion.VERSION_17
41
+ targetCompatibility JavaVersion.VERSION_17
42
+ }
43
+ }
44
+
45
+ repositories {
46
+ google()
47
+ mavenCentral()
48
+ }
49
+
50
+
51
+ dependencies {
52
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
53
+ implementation project(':capacitor-android')
54
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
+ testImplementation "junit:junit:$junitVersion"
56
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
+ implementation 'org.bitbucket.b_c:jose4j:0.9.6'
59
+ implementation 'com.google.android.play:integrity:1.3.0'
60
+ implementation 'org.slf4j:slf4j-api:1.7.32'
61
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,134 @@
1
+ package com.smartwinnr.plugins.jailbreakrootdetection;
2
+
3
+ import java.util.ArrayList;
4
+ import java.util.Arrays;
5
+
6
+ final class Const {
7
+
8
+ static final String BINARY_SU = "su";
9
+ static final String BINARY_BUSYBOX = "busybox";
10
+
11
+ private Const() throws InstantiationException {
12
+ throw new InstantiationException("This class is not for instantiation");
13
+ }
14
+
15
+ static final String[] knownRootAppsPackages = {
16
+ "com.noshufou.android.su",
17
+ "com.noshufou.android.su.elite",
18
+ "eu.chainfire.supersu",
19
+ "com.koushikdutta.superuser",
20
+ "com.thirdparty.superuser",
21
+ "com.yellowes.su",
22
+ "com.topjohnwu.magisk",
23
+ "com.kingroot.kinguser",
24
+ "com.kingo.root",
25
+ "com.smedialink.oneclickroot",
26
+ "com.zhiqupk.root.global",
27
+ "com.alephzain.framaroot"
28
+ };
29
+
30
+ public static final String[] knownDangerousAppsPackages = {
31
+ "com.koushikdutta.rommanager",
32
+ "com.koushikdutta.rommanager.license",
33
+ "com.dimonvideo.luckypatcher",
34
+ "com.chelpus.lackypatch",
35
+ "com.ramdroid.appquarantine",
36
+ "com.ramdroid.appquarantinepro",
37
+ "com.android.vending.billing.InAppBillingService.COIN",
38
+ "com.android.vending.billing.InAppBillingService.LUCK",
39
+ "com.chelpus.luckypatcher",
40
+ "com.blackmartalpha",
41
+ "org.blackmart.market",
42
+ "com.allinone.free",
43
+ "com.repodroid.app",
44
+ "org.creeplays.hack",
45
+ "com.baseappfull.fwd",
46
+ "com.zmapp",
47
+ "com.dv.marketmod.installer",
48
+ "org.mobilism.android",
49
+ "com.android.wp.net.log",
50
+ "com.android.camera.update",
51
+ "cc.madkite.freedom",
52
+ "com.solohsu.android.edxp.manager",
53
+ "org.meowcat.edxposed.manager",
54
+ "com.xmodgame",
55
+ "com.cih.game_cih",
56
+ "com.charles.lpoqasert",
57
+ "catch_.me_.if_.you_.can_"
58
+ };
59
+
60
+ public static final String[] knownRootCloakingPackages = {
61
+ "com.devadvance.rootcloak",
62
+ "com.devadvance.rootcloakplus",
63
+ "de.robv.android.xposed.installer",
64
+ "com.saurik.substrate",
65
+ "com.zachspong.temprootremovejb",
66
+ "com.amphoras.hidemyroot",
67
+ "com.amphoras.hidemyrootadfree",
68
+ "com.formyhm.hiderootPremium",
69
+ "com.formyhm.hideroot"
70
+ };
71
+
72
+ // These must end with a /
73
+ private static final String[] suPaths = {
74
+ "/data/local/",
75
+ "/data/local/bin/",
76
+ "/data/local/xbin/",
77
+ "/sbin/",
78
+ "/su/bin/",
79
+ "/system/bin/",
80
+ "/system/bin/.ext/",
81
+ "/system/bin/failsafe/",
82
+ "/system/sd/xbin/",
83
+ "/system/usr/we-need-root/",
84
+ "/system/xbin/",
85
+ "/cache/",
86
+ "/data/",
87
+ "/dev/"
88
+ };
89
+
90
+
91
+ static final String[] pathsThatShouldNotBeWritable = {
92
+ "/system",
93
+ "/system/bin",
94
+ "/system/sbin",
95
+ "/system/xbin",
96
+ "/vendor/bin",
97
+ "/sbin",
98
+ "/etc",
99
+ //"/sys",
100
+ //"/proc",
101
+ //"/dev"
102
+ };
103
+
104
+ /**
105
+ * Get a list of paths to check for binaries
106
+ *
107
+ * @return List of paths to check, using a combination of a static list and those paths
108
+ * listed in the PATH environment variable.
109
+ */
110
+ static String[] getPaths() {
111
+ ArrayList<String> paths = new ArrayList<>(Arrays.asList(suPaths));
112
+
113
+ String sysPaths = System.getenv("PATH");
114
+
115
+ // If we can't get the path variable just return the static paths
116
+ if (sysPaths == null || "".equals(sysPaths)) {
117
+ return paths.toArray(new String[0]);
118
+ }
119
+
120
+ for (String path : sysPaths.split(":")) {
121
+
122
+ if (!path.endsWith("/")) {
123
+ path = path + '/';
124
+ }
125
+
126
+ if (!paths.contains(path)) {
127
+ paths.add(path);
128
+ }
129
+ }
130
+
131
+ return paths.toArray(new String[0]);
132
+ }
133
+
134
+ }