Skip to content

Commit 78cb52d

Browse files
committed
feat: add multi instance detection
1 parent f148e3e commit 78cb52d

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

example/lib/threat_notifier.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class ThreatNotifier extends AutoDisposeNotifier<ThreatState> {
3030
onADBEnabled: () => _updateThreat(Threat.adbEnabled),
3131
onScreenshot: () => _updateThreat(Threat.screenshot),
3232
onScreenRecording: () => _updateThreat(Threat.screenRecording),
33+
onMultiInstance: () => _updateThreat(Threat.multiInstance),
3334
);
3435

3536
Talsec.instance.attachListener(threatCallback);

lib/src/enums/threat.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ enum Threat {
6666

6767
/// Screen recording was started active the application was in the foreground.
6868
screenRecording,
69+
70+
/// This method is called when multiple instances of the app are running on the device
71+
///
72+
/// Android only
73+
multiInstance,
6974
}
7075

7176
/// An extension on the [Threat] enum to provide additional functionality.
@@ -99,6 +104,7 @@ extension ThreatX on Threat {
99104
/// * 379769839 - adbEnabled
100105
/// * 705651459 - screenshot
101106
/// * 64690214 - screenRecording
107+
/// * 859307284 - multiInstance
102108
static Threat fromInt(int code) {
103109
switch (code) {
104110
case 1268968002:
@@ -133,6 +139,8 @@ extension ThreatX on Threat {
133139
return Threat.screenshot;
134140
case 64690214:
135141
return Threat.screenRecording;
142+
case 859307284:
143+
return Threat.multiInstance;
136144
default:
137145
// Unknown data came from native code. This shouldn't normally happen.
138146
exit(127);

lib/src/talsec.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ class Talsec {
253253
callback.onScreenshot?.call();
254254
case Threat.screenRecording:
255255
callback.onScreenRecording?.call();
256+
case Threat.multiInstance:
257+
callback.onMultiInstance?.call();
256258
}
257259
});
258260
}

lib/src/threat_callback.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class ThreatCallback extends TalsecPigeonApi {
3838
this.onMalware,
3939
this.onScreenshot,
4040
this.onScreenRecording,
41+
this.onMultiInstance,
4142
});
4243

4344
/// This method is called when a threat related dynamic hooking (e.g. Frida)
@@ -95,6 +96,9 @@ class ThreatCallback extends TalsecPigeonApi {
9596
/// This method is called when screen recording detected
9697
final VoidCallback? onScreenRecording;
9798

99+
/// This method is called when screen recording detected
100+
final VoidCallback? onMultiInstance;
101+
98102
@override
99103
void onMalwareDetected(List<SuspiciousAppInfo> packageInfo) {
100104
onMalware?.call(packageInfo);

0 commit comments

Comments
 (0)