@akilrafeek/capacitor-jailbreak-root-detection 1.0.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.
Files changed (33) hide show
  1. package/MeedikaCapacitorJailbreakRootDetection.podspec +17 -0
  2. package/README.md +78 -0
  3. package/android/build.gradle +59 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/java/com/evehr/plugins/capacitor/jailbreakrootdetection/CapacitorJailbreakRootDetection.java +17 -0
  6. package/android/src/main/java/com/evehr/plugins/capacitor/jailbreakrootdetection/CapacitorJailbreakRootDetectionPlugin.java +66 -0
  7. package/android/src/main/java/com/evehr/plugins/capacitor/jailbreakrootdetection/Rooted/CheckApiVersion.java +5 -0
  8. package/android/src/main/java/com/evehr/plugins/capacitor/jailbreakrootdetection/Rooted/EmulatorDetector.java +162 -0
  9. package/android/src/main/java/com/evehr/plugins/capacitor/jailbreakrootdetection/Rooted/GreaterThan23.java +44 -0
  10. package/android/src/main/java/com/evehr/plugins/capacitor/jailbreakrootdetection/Rooted/LessThan23.java +50 -0
  11. package/android/src/main/java/com/evehr/plugins/capacitor/jailbreakrootdetection/Rooted/RootedCheck.java +89 -0
  12. package/android/src/main/res/.gitkeep +0 -0
  13. package/dist/docs.json +78 -0
  14. package/dist/esm/definitions.d.ts +9 -0
  15. package/dist/esm/definitions.js +2 -0
  16. package/dist/esm/definitions.js.map +1 -0
  17. package/dist/esm/index.d.ts +4 -0
  18. package/dist/esm/index.js +7 -0
  19. package/dist/esm/index.js.map +1 -0
  20. package/dist/esm/web.d.ts +8 -0
  21. package/dist/esm/web.js +22 -0
  22. package/dist/esm/web.js.map +1 -0
  23. package/dist/plugin.cjs.js +38 -0
  24. package/dist/plugin.cjs.js.map +1 -0
  25. package/dist/plugin.js +41 -0
  26. package/dist/plugin.js.map +1 -0
  27. package/ios/Plugin/CapacitorJailbreakRootDetection.swift +18 -0
  28. package/ios/Plugin/CapacitorJailbreakRootDetectionPlugin.h +10 -0
  29. package/ios/Plugin/CapacitorJailbreakRootDetectionPlugin.m +11 -0
  30. package/ios/Plugin/CapacitorJailbreakRootDetectionPlugin.swift +37 -0
  31. package/ios/Plugin/Info.plist +28 -0
  32. package/ios/Plugin/UIDeviceJailBroken.swift +100 -0
  33. package/package.json +344 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CapacitorJailbreakRootDetectionPlugin {\n isJailbrokenOrRooted(): Promise<JailbreakRootResult>;\n isSimulator(): Promise<JailbreakRootResult>;\n isDebuggedMode(): Promise<JailbreakRootResult>;\n exitApp(): void;\n}\n\nexport interface JailbreakRootResult {\n result: boolean;\n}"]}
