com.cprot.ead 1.0.8151 → 1.0.8272

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.
@@ -87,5 +87,5 @@ project.afterEvaluate {
87
87
  dependencies {
88
88
  implementation("com.facebook.react:react-native:+")
89
89
  implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.24")
90
- implementation("com.cprot:ead:1.0.8151")
90
+ implementation("com.cprot:ead:1.0.8272")
91
91
  }
@@ -43,28 +43,27 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
43
43
  }
44
44
 
45
45
  @ReactMethod
46
- fun setupModule(url: String, key: String) {
47
- if (reactApplicationContext.currentActivity != null) {
48
- setupCProtEadModule(url,key)
49
- } else {
50
- Log.d(NAME,"Activity is not available. CProtEadModule setup will proceed once Activity is available.")
51
- }
52
- }
53
-
54
- private fun setupCProtEadModule(url: String, key: String) {
46
+ fun setupModule(url: String, key: String) {
55
47
  try {
56
48
  if (module == null) {
57
- // Setup işlemi yapılır
58
49
  HttpsHelper.trustEveryone()
59
50
  val deepblackInfo = DeepblackInfo(url, key).apply {
60
51
  activateAntiDebug(false)
61
52
  setLanguage(Language.Turkish)
62
53
  enableGzip(false)
63
54
  }
55
+
64
56
  module = CProtEadModule.getInstance(reactApplicationContext, deepblackInfo)
57
+ module?.let {
58
+ it.addEvent(this)
59
+ reactApplicationContext.currentActivity?.let { act ->
60
+ it.setCurrentActivity(act)
61
+ }
62
+ }
63
+ Log.d(NAME, "CProtEadModule başarıyla init edildi.")
65
64
  }
66
65
  } catch (e: Exception) {
67
- e.printStackTrace()
66
+ Log.e(NAME, "Setup hatası: ${e.message}")
68
67
  }
69
68
  }
70
69
 
@@ -116,6 +115,8 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
116
115
  CoroutineScope(Dispatchers.Main).launch {
117
116
  it.setScreenModule(currentActivity, value)
118
117
  }
118
+ } else {
119
+ it.setScreenModule(value)
119
120
  }
120
121
  }
121
122
  }
@@ -132,6 +133,13 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
132
133
  }
133
134
  }
134
135
 
136
+ @ReactMethod
137
+ fun setCallForwardActive(value: Boolean) {
138
+ module?.let {
139
+ it.setCallForwardActive(value)
140
+ }
141
+ }
142
+
135
143
  @ReactMethod
136
144
  fun setUserId(userId: String) {
137
145
  module?.let {
@@ -139,6 +147,13 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
139
147
  }
140
148
  }
141
149
 
150
+ @ReactMethod
151
+ fun setCorpUserId(corpUserId: String) {
152
+ module?.let {
153
+ it.setCorpUserId(corpUserId)
154
+ }
155
+ }
156
+
142
157
  @ReactMethod
143
158
  fun setNoHistoryOnThreatDetection(value: Boolean) {
144
159
  module?.let {
@@ -300,6 +315,120 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
300
315
  }
301
316
  }
302
317
 
