com.cprot.ead 1.0.5518
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 +1 -0
- package/android/build.gradle +91 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/AndroidManifestNew.xml +6 -0
- package/android/src/main/java/com/cproteadmodule/CProtEadModuleModule.kt +407 -0
- package/android/src/main/java/com/cproteadmodule/CProtEadModulePackage.kt +17 -0
- package/android/src/main/java/com/cproteadmodule/ConstHelper.kt +7 -0
- package/android/src/main/java/com/cproteadmodule/UninstallHandler.kt +43 -0
- package/lib/commonjs/index.js +20 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/index.js +16 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/index.d.ts +3 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +179 -0
- package/src/index.tsx +21 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 mustafa.kaya
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# C-Prot EAD Android Modülü
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
dependencies {
|
|
8
|
+
classpath "com.android.tools.build:gradle:8.0.2"
|
|
9
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
def reactNativeArchitectures() {
|
|
14
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
15
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def isNewArchitectureEnabled() {
|
|
19
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
apply plugin: "com.android.library"
|
|
23
|
+
apply plugin: "kotlin-android"
|
|
24
|
+
|
|
25
|
+
if (isNewArchitectureEnabled()) {
|
|
26
|
+
apply plugin: "com.facebook.react"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
def getExtOrDefault(name) {
|
|
30
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["CProtEadModule_" + name]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def getExtOrIntegerDefault(name) {
|
|
34
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["CProtEadModule_" + name]).toInteger()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
def supportsNamespace() {
|
|
38
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
39
|
+
def major = parsed[0].toInteger()
|
|
40
|
+
def minor = parsed[1].toInteger()
|
|
41
|
+
|
|
42
|
+
// Namespace support was added in 7.3.0
|
|
43
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
android {
|
|
47
|
+
if (supportsNamespace()) {
|
|
48
|
+
namespace "com.cproteadmodule"
|
|
49
|
+
|
|
50
|
+
sourceSets {
|
|
51
|
+
main {
|
|
52
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
58
|
+
|
|
59
|
+
defaultConfig {
|
|
60
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
61
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
buildTypes {
|
|
66
|
+
release {
|
|
67
|
+
minifyEnabled false
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
lintOptions {
|
|
72
|
+
disable "GradleCompatible"
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
compileOptions {
|
|
76
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
77
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
project.afterEvaluate {
|
|
82
|
+
if (project.parent != null && project.parent.repositories != null) {
|
|
83
|
+
repositories.addAll(project.parent.repositories)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
dependencies {
|
|
88
|
+
implementation("com.facebook.react:react-native:+")
|
|
89
|
+
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.24")
|
|
90
|
+
implementation("com.cprot:ead:1.0.5517")
|
|
91
|
+
}
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
package com.cproteadmodule
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
5
|
+
import com.facebook.react.bridge.ReactMethod
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
|
|
8
|
+
import com.cprot.ead.CProtEadModule
|
|
9
|
+
import com.cprot.ead.helpers.HttpsHelper
|
|
10
|
+
import com.cprot.ead.helpers.ConstantHelper
|
|
11
|
+
import com.cprot.ead.models.DeepblackInfo
|
|
12
|
+
import com.cprot.ead.models.ICProtEvent
|
|
13
|
+
import com.cprot.ead.models.IncomingNumber
|
|
14
|
+
import com.cprot.ead.models.InfectedApp
|
|
15
|
+
import com.cprot.ead.models.Language
|
|
16
|
+
import com.cprot.ead.models.OverlayApp
|
|
17
|
+
import android.telephony.TelephonyManager
|
|
18
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
19
|
+
import java.util.ArrayList
|
|
20
|
+
import android.os.Environment
|
|
21
|
+
import android.provider.Settings
|
|
22
|
+
import com.cproteadmodule.UninstallHandler
|
|
23
|
+
import com.cprot.ead.models.SecurityFeatureCheck
|
|
24
|
+
import com.cprot.ead.models.UpdateStatus
|
|
25
|
+
|
|
26
|
+
import android.os.Build
|
|
27
|
+
import android.util.Log
|
|
28
|
+
import androidx.core.app.ActivityCompat
|
|
29
|
+
import androidx.core.content.ContextCompat
|
|
30
|
+
import java.util.Date
|
|
31
|
+
import java.text.SimpleDateFormat
|
|
32
|
+
import java.util.Locale
|
|
33
|
+
|
|
34
|
+
import kotlinx.coroutines.CoroutineScope
|
|
35
|
+
import kotlinx.coroutines.Dispatchers
|
|
36
|
+
import kotlinx.coroutines.launch
|
|
37
|
+
|
|
38
|
+
class CProtEadModuleModule(reactContext: ReactApplicationContext) :
|
|
39
|
+
ReactContextBaseJavaModule(reactContext), ICProtEvent {
|
|
40
|
+
|
|
41
|
+
private var module: CProtEadModule? = null
|
|
42
|
+
|
|
43
|
+
override fun getName(): String {
|
|
44
|
+
return NAME
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
companion object {
|
|
48
|
+
const val NAME = "CProtEadModule"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@ReactMethod
|
|
52
|
+
fun setupModule(url: String, key: String) {
|
|
53
|
+
if (reactApplicationContext.currentActivity != null) {
|
|
54
|
+
setupCProtEadModule(url,key)
|
|
55
|
+
} else {
|
|
56
|
+
Log.d(NAME,"Activity is not available. CProtEadModule setup will proceed once Activity is available.")
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private fun setupCProtEadModule(url: String, key: String) {
|
|
61
|
+
try {
|
|
62
|
+
if (module == null) {
|
|
63
|
+
// Setup işlemi yapılır
|
|
64
|
+
HttpsHelper.trustEveryone()
|
|
65
|
+
val deepblackInfo = DeepblackInfo(url, key).apply {
|
|
66
|
+
activateAntiDebug(false)
|
|
67
|
+
setLanguage(Language.Turkish)
|
|
68
|
+
enableGzip(false)
|
|
69
|
+
}
|
|
70
|
+
module = CProtEadModule.getInstance(reactApplicationContext, deepblackInfo)
|
|
71
|
+
}
|
|
72
|
+
} catch (e: Exception) {
|
|
73
|
+
e.printStackTrace()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@ReactMethod
|
|
79
|
+
fun handleIncomingCallWithBaseApp(value : Boolean) {
|
|
80
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
81
|
+
module?.let {
|
|
82
|
+
if(currentActivity != null) {
|
|
83
|
+
it.handleIncomingCallWithBaseApp(value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@ReactMethod
|
|
89
|
+
fun setIncomingCallEnabled(value : Boolean) {
|
|
90
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
91
|
+
module?.let {
|
|
92
|
+
if(currentActivity != null) {
|
|
93
|
+
it.setIncomingCallEnabled(value);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@ReactMethod
|
|
99
|
+
fun addEvent() {
|
|
100
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
101
|
+
module?.let {
|
|
102
|
+
if (currentActivity != null) {
|
|
103
|
+
it.addEvent(this)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@ReactMethod
|
|
109
|
+
fun setScreenModule(value: Boolean) {
|
|
110
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
111
|
+
module?.let {
|
|
112
|
+
if (currentActivity != null) {
|
|
113
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
114
|
+
it.setScreenModule(currentActivity, value)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@ReactMethod
|
|
121
|
+
fun setUserId(userId: String) {
|
|
122
|
+
module?.let {
|
|
123
|
+
it.setUserId(userId)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@ReactMethod
|
|
128
|
+
fun setNoHistoryOnThreatDetection(value: Boolean) {
|
|
129
|
+
module?.let {
|
|
130
|
+
it.setNoHistoryOnThreatDetection(value)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@ReactMethod
|
|
135
|
+
fun showThreatDetectionScreenWithoutPermission(value: Boolean) {
|
|
136
|
+
module?.let {
|
|
137
|
+
it.showThreatDetectionScreenWithoutPermission(value)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@ReactMethod
|
|
142
|
+
fun startConnection() {
|
|
143
|
+
module?.let {
|
|
144
|
+
it.startConnection()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@ReactMethod
|
|
149
|
+
fun startRealtime() {
|
|
150
|
+
module?.let {
|
|
151
|
+
it.startRealtime()
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@ReactMethod
|
|
156
|
+
fun enableDeviceProtection(value: Boolean) {
|
|
157
|
+
module?.let {
|
|
158
|
+
it.enableDeviceProtection(value)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@ReactMethod
|
|
163
|
+
fun setLanguage(languageCode: Int) {
|
|
164
|
+
module?.let {
|
|
165
|
+
it.setLanguage(languageCode)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@ReactMethod
|
|
170
|
+
fun stopRealtime() {
|
|
171
|
+
module?.let {
|
|
172
|
+
it.stopRealtime()
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
@ReactMethod
|
|
176
|
+
fun isDeviceProtectionEnabled(): Boolean {
|
|
177
|
+
return module?.let {
|
|
178
|
+
it.isDeviceProtectionEnabled()
|
|
179
|
+
} ?: false
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@ReactMethod
|
|
183
|
+
fun reInitRegister() {
|
|
184
|
+
module?.let {
|
|
185
|
+
it.reInitRegister()
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@ReactMethod
|
|
190
|
+
fun getSslCertHash(): String? {
|
|
191
|
+
return module?.let {
|
|
192
|
+
it.getSslCertHash()
|
|
193
|
+
} ?: ""
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@ReactMethod
|
|
197
|
+
fun getDeviceFingerprint(): String? {
|
|
198
|
+
return module?.let {
|
|
199
|
+
it.getDeviceFingerprint()
|
|
200
|
+
} ?: ""
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@ReactMethod
|
|
204
|
+
fun isRunInEmulator(): Boolean {
|
|
205
|
+
return module?.let {
|
|
206
|
+
it.isRunInEmulator()
|
|
207
|
+
} ?: false
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@ReactMethod
|
|
211
|
+
fun isRootedDevice(): Boolean {
|
|
212
|
+
return module?.let {
|
|
213
|
+
it.isRootedDevice()
|
|
214
|
+
} ?: false
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@ReactMethod
|
|
218
|
+
fun isFingerprintChanged(): Boolean {
|
|
219
|
+
return module?.let {
|
|
220
|
+
it.isFingerprintChanged()
|
|
221
|
+
} ?: false
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@ReactMethod
|
|
225
|
+
fun getSignatures(): ArrayList<String>? {
|
|
226
|
+
return module?.let {
|
|
227
|
+
try {
|
|
228
|
+
ArrayList(it.getSignatures(reactApplicationContext).toList())
|
|
229
|
+
} catch (e: Exception) {
|
|
230
|
+
e.printStackTrace()
|
|
231
|
+
null
|
|
232
|
+
}
|
|
233
|
+
} ?: ArrayList()
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@ReactMethod
|
|
237
|
+
fun getDexCRC(): Long {
|
|
238
|
+
return module?.let {
|
|
239
|
+
try {
|
|
240
|
+
it.getDexCRC(reactApplicationContext)
|
|
241
|
+
} catch (e: Exception) {
|
|
242
|
+
e.printStackTrace()
|
|
243
|
+
-1L // Hata durumunda -1 döndürülür
|
|
244
|
+
}
|
|
245
|
+
} ?: -1L // Module null ise -1 döndürülür
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@ReactMethod
|
|
249
|
+
fun getSecurityFeatureChecks(): SecurityFeatureCheck? {
|
|
250
|
+
return module?.let {
|
|
251
|
+
it.getSecurityFeatureChecks()
|
|
252
|
+
} ?: null // Module null ise null döndürülür
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@ReactMethod
|
|
256
|
+
fun getLastScanTime(): String? {
|
|
257
|
+
return module?.let {
|
|
258
|
+
val lastScanTime: Date = it.getLastScanTime()
|
|
259
|
+
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
|
260
|
+
dateFormat.format(lastScanTime) // Tarihi String formatına çevirir
|
|
261
|
+
} ?: "" // Module null ise boş string döndürülür
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
@ReactMethod
|
|
265
|
+
fun getUpdateStatus(): UpdateStatus? {
|
|
266
|
+
return module?.let {
|
|
267
|
+
it.getUpdateStatus()
|
|
268
|
+
} ?: null // Module null ise null döndürülür
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
//Send log message when ovveride functions worked.
|
|
273
|
+
private fun sendLogEvent(message: String) {
|
|
274
|
+
try {
|
|
275
|
+
if (reactApplicationContext.hasActiveCatalystInstance()) {
|
|
276
|
+
reactApplicationContext
|
|
277
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
278
|
+
.emit("LogEvent", message)
|
|
279
|
+
Log.d(NAME, "Log sent: $message")
|
|
280
|
+
}
|
|
281
|
+
} catch (e: Exception) {
|
|
282
|
+
Log.e(NAME, "Error sending log: ${e.message}")
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
//Override functions
|
|
287
|
+
override fun onRegisterSuccess() {
|
|
288
|
+
sendLogEvent("Register success")
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
override fun onRegisterFailure(message: String) {
|
|
292
|
+
sendLogEvent("Register fail: $message")
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
override fun onRunningInEmulator(value: Boolean) {
|
|
296
|
+
sendLogEvent("Run in emulator: $value")
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
override fun onIntegrityCheck(b: Boolean) {
|
|
300
|
+
sendLogEvent("Integrity check success: $b")
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
override fun onRootedDeviceDetected(value: Boolean) {
|
|
304
|
+
sendLogEvent("Rooted device detected: $value")
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
override fun onThreatDetected(infectedApps: ArrayList<InfectedApp>) {
|
|
308
|
+
sendLogEvent("Threat detected: $infectedApps")
|
|
309
|
+
|
|
310
|
+
if (ConstHelper.DetectedThreats == null) {
|
|
311
|
+
ConstHelper.DetectedThreats = ArrayList<String>()
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
for (infectedApp in infectedApps) {
|
|
315
|
+
if (ConstHelper.DetectedThreats.contains(infectedApp.getPackageName())) {
|
|
316
|
+
continue
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (infectedApp.getPackageName() != null) {
|
|
320
|
+
sendLogEvent(
|
|
321
|
+
"Threat detected: ${infectedApp.getPackageName()} - ${infectedApp.getThreatName()}")
|
|
322
|
+
//Uninstall when app infected
|
|
323
|
+
val uninstallHandler = UninstallHandler(
|
|
324
|
+
getCurrentActivity() ?: reactApplicationContext,
|
|
325
|
+
infectedApp.getName(),
|
|
326
|
+
infectedApp.getPackageName(),
|
|
327
|
+
infectedApp.getVersion(),
|
|
328
|
+
infectedApp.getThreatName()
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
332
|
+
try {
|
|
333
|
+
uninstallHandler.showDialog()
|
|
334
|
+
sendLogEvent("Uninstall dialog shown for ${infectedApp.getPackageName()}")
|
|
335
|
+
} catch (e: Exception) {
|
|
336
|
+
sendLogEvent("Error showing uninstall dialog: ${e.message}")
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
} else {
|
|
341
|
+
sendLogEvent(
|
|
342
|
+
"Threat detected: ${infectedApp.getName()} - ${infectedApp.getThreatName()}")
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
override fun onIncomingCall(state: Int, phoneNumber: String?, incomingNumber: IncomingNumber?) {
|
|
350
|
+
var callType = "Idle"
|
|
351
|
+
when (state) {
|
|
352
|
+
TelephonyManager.CALL_STATE_IDLE -> {}
|
|
353
|
+
TelephonyManager.CALL_STATE_RINGING -> callType = "Ringing"
|
|
354
|
+
TelephonyManager.CALL_STATE_OFFHOOK -> callType = "off hook"
|
|
355
|
+
}
|
|
356
|
+
var isSpam = false
|
|
357
|
+
if (incomingNumber != null) {
|
|
358
|
+
isSpam = incomingNumber.isSpam
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
sendLogEvent("Incoming Call detected: $phoneNumber -> Is Spam: $isSpam")
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
override fun onOutgoingCall(state: Int, phoneNumber: String) {
|
|
365
|
+
val callType = when (state) {
|
|
366
|
+
TelephonyManager.CALL_STATE_IDLE -> "Idle"
|
|
367
|
+
TelephonyManager.CALL_STATE_RINGING -> "Ringing"
|
|
368
|
+
TelephonyManager.CALL_STATE_OFFHOOK -> "Off hook"
|
|
369
|
+
else -> "Unknown"
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
sendLogEvent("<b>Outgoing Call detected:</b> $callType - $phoneNumber")
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
override fun onCertificatePinningFailure(message: String) {
|
|
376
|
+
sendLogEvent("Certificate Pinning fail:: $message")
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
override fun onDeviceFingerprintChanged(value: Boolean, deviceFingerprint: String) {
|
|
380
|
+
sendLogEvent("is fingerprint changed: $value $deviceFingerprint")
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
override fun onOverlayAppDetected(overlayApps: ArrayList<OverlayApp>) {
|
|
384
|
+
for (item in overlayApps) {
|
|
385
|
+
sendLogEvent("Overlayed app detected: ${item.getName()} ${item.getPackageName()}")
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
override fun onScreenShotDetected() {
|
|
390
|
+
sendLogEvent("Screenshot detected")
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
override fun onDebuggerDetected(value: Boolean) {
|
|
394
|
+
sendLogEvent("Debugger detected: $value")
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
override fun onScreenReaderAppsDetected(readerApps: ArrayList<String>) {
|
|
398
|
+
for (item in readerApps) {
|
|
399
|
+
sendLogEvent("Screen reader app detected: $item")
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
override fun onAppUninstalled(s: String) {
|
|
404
|
+
sendLogEvent("Application uninstall detected: $s")
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.cproteadmodule
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CProtEadModulePackage : ReactPackage {
|
|
10
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
11
|
+
return listOf(CProtEadModuleModule(reactContext))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
15
|
+
return emptyList()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
package com.cproteadmodule
|
|
2
|
+
|
|
3
|
+
import android.app.AlertDialog
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.content.Intent
|
|
6
|
+
import com.cprot.ead.helpers.StringHelper
|
|
7
|
+
import java.io.File
|
|
8
|
+
|
|
9
|
+
class UninstallHandler(
|
|
10
|
+
private val context: Context,
|
|
11
|
+
private val installedAppName: String? = "",
|
|
12
|
+
private val installedAppPackageName: String? = "",
|
|
13
|
+
private val installedAppVersion: String? = "",
|
|
14
|
+
private val threatName: String? = ""
|
|
15
|
+
) {
|
|
16
|
+
|
|
17
|
+
fun showDialog() {
|
|
18
|
+
val packageName = installedAppPackageName ?: return
|
|
19
|
+
|
|
20
|
+
val dialog = AlertDialog.Builder(context)
|
|
21
|
+
.setTitle("Uninstall App")
|
|
22
|
+
.setMessage("App Name: $installedAppName\nThreat Name: $threatName")
|
|
23
|
+
.setPositiveButton("Uninstall") { dialog, _ ->
|
|
24
|
+
removeFromList()
|
|
25
|
+
val intent = Intent(Intent.ACTION_DELETE)
|
|
26
|
+
intent.data = android.net.Uri.parse("package:$packageName")
|
|
27
|
+
context.startActivity(intent)
|
|
28
|
+
dialog.dismiss()
|
|
29
|
+
}
|
|
30
|
+
.setNegativeButton("Cancel") { dialog, _ ->
|
|
31
|
+
dialog.dismiss()
|
|
32
|
+
}
|
|
33
|
+
.create()
|
|
34
|
+
dialog.show()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private fun removeFromList() {
|
|
38
|
+
val packageName = installedAppPackageName ?: return
|
|
39
|
+
ConstHelper.DetectedThreats?.let { threats ->
|
|
40
|
+
threats.removeAll { it.equals(packageName, ignoreCase = true) }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const LINKING_ERROR = `The package 'c-prot-ead-module' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
9
|
+
ios: "- You have run 'pod install'\n",
|
|
10
|
+
default: ''
|
|
11
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
12
|
+
const CProtEadModule = _reactNative.NativeModules.CProtEadModule ? _reactNative.NativeModules.CProtEadModule : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Export the module directly
|
|
19
|
+
var _default = exports.default = CProtEadModule;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","CProtEadModule","NativeModules","Proxy","get","Error","_default","exports"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,4EAA4E,GAC5EC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,cAAc,GAAGC,0BAAa,CAACD,cAAc,GAC/CC,0BAAa,CAACD,cAAc,GAC5B,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;;AAEL;AAAA,IAAAU,QAAA,GAAAC,OAAA,CAAAP,OAAA,GACeC,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules, Platform } from 'react-native';
|
|
4
|
+
const LINKING_ERROR = `The package 'c-prot-ead-module' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
|
+
ios: "- You have run 'pod install'\n",
|
|
6
|
+
default: ''
|
|
7
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
+
const CProtEadModule = NativeModules.CProtEadModule ? NativeModules.CProtEadModule : new Proxy({}, {
|
|
9
|
+
get() {
|
|
10
|
+
throw new Error(LINKING_ERROR);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Export the module directly
|
|
15
|
+
export default CProtEadModule;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","CProtEadModule","Proxy","get","Error"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,4EAA4E,GAC5ED,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,cAAc,GAAGN,aAAa,CAACM,cAAc,GAC/CN,aAAa,CAACM,cAAc,GAC5B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;;AAEL;AACA,eAAeI,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,cAAc,KASf,CAAC;AAGN,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,cAAc,KASf,CAAC;AAGN,eAAe,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "com.cprot.ead",
|
|
3
|
+
"version": "1.0.5518",
|
|
4
|
+
"description": "c-prot ead android module",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"lib",
|
|
23
|
+
"android",
|
|
24
|
+
"!ios/build",
|
|
25
|
+
"!android/build",
|
|
26
|
+
"!android/gradle",
|
|
27
|
+
"!android/gradlew",
|
|
28
|
+
"!android/gradlew.bat",
|
|
29
|
+
"!android/local.properties",
|
|
30
|
+
"!**/__tests__",
|
|
31
|
+
"!**/__fixtures__",
|
|
32
|
+
"!**/__mocks__",
|
|
33
|
+
"!**/.*"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"example": "yarn workspace c-prot-ead-module-example",
|
|
37
|
+
"test": "jest",
|
|
38
|
+
"typecheck": "tsc",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
41
|
+
"prepare": "bob build",
|
|
42
|
+
"release": "release-it"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"react-native",
|
|
46
|
+
"android"
|
|
47
|
+
],
|
|
48
|
+
"author": "C-Prot",
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://www.npmjs.com/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://www.npmjs.com#readme",
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"registry": "https://registry.npmjs.org/"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
59
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
60
|
+
"@react-native/eslint-config": "0.74.0",
|
|
61
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
62
|
+
"@types/jest": "^29.5.5",
|
|
63
|
+
"@types/react": "^18.2.6",
|
|
64
|
+
"commitlint": "^17.0.2",
|
|
65
|
+
"del-cli": "^5.1.0",
|
|
66
|
+
"eslint": "^8.51.0",
|
|
67
|
+
"eslint-config-prettier": "^9.0.0",
|
|
68
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
69
|
+
"jest": "^29.7.0",
|
|
70
|
+
"prettier": "^3.0.3",
|
|
71
|
+
"react": "18.2.0",
|
|
72
|
+
"react-native": "0.74.5",
|
|
73
|
+
"react-native-builder-bob": "^0.30.0",
|
|
74
|
+
"release-it": "^15.0.0",
|
|
75
|
+
"turbo": "^1.10.7",
|
|
76
|
+
"typescript": "^5.2.2"
|
|
77
|
+
},
|
|
78
|
+
"resolutions": {
|
|
79
|
+
"@types/react": "^18.2.44"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"react": "*",
|
|
83
|
+
"react-native": "*"
|
|
84
|
+
},
|
|
85
|
+
"workspaces": [
|
|
86
|
+
"example"
|
|
87
|
+
],
|
|
88
|
+
"packageManager": "yarn@3.6.1",
|
|
89
|
+
"jest": {
|
|
90
|
+
"preset": "react-native",
|
|
91
|
+
"modulePathIgnorePatterns": [
|
|
92
|
+
"<rootDir>/example/node_modules",
|
|
93
|
+
"<rootDir>/lib/"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"commitlint": {
|
|
97
|
+
"extends": [
|
|
98
|
+
"@commitlint/config-conventional"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"release-it": {
|
|
102
|
+
"git": {
|
|
103
|
+
"commitMessage": "chore: release ${version}",
|
|
104
|
+
"tagName": "v${version}"
|
|
105
|
+
},
|
|
106
|
+
"npm": {
|
|
107
|
+
"publish": true
|
|
108
|
+
},
|
|
109
|
+
"github": {
|
|
110
|
+
"release": true
|
|
111
|
+
},
|
|
112
|
+
"plugins": {
|
|
113
|
+
"@release-it/conventional-changelog": {
|
|
114
|
+
"preset": "angular"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"eslintConfig": {
|
|
119
|
+
"root": true,
|
|
120
|
+
"extends": [
|
|
121
|
+
"@react-native",
|
|
122
|
+
"prettier"
|
|
123
|
+
],
|
|
124
|
+
"rules": {
|
|
125
|
+
"react/react-in-jsx-scope": "off",
|
|
126
|
+
"prettier/prettier": [
|
|
127
|
+
"error",
|
|
128
|
+
{
|
|
129
|
+
"quoteProps": "consistent",
|
|
130
|
+
"singleQuote": true,
|
|
131
|
+
"tabWidth": 2,
|
|
132
|
+
"trailingComma": "es5",
|
|
133
|
+
"useTabs": false
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"eslintIgnore": [
|
|
139
|
+
"node_modules/",
|
|
140
|
+
"lib/"
|
|
141
|
+
],
|
|
142
|
+
"prettier": {
|
|
143
|
+
"quoteProps": "consistent",
|
|
144
|
+
"singleQuote": true,
|
|
145
|
+
"tabWidth": 2,
|
|
146
|
+
"trailingComma": "es5",
|
|
147
|
+
"useTabs": false
|
|
148
|
+
},
|
|
149
|
+
"react-native-builder-bob": {
|
|
150
|
+
"source": "src",
|
|
151
|
+
"output": "lib",
|
|
152
|
+
"targets": [
|
|
153
|
+
[
|
|
154
|
+
"commonjs",
|
|
155
|
+
{
|
|
156
|
+
"esm": true
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
[
|
|
160
|
+
"module",
|
|
161
|
+
{
|
|
162
|
+
"esm": true
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
"typescript",
|
|
167
|
+
{
|
|
168
|
+
"project": "tsconfig.build.json",
|
|
169
|
+
"esm": true
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"create-react-native-library": {
|
|
175
|
+
"type": "module-legacy",
|
|
176
|
+
"languages": "kotlin-objc",
|
|
177
|
+
"version": "0.41.0"
|
|
178
|
+
}
|
|
179
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package 'c-prot-ead-module' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
const CProtEadModule = NativeModules.CProtEadModule
|
|
10
|
+
? NativeModules.CProtEadModule
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
// Export the module directly
|
|
21
|
+
export default CProtEadModule;
|