@@ -0,0 +1,4 @@
1
+ import type { CapacitorJailbreakRootDetectionPlugin } from './definitions';
2
+ declare const CapacitorJailbreakRootDetection: CapacitorJailbreakRootDetectionPlugin;
3
+ export * from './definitions';
4
+ export { CapacitorJailbreakRootDetection };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const CapacitorJailbreakRootDetection = registerPlugin('CapacitorJailbreakRootDetection', {
3
+ web: () => import('./web').then(m => new m.CapacitorJailbreakRootDetectionWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { CapacitorJailbreakRootDetection };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,+BAA+B,GACnC,cAAc,CACZ,iCAAiC,EACjC;IACE,GAAG,EAAE,GAAG,EAAE,CACR,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,kCAAkC,EAAE,CAAC;CACxE,CACF,CAAC;AAEJ,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapacitorJailbreakRootDetectionPlugin } from './definitions';\n\nconst CapacitorJailbreakRootDetection =\n registerPlugin<CapacitorJailbreakRootDetectionPlugin>(\n 'CapacitorJailbreakRootDetection',\n {\n web: () =>\n import('./web').then(m => new m.CapacitorJailbreakRootDetectionWeb()),\n },\n );\n\nexport * from './definitions';\nexport { CapacitorJailbreakRootDetection };\n"]}
@@ -0,0 +1,8 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { CapacitorJailbreakRootDetectionPlugin, JailbreakRootResult } from './definitions';
3
+ export declare class CapacitorJailbreakRootDetectionWeb extends WebPlugin implements CapacitorJailbreakRootDetectionPlugin {
4
+ exitApp(): void;
5
+ isJailbrokenOrRooted(): Promise<JailbreakRootResult>;
6
+ isSimulator(): Promise<JailbreakRootResult>;
7
+ isDebuggedMode(): Promise<JailbreakRootResult>;
8
+ }
@@ -0,0 +1,22 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class CapacitorJailbreakRootDetectionWeb extends WebPlugin {
3
+ exitApp() {
4
+ // Do Nothing
5
+ }
6
+ async isJailbrokenOrRooted() {
7
+ return {
8
+ result: false,
9
+ };
10
+ }
11
+ async isSimulator() {
12
+ return {
13
+ result: false,
14
+ };
15
+ }
16
+ async isDebuggedMode() {
17
+ return {
18
+ result: false,
19
+ };
20
+ }
21
+ }
22
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,kCACX,SAAQ,SAAS;IAGjB,OAAO;QACL,aAAa;IACf,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,OAAO;YACL,MAAM,EAAE,KAAK;SACd,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,WAAW;QACf,OAAO;YACL,MAAM,EAAE,KAAK;SACd,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,cAAc;QAClB,OAAO;YACL,MAAM,EAAE,KAAK;SACd,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorJailbreakRootDetectionPlugin, JailbreakRootResult } from './definitions';\n\nexport class CapacitorJailbreakRootDetectionWeb\n extends WebPlugin\n implements CapacitorJailbreakRootDetectionPlugin\n{\n exitApp(): void {\n // Do Nothing\n }\n\n async isJailbrokenOrRooted(): Promise<JailbreakRootResult> {\n return {\n result: false,\n };\n }\n async isSimulator(): Promise<JailbreakRootResult> {\n return {\n result: false,\n };\n }\n async isDebuggedMode(): Promise<JailbreakRootResult> {\n return {\n result: false,\n };\n }\n}\n"]}
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@capacitor/core');
6
+
7
+ const CapacitorJailbreakRootDetection = core.registerPlugin('CapacitorJailbreakRootDetection', {
8
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorJailbreakRootDetectionWeb()),
9
+ });
10
+
11
+ class CapacitorJailbreakRootDetectionWeb extends core.WebPlugin {
12
+ exitApp() {
13
+ // Do Nothing
14
+ }
15
+ async isJailbrokenOrRooted() {
16
+ return {
17
+ result: false,
18
+ };
19
+ }
20
+ async isSimulator() {
21
+ return {
22
+ result: false,
23
+ };
24
+ }
25
+ async isDebuggedMode() {
26
+ return {
27
+ result: false,
28
+ };
29
+ }
30
+ }
31
+
32
+ var web = /*#__PURE__*/Object.freeze({
33
+ __proto__: null,
34
+ CapacitorJailbreakRootDetectionWeb: CapacitorJailbreakRootDetectionWeb
35
+ });
36
+
37
+ exports.CapacitorJailbreakRootDetection = CapacitorJailbreakRootDetection;
38
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorJailbreakRootDetection = registerPlugin('CapacitorJailbreakRootDetection', {\n web: () => import('./web').then(m => new m.CapacitorJailbreakRootDetectionWeb()),\n});\nexport * from './definitions';\nexport { CapacitorJailbreakRootDetection };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorJailbreakRootDetectionWeb extends WebPlugin {\n exitApp() {\n // Do Nothing\n }\n async isJailbrokenOrRooted() {\n return {\n result: false,\n };\n }\n async isSimulator() {\n return {\n result: false,\n };\n }\n async isDebuggedMode() {\n return {\n result: false,\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,+BAA+B,GAAGA,mBAAc,CAAC,iCAAiC,EAAE;AAC1F,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kCAAkC,EAAE,CAAC;AACpF,CAAC;;ACFM,MAAM,kCAAkC,SAASC,cAAS,CAAC;AAClE,IAAI,OAAO,GAAG;AACd;AACA,KAAK;AACL,IAAI,MAAM,oBAAoB,GAAG;AACjC,QAAQ,OAAO;AACf,YAAY,MAAM,EAAE,KAAK;AACzB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,OAAO;AACf,YAAY,MAAM,EAAE,KAAK;AACzB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,OAAO;AACf,YAAY,MAAM,EAAE,KAAK;AACzB,SAAS,CAAC;AACV,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,41 @@
1
+ var capacitorCapacitorJailbreakRootDetection = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const CapacitorJailbreakRootDetection = core.registerPlugin('CapacitorJailbreakRootDetection', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorJailbreakRootDetectionWeb()),
6
+ });
7
+
8
+ class CapacitorJailbreakRootDetectionWeb extends core.WebPlugin {
9
+ exitApp() {
10
+ // Do Nothing
11
+ }
12
+ async isJailbrokenOrRooted() {
13
+ return {
14
+ result: false,
15
+ };
16
+ }
17
+ async isSimulator() {
18
+ return {
19
+ result: false,
20
+ };
21
+ }
22
+ async isDebuggedMode() {
23
+ return {
24
+ result: false,
25
+ };
26
+ }
27
+ }
28
+
29
+ var web = /*#__PURE__*/Object.freeze({
30
+ __proto__: null,
31
+ CapacitorJailbreakRootDetectionWeb: CapacitorJailbreakRootDetectionWeb
32
+ });
33
+
34
+ exports.CapacitorJailbreakRootDetection = CapacitorJailbreakRootDetection;
35
+
36
+ Object.defineProperty(exports, '__esModule', { value: true });
37
+
38
+ return exports;
39
+
40
+ })({}, capacitorExports);
41
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorJailbreakRootDetection = registerPlugin('CapacitorJailbreakRootDetection', {\n web: () => import('./web').then(m => new m.CapacitorJailbreakRootDetectionWeb()),\n});\nexport * from './definitions';\nexport { CapacitorJailbreakRootDetection };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorJailbreakRootDetectionWeb extends WebPlugin {\n exitApp() {\n // Do Nothing\n }\n async isJailbrokenOrRooted() {\n return {\n result: false,\n };\n }\n async isSimulator() {\n return {\n result: false,\n };\n }\n async isDebuggedMode() {\n return {\n result: false,\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,+BAA+B,GAAGA,mBAAc,CAAC,iCAAiC,EAAE;IAC1F,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kCAAkC,EAAE,CAAC;IACpF,CAAC;;ICFM,MAAM,kCAAkC,SAASC,cAAS,CAAC;IAClE,IAAI,OAAO,GAAG;IACd;IACA,KAAK;IACL,IAAI,MAAM,oBAAoB,GAAG;IACjC,QAAQ,OAAO;IACf,YAAY,MAAM,EAAE,KAAK;IACzB,SAAS,CAAC;IACV,KAAK;IACL,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,OAAO;IACf,YAAY,MAAM,EAAE,KAAK;IACzB,SAAS,CAAC;IACV,KAAK;IACL,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,OAAO;IACf,YAAY,MAAM,EAAE,KAAK;IACzB,SAAS,CAAC;IACV,KAAK;IACL;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,18 @@
1
+ import Foundation
2
+
3
+ @objc public class CapacitorJailbreakRootDetection: NSObject {
4
+ @objc public func isJailbrokenOrRooted(_ value: String) -> String {
5
+ print(value)
6
+ return value
7
+ }
8
+
9
+ @objc public func isSimulator(_ value: String) -> String {
10
+ print(value)
11
+ return value
12
+ }
13
+
14
+ @objc public func isDebuggedMode(_ value: String) -> String {
15
+ print(value)
16
+ return value
17
+ }
18
+ }
@@ -0,0 +1,10 @@
1
+ #import <UIKit/UIKit.h>
2
+
3
+ //! Project version number for Plugin.
4
+ FOUNDATION_EXPORT double PluginVersionNumber;
5
+
6
+ //! Project version string for Plugin.
7
+ FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8
+
9
+ // In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
10
+
@@ -0,0 +1,11 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <Capacitor/Capacitor.h>
3
+
4
+ // Define the plugin using the CAP_PLUGIN Macro, and
5
+ // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
+ CAP_PLUGIN(CapacitorJailbreakRootDetectionPlugin, "CapacitorJailbreakRootDetection",
7
+ CAP_PLUGIN_METHOD(isJailbrokenOrRooted, CAPPluginReturnPromise);
8
+ CAP_PLUGIN_METHOD(isSimulator, CAPPluginReturnPromise);
9
+ CAP_PLUGIN_METHOD(isDebuggedMode, CAPPluginReturnPromise);
10
+ CAP_PLUGIN_METHOD(exitApp, CAPPluginReturnNone);
11
+ )
@@ -0,0 +1,37 @@
1
+ import Foundation
2
+ import Capacitor
3
+ import UIKit
4
+
5
+ /**
6
+ * Please read the Capacitor iOS Plugin Development Guide
7
+ * here: https://capacitorjs.com/docs/plugins/ios
8
+ */
9
+ @objc(CapacitorJailbreakRootDetectionPlugin)
10
+ public class CapacitorJailbreakRootDetectionPlugin: CAPPlugin {
11
+ private let implementation = CapacitorJailbreakRootDetection()
12
+
13
+ @objc func isJailbrokenOrRooted(_ call: CAPPluginCall) {
14
+ call.resolve([
15
+ "result": UIDevice.current.isJailBroken
16
+ ])
17
+ }
18
+
19
+ @objc func isSimulator(_ call: CAPPluginCall) {
20
+ call.resolve([
21
+ "result": UIDevice.current.isSimulator
22
+ ])
23
+ }
24
+
25
+ @objc func isDebuggedMode(_ call: CAPPluginCall) {
26
+ call.resolve([
27
+ "result": UIDevice.current.isDebuggedMode
28
+ ])
29
+ }
30
+
31
+ @objc func exitApp(_ call: CAPPluginCall) {
32
+ UIControl().sendAction(#selector(NSXPCConnection.suspend), to: UIApplication.shared, for: nil)
33
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
34
+ exit(EXIT_SUCCESS)
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>FMWK</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleVersion</key>
20
+ <string>$(CURRENT_PROJECT_VERSION)</string>
21
+ <key>NSPrincipalClass</key>
22
+ <string></string>
23
+ <key>LSApplicationQueriesSchemes</key>
24
+ <array>
25
+ <string>cydia</string>
26
+ </array>
27
+ </dict>
28
+ </plist>
@@ -0,0 +1,100 @@
1
+ //
2
+ // UIDevice+JailBroken.swift
3
+ // IsJailBroken
4
+ //
5
+ // Created by Vineet Choudhary on 07/02/20.
6
+ // Copyright © 2020 Developer Insider. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+ import UIKit
11
+
12
+ extension UIDevice {
13
+ var isSimulator: Bool {
14
+ return TARGET_OS_SIMULATOR != 0
15
+ }
16
+
17
+ var isDebuggedMode: Bool {
18
+ return UIDevice.current.isSimulator
19
+ }
20
+
21
+ var isJailBroken: Bool {
22
+ get {
23
+ // if UIDevice.current.isSimulator { return false }
24
+ if JailBrokenHelper.hasCydiaInstalled() { return true }
25
+ if JailBrokenHelper.isContainsSuspiciousApps() { return true }
26
+ if JailBrokenHelper.isSuspiciousSystemPathsExists() { return true }
27
+ return JailBrokenHelper.canEditSystemFiles()
28
+ }
29
+ }
30
+ }
31
+
32
+ private struct JailBrokenHelper {
33
+ static func hasCydiaInstalled() -> Bool {
34
+ return UIApplication.shared.canOpenURL(URL(string: "cydia://")!)
35
+ }
36
+
37
+ static func isContainsSuspiciousApps() -> Bool {
38
+ for path in suspiciousAppsPathToCheck {
39
+ if FileManager.default.fileExists(atPath: path) {
40
+ return true
41
+ }
42
+ }
43
+ return false
44
+ }
45
+
46
+ static func isSuspiciousSystemPathsExists() -> Bool {
47
+ for path in suspiciousSystemPathsToCheck {
48
+ if FileManager.default.fileExists(atPath: path) {
49
+ return true
50
+ }
51
+ }
52
+ return false
53
+ }
54
+
55
+ static func canEditSystemFiles() -> Bool {
56
+ let jailBreakText = "Developer Insider"
57
+ do {
58
+ try jailBreakText.write(toFile: jailBreakText, atomically: true, encoding: .utf8)
59
+ return true
60
+ } catch {
61
+ return false
62
+ }
63
+ }
64
+
65
+ /**
66
+ Add more paths here to check for jail break
67
+ */
68
+ static var suspiciousAppsPathToCheck: [String] {
69
+ return ["/Applications/Cydia.app",
70
+ "/Applications/blackra1n.app",
71
+ "/Applications/FakeCarrier.app",
72
+ "/Applications/Icy.app",
73
+ "/Applications/IntelliScreen.app",
74
+ "/Applications/MxTube.app",
75
+ "/Applications/RockApp.app",
76
+ "/Applications/SBSettings.app",
77
+ "/Applications/WinterBoard.app"
78
+ ]
79
+ }
80
+
81
+ static var suspiciousSystemPathsToCheck: [String] {
82
+ return ["/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist",
83
+ "/Library/MobileSubstrate/DynamicLibraries/Veency.plist",
84
+ "/private/var/lib/apt",
85
+ "/private/var/lib/apt/",
86
+ "/private/var/lib/cydia",
87
+ "/private/var/mobile/Library/SBSettings/Themes",
88
+ "/private/var/stash",
89
+ "/private/var/tmp/cydia.log",
90
+ "/System/Library/LaunchDaemons/com.ikey.bbot.plist",
91
+ "/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist",
92
+ "/usr/bin/sshd",
93
+ "/usr/libexec/sftp-server",
94
+ "/usr/sbin/sshd",
95
+ "/etc/apt",
96
+ "/bin/bash",
97
+ "/Library/MobileSubstrate/MobileSubstrate.dylib"
98
+ ]
99
+ }
100
+ }