318
+ @ReactMethod
319
+ fun getCurrentCallState(promise: Promise) {
320
+ try {
321
+ val value = module?.getCurrentCallState() ?: ""
322
+ promise.resolve(value)
323
+ } catch (e: Exception) {
324
+ promise.resolve("")
325
+ }
326
+ }
327
+
328
+ @ReactMethod
329
+ fun getIsCurrentCallSuspicious(promise: Promise) {
330
+ try {
331
+ val value = module?.getIsCurrentCallSuspicious() ?: false
332
+ promise.resolve(value)
333
+ } catch (e: Exception) {
334
+ promise.resolve(false)
335
+ }
336
+ }
337
+
338
+ @ReactMethod
339
+ fun getIsCurrentCallSafe(promise: Promise) {
340
+ try {
341
+ val value = module?.getIsCurrentCallSafe() ?: false
342
+ promise.resolve(value)
343
+ } catch (e: Exception) {
344
+ promise.resolve(false)
345
+ }
346
+ }
347
+
348
+ @ReactMethod
349
+ fun getClonedApps(promise: Promise) {
350
+ try {
351
+ val apps = module?.getClonedApps()
352
+ if (apps.isNullOrEmpty()) {
353
+ promise.resolve("[]")
354
+ return
355
+ }
356
+
357
+ val sb = StringBuilder()
358
+ sb.append("[")
359
+ for ((index, app) in apps.withIndex()) {
360
+ sb.append("{")
361
+ sb.append("\"packageName\":\"").append(app.getPackageName() ?: "").append("\",")
362
+ sb.append("\"name\":\"").append(app.getName() ?: "").append("\"")
363
+ sb.append("}")
364
+ if (index < apps.size - 1) {
365
+ sb.append(",")
366
+ }
367
+ }
368
+
369
+ sb.append("]")
370
+ promise.resolve(sb.toString())
371
+ } catch (e: Exception) {
372
+ e.printStackTrace()
373
+ promise.resolve("[]")
374
+ }
375
+ }
376
+
377
+ @ReactMethod
378
+ fun getOverlayedApps(promise: Promise) {
379
+ try {
380
+ val apps = module?.getOverlayedApps()
381
+ if (apps.isNullOrEmpty()) {
382
+ promise.resolve("[]")
383
+ return
384
+ }
385
+
386
+ val sb = StringBuilder()
387
+ sb.append("[")
388
+ for ((index, app) in apps.withIndex()) {
389
+ sb.append("{")
390
+ sb.append("\"packageName\":\"").append(app.getPackageName() ?: "").append("\",")
391
+ sb.append("\"name\":\"").append(app.getName() ?: "").append("\"")
392
+ sb.append("}")
393
+ if (index < apps.size - 1) {
394
+ sb.append(",")
395
+ }
396
+ }
397
+
398
+ sb.append("]")
399
+ promise.resolve(sb.toString())
400
+ } catch (e: Exception) {
401
+ e.printStackTrace()
402
+ promise.resolve("[]")
403
+ }
404
+ }
405
+
406
+ @ReactMethod
407
+ fun getScreenReaderApps(promise: Promise) {
408
+ try {
409
+ val apps = module?.getScreenReaderApps()
410
+ if (apps.isNullOrEmpty()) {
411
+ promise.resolve("[]")
412
+ return
413
+ }
414
+
415
+ val sb = StringBuilder()
416
+ sb.append("[")
417
+ for ((index, appPackageName) in apps.withIndex()) {
418
+ sb.append("\"").append(appPackageName ?: "").append("\"")
419
+ if (index < apps.size - 1) {
420
+ sb.append(",")
421
+ }
422
+ }
423
+
424
+ sb.append("]")
425
+ promise.resolve(sb.toString())
426
+ } catch (e: Exception) {
427
+ e.printStackTrace()
428
+ promise.resolve("[]")
429
+ }
430
+ }
431
+
303
432
  @ReactMethod
