@aalzehla/capacitor-jailbreak-root-detection 1.0.0 → 1.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.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @evehr/capacitor-jailbreak-root-detection
2
2
 
3
3
  Jailbreak Root detection plugin for capacitor. Supports Capacior 5 and 6.
4
+ This plugin also supports Frida Detection.
5
+
4
6
  a clone of @evehr/capacitor-jailbreak-root-detection repository.
5
7
 
6
8
  ## Install
@@ -15,6 +17,7 @@ npx cap sync
15
17
  <docgen-index>
16
18
 
17
19
  * [`isJailbrokenOrRooted()`](#isjailbrokenorrooted)
20
+ * [`isFridaRunning()`](#isfridarunning)
18
21
  * [`isSimulator()`](#issimulator)
19
22
  * [`isDebuggedMode()`](#isdebuggedmode)
20
23
  * [`exitApp()`](#exitapp)
@@ -36,6 +39,17 @@ isJailbrokenOrRooted() => Promise<JailbreakRootResult>
36
39
  --------------------
37
40
 
38
41
 
42
+ ### isFridaRunning()
43
+
44
+ ```typescript
45
+ isFridaRunning() => Promise<JailbreakRootResult>
46
+ ```
47
+
48
+ **Returns:** <code>Promise&lt;<a href="#jailbreakrootresult">JailbreakRootResult</a>&gt;</code>
49
+
50
+ --------------------
51
+
52
+
39
53
  ### isSimulator()
40
54
 
41
55
  ```typescript
@@ -6,6 +6,10 @@ public class CapacitorJailbreakRootDetection {
6
6
  public boolean isJailbrokenOrRooted(boolean value) {
7
7
  return value;
8
8
  }
9
+
10
+ public boolean isFridaRunning(boolean value) {
11
+ return value;
12
+ }
9
13
 
10
14
  public boolean isSimulator(boolean value) {
11
15
  return value;
@@ -31,6 +31,15 @@ public class CapacitorJailbreakRootDetectionPlugin extends Plugin {
31
31
  ret.put("result", implementation.isJailbrokenOrRooted(result));
32
32
  call.resolve(ret);
33
33
  }
34
+
35
+ @PluginMethod
36
+ public void isFridaRunning(PluginCall call) {
37
+ boolean result = false;//rootedCheck.isFridaRunning();
38
+
39
+ JSObject ret = new JSObject();
40
+ ret.put("result", implementation.isFridaRunning(result));
41
+ call.resolve(ret);
42
+ }
34
43
 
35
44
 
36
45
  @PluginMethod
package/dist/docs.json CHANGED
@@ -17,6 +17,18 @@
17
17
  ],
18
18
  "slug": "isjailbrokenorrooted"
19
19
  },
20
+ {
21
+ "name": "isFridaRunning",
22
+ "signature": "() => Promise<JailbreakRootResult>",
23
+ "parameters": [],
24
+ "returns": "Promise<JailbreakRootResult>",
25
+ "tags": [],
26
+ "docs": "",
27
+ "complexTypes": [
28
+ "JailbreakRootResult"
29
+ ],
30
+ "slug": "isfridarunning"
31
+ },
20
32
  {
21
33
  "name": "isSimulator",
22
34
  "signature": "() => Promise<JailbreakRootResult>",
@@ -1,5 +1,6 @@
1
1
  export interface CapacitorJailbreakRootDetectionPlugin {
2
2
  isJailbrokenOrRooted(): Promise<JailbreakRootResult>;
3
+ isFridaRunning(): Promise<JailbreakRootResult>;
3
4
  isSimulator(): Promise<JailbreakRootResult>;
4
5
  isDebuggedMode(): Promise<JailbreakRootResult>;
5
6
  exitApp(): void;
@@ -1 +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}"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CapacitorJailbreakRootDetectionPlugin {\n isJailbrokenOrRooted(): Promise<JailbreakRootResult>;\n isFridaRunning(): Promise<JailbreakRootResult>;\n isSimulator(): Promise<JailbreakRootResult>;\n isDebuggedMode(): Promise<JailbreakRootResult>;\n exitApp(): void;\n}\n\nexport interface JailbreakRootResult {\n result: boolean;\n}"]}
package/dist/esm/web.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { CapacitorJailbreakRootDetectionPlugin, JailbreakRootResult } from
3
3
  export declare class CapacitorJailbreakRootDetectionWeb extends WebPlugin implements CapacitorJailbreakRootDetectionPlugin {
4
4
  exitApp(): void;
5
5
  isJailbrokenOrRooted(): Promise<JailbreakRootResult>;
6
+ isFridaRunning(): Promise<JailbreakRootResult>;
6
7
  isSimulator(): Promise<JailbreakRootResult>;
7
8
  isDebuggedMode(): Promise<JailbreakRootResult>;
8
9
  }
package/dist/esm/web.js CHANGED
@@ -8,6 +8,11 @@ export class CapacitorJailbreakRootDetectionWeb extends WebPlugin {
8
8
  result: false,
9
9
  };
10
10
  }
11
+ async isFridaRunning() {
12
+ return {
13
+ result: false,
14
+ };
15
+ }
11
16
  async isSimulator() {
12
17
  return {
13
18
  result: false,
@@ -1 +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"]}
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,cAAc;QAClB,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 isFridaRunning(): 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"]}
@@ -17,6 +17,11 @@ class CapacitorJailbreakRootDetectionWeb extends core.WebPlugin {
17
17
  result: false,
18
18
  };
19
19
  }
20
+ async isFridaRunning() {
21
+ return {
22
+ result: false,
23
+ };
24
+ }
20
25
  async isSimulator() {
21
26
  return {
22
27
  result: false,
@@ -1 +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;;;;;;;;;"}
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 isFridaRunning() {\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,cAAc,GAAG;AAC3B,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 CHANGED
@@ -14,6 +14,11 @@ var capacitorCapacitorJailbreakRootDetection = (function (exports, core) {
14
14
  result: false,
15
15
  };
16
16
  }
17
+ async isFridaRunning() {
18
+ return {
19
+ result: false,
20
+ };
21
+ }
17
22
  async isSimulator() {
18
23
  return {
19
24
  result: false,
@@ -1 +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;;;;;;;;;;;;;;;;;"}
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 isFridaRunning() {\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,cAAc,GAAG;IAC3B,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;;;;;;;;;;;;;;;;;"}
@@ -5,6 +5,10 @@ import Foundation
5
5
  print(value)
6
6
  return value
7
7
  }
8
+ @objc public func isFridaRunning(_ value: String) -> String {
9
+ print(value)
10
+ return value
11
+ }
8
12
 
9
13
  @objc public func isSimulator(_ value: String) -> String {
10
14
  print(value)
@@ -6,6 +6,7 @@
6
6
  CAP_PLUGIN(CapacitorJailbreakRootDetectionPlugin, "CapacitorJailbreakRootDetection",
7
7
  CAP_PLUGIN_METHOD(isJailbrokenOrRooted, CAPPluginReturnPromise);
8
8
  CAP_PLUGIN_METHOD(isSimulator, CAPPluginReturnPromise);
9
+ CAP_PLUGIN_METHOD(isFridaRunning, CAPPluginReturnPromise);
9
10
  CAP_PLUGIN_METHOD(isDebuggedMode, CAPPluginReturnPromise);
10
11
  CAP_PLUGIN_METHOD(exitApp, CAPPluginReturnNone);
11
12
  )
@@ -16,6 +16,12 @@ public class CapacitorJailbreakRootDetectionPlugin: CAPPlugin {
16
16
  ])
17
17
  }
18
18
 
19
+ @objc func isFridaRunning(_ call: CAPPluginCall) {
20
+ call.resolve([
21
+ "result": UIDevice.current.isFridaRunning
22
+ ])
23
+ }
24
+
19
25
  @objc func isSimulator(_ call: CAPPluginCall) {
20
26
  call.resolve([
21
27
  "result": UIDevice.current.isSimulator
@@ -206,6 +206,32 @@ private struct JailBrokenHelper {
206
206
  ]
207
207
  }
208
208
 
209
+ static func isFridaRunning() -> Bool {
210
+ // func swapBytesIfNeeded(port: in_port_t) -> in_port_t {
211
+ // let littleEndian = Int(OSHostByteOrder()) == OSLittleEndian
212
+ // return littleEndian ? _OSSwapInt16(port) : port
213
+ // }
214
+
215
+ // var serverAddress = sockaddr_in()
216
+ // serverAddress.sin_family = sa_family_t(AF_INET)
217
+ // serverAddress.sin_addr.s_addr = inet_addr("127.0.0.1")
218
+ // serverAddress.sin_port = swapBytesIfNeeded(port: in_port_t(27042))
219
+ // let sock = socket(AF_INET, SOCK_STREAM, 0)
220
+
221
+ // let result = withUnsafePointer(to: &serverAddress) {
222
+ // $0.withMemoryRebound(to: sockaddr.self, capacity: 1) {
223
+ // connect(sock, $0, socklen_t(MemoryLayout<sockaddr_in>.stride))
224
+ // }
225
+ // }
226
+ // if result != -1 {
227
+ // return true
228
+ // }
229
+ let port = UInt16(27042);
230
+ if(isFridaPortOpen(port)) { return true; }
231
+ if(checkDYLD()) { return true; }
232
+ if(detectSuspiciousLibraries()) { return true; }
233
+ return false
234
+ }
209
235
  static func checkDYLD() -> Bool {
210
236
  let suspiciousLibraries = [
211
237
  "FridaGadget",
@@ -224,27 +250,50 @@ private struct JailBrokenHelper {
224
250
  }
225
251
  return false
226
252
  }
253
+ static func detectSuspiciousLibraries() -> Bool{
254
+
255
+ let libraries = ["FridaGadget",
256
+ "frida",
257
+ "cynject",
258
+ "libcycript", "MobileSubstrate", "SubstrateLoader", "SubstrateInserter"]
259
+ let imageCount = _dyld_image_count();
260
+ for i in 0..<imageCount{
261
+ let imgName = String(cString: _dyld_get_image_name(i));
262
+ for lib in libraries {
263
+ if imgName.lowercased().contains(lib.lowercased()){
264
+ return true
265
+ }
266
+ }
267
+ }
268
+ return false
269
+ }
227
270
 
228
- static func isFridaRunning() -> Bool {
229
- func swapBytesIfNeeded(port: in_port_t) -> in_port_t {
230
- let littleEndian = Int(OSHostByteOrder()) == OSLittleEndian
231
- return littleEndian ? _OSSwapInt16(port) : port
271
+
272
+ static func isFridaPortOpen(port: in_port_t) -> Bool {
273
+
274
+ let socketFileDescriptor = socket(AF_INET, SOCK_STREAM, 0)
275
+ if socketFileDescriptor == -1 {
276
+ return false
232
277
  }
233
-
234
- var serverAddress = sockaddr_in()
235
- serverAddress.sin_family = sa_family_t(AF_INET)
236
- serverAddress.sin_addr.s_addr = inet_addr("127.0.0.1")
237
- serverAddress.sin_port = swapBytesIfNeeded(port: in_port_t(27042))
238
- let sock = socket(AF_INET, SOCK_STREAM, 0)
239
-
240
- let result = withUnsafePointer(to: &serverAddress) {
241
- $0.withMemoryRebound(to: sockaddr.self, capacity: 1) {
242
- connect(sock, $0, socklen_t(MemoryLayout<sockaddr_in>.stride))
243
- }
278
+
279
+ var addr = sockaddr_in()
280
+ let sizeOfSockkAddr = MemoryLayout<sockaddr_in>.size
281
+ addr.sin_len = __uint8_t(sizeOfSockkAddr)
282
+ addr.sin_family = sa_family_t(AF_INET)
283
+ addr.sin_port = Int(OSHostByteOrder()) == OSLittleEndian ? _OSSwapInt16(port) : port
284
+ addr.sin_addr = in_addr(s_addr: inet_addr("127.0.0.1"))
285
+ addr.sin_zero = (0, 0, 0, 0, 0, 0, 0, 0)
286
+ var bind_addr = sockaddr()
287
+ memcpy(&bind_addr, &addr, Int(sizeOfSockkAddr))
288
+
289
+ if Darwin.bind(socketFileDescriptor, &bind_addr, socklen_t(sizeOfSockkAddr)) == -1 {
290
+ return true
244
291
  }
245
- if result != -1 {
292
+ if listen(socketFileDescriptor, SOMAXCONN ) == -1 {
246
293
  return true
247
294
  }
248
295
  return false
249
296
  }
297
+
298
+
250
299
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aalzehla/capacitor-jailbreak-root-detection",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Jailbreak Root detection plugin for capacitor.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",