304
433
  fun getIntCurrentCallStatus(promise: Promise) {
305
434
  try {
@@ -328,6 +457,7 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
328
457
  try {
329
458
  val securityCheck = module?.getSecurityFeatureChecks()
330
459
  if (securityCheck != null) {
460
+ val factoryResetTime = securityCheck.getFactoryResetTime()?.toString()
331
461
  val sb = StringBuilder()
332
462
  sb.append("{")
333
463
  sb.append("\"isMalwareDetected\":").append(securityCheck.isMalwareDetected()).append(",")
@@ -341,7 +471,7 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
341
471
  sb.append("\"isScreenReaderAppsDetected\":").append(securityCheck.isScreenReaderAppsDetected()).append(",")
342
472
  sb.append("\"isOverlayedAppsDetected\":").append(securityCheck.isOverlayedAppsDetected()).append(",")
343
473
  sb.append("\"isDevModeEnabled\":").append(securityCheck.isDevModeEnabled()).append(",")
344
- sb.append("\"factoryResetTime\":").append(securityCheck.getFactoryResetTime() ?: "null").append(",")
474
+ sb.append("\"factoryResetTime\":").append(factoryResetTime?.let { "\"$it\"" } ?: "null").append(",")
345
475
  sb.append("\"isVpnActive\":").append(securityCheck.getIsVpnActive()).append(",")
346
476
  sb.append("\"isDefaultSmsAppChanged\":").append(securityCheck.isDefaultSmsAppChanged()).append(",")
347
477
  sb.append("\"isSimChanged\":").append(securityCheck.isSimChanged()).append(",")
@@ -396,6 +526,20 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
396
526
  }
397
527
  }
398
528
 
529
+ @ReactMethod
530
+ fun getLastCallContactInfo(promise: Promise) {
531
+ try {
532
+ val value = module?.getLastCallContactInfo()?.getDisplayName() ?: ""
533
+ promise.resolve(value)
534
+ } catch (e: Exception) {
535
+ promise.reject(
536
+ "GET_LAST_CALL_CONTACT_INFO_ERROR",
537
+ "Failed to get last call contact info",
538
+ e
539
+ )
540
+ }
541
+ }
542
+
399
543
  @ReactMethod
400
544
  fun getInfectedApps(promise: Promise) {
401
545
  try {
@@ -529,20 +673,24 @@ override fun onThreatDetected(infectedApps: ArrayList<InfectedApp>) {
529
673
  }
530
674
  }
531
675
 
532
- override fun onIncomingCall(state: Int, phoneNumber: String?, incomingNumber: IncomingNumber?) {
533
- var callType = "Idle"
534
- when (state) {
535
- TelephonyManager.CALL_STATE_IDLE -> {}
536
- TelephonyManager.CALL_STATE_RINGING -> callType = "Ringing"
537
- TelephonyManager.CALL_STATE_OFFHOOK -> callType = "off hook"
538
- }
539
-
676
+ override fun onIncomingCall(state: Int, phoneNumber: String?, incomingNumber: IncomingNumber?, currentCallStatus: String?) {
540
677
  var isSpam = false
678
+ var callContactInfo = ""
541
679
  if (incomingNumber != null) {
542
680
  isSpam = incomingNumber.isSpam
681
+ callContactInfo = incomingNumber.callContactInfo?.displayName ?: ""
543
682
  }
544
683
 
545
- sendLogEvent("Incoming Call detected: $phoneNumber -> Is Spam: $isSpam")
684
+ val sb = StringBuilder()
685
+ sb.append("{")
686
+ sb.append("\"event\":\"Incoming Call\",")
687
+ sb.append("\"phoneNumber\":\"").append(phoneNumber ?: "").append("\",")
688
+ sb.append("\"isSpam\":").append(isSpam).append(",")
689
+ sb.append("\"currentCallStatus\":\"").append(currentCallStatus ?: "").append("\",")
690
+ sb.append("\"state\":").append(state).append(",")
691
+ sb.append("\"callContactInfo\":\"").append(callContactInfo).append("\"")
692
+ sb.append("}")
693
+ sendLogEvent(sb.toString())
546
694
  }
547
695
 
548
696
  override fun onOutgoingCall(state: Int, phoneNumber: String) {
@@ -553,7 +701,14 @@ override fun onThreatDetected(infectedApps: ArrayList<InfectedApp>) {
553
701
  else -> "Unknown"
554
702
  }
555
703
 
556
- sendLogEvent("<b>Outgoing Call detected:</b> $callType - $phoneNumber")
704
+ val sb = StringBuilder()
705
+ sb.append("{")
706
+ sb.append("\"event\":\"Outgoing Call\",")
707
+ sb.append("\"callType\":\"").append(callType).append("\",")
708
+ sb.append("\"phoneNumber\":\"").append(phoneNumber).append("\",")
709
+ sb.append("\"state\":").append(state)
710
+ sb.append("}")
711
+ sendLogEvent(sb.toString())
557
712
  }
558
713
 
559
714
  override fun onCertificatePinningFailure(message: String) {
@@ -597,4 +752,12 @@ override fun onThreatDetected(infectedApps: ArrayList<InfectedApp>) {
597
752
  override fun onScanCompleted() {
598
753
  sendLogEvent("Scan Completed")
599
754
  }
755
+
756
+ override fun onInitializeCompleted() {
757
+ sendLogEvent("Initialize Completed")
758
+ }
759
+
760
+ override fun onVirtualTouchDetected() {
761
+ sendLogEvent("Virtual Touch Detected")
762
+ }
600
763
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.cprot.ead",
3
- "version": "1.0.8151",
3
+ "version": "1.0.8272",
4
4
  "description": "c-prot ead android module",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "lib/commonjs/index.js",