freerasp-react-native 4.3.2 → 4.5.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.
- package/CHANGELOG.md +99 -1
- package/android/build.gradle +8 -2
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +87 -43
- package/android/src/main/java/com/freeraspreactnative/PluginThreatHandler.kt +126 -0
- package/android/src/main/java/com/freeraspreactnative/dispatchers/ExecutionStateDispatcher.kt +53 -0
- package/android/src/main/java/com/freeraspreactnative/dispatchers/ThreatDispatcher.kt +75 -0
- package/android/src/main/java/com/freeraspreactnative/events/ThreatEvent.kt +3 -1
- package/android/src/main/java/com/freeraspreactnative/interfaces/PluginExecutionStateListener.kt +7 -0
- package/android/src/main/java/com/freeraspreactnative/interfaces/PluginThreatListener.kt +9 -0
- package/example/src/App.tsx +11 -1
- package/example/src/DemoApp.tsx +32 -0
- package/example/src/checks.ts +2 -1
- package/freerasp-react-native.podspec +5 -1
- package/ios/FreeraspReactNative.m +5 -0
- package/ios/FreeraspReactNative.swift +39 -10
- package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
- package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +82 -288
- package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +7 -2
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +7 -7
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +4 -4
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +474 -547
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.private.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/PrivacyInfo.xcprivacy +8 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +14 -4
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +7 -7
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +4 -4
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +475 -548
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +475 -548
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/PrivacyInfo.xcprivacy +8 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +46 -35
- package/ios/dispatchers/ExecutionStateDispatcher.swift +35 -0
- package/ios/dispatchers/ThreatDispatcher.swift +36 -0
- package/ios/models/SecurityThreat.swift +2 -0
- package/ios/utils/EventIdentifiers.swift +2 -2
- package/lib/commonjs/api/listeners/raspExecutionState.js +28 -8
- package/lib/commonjs/api/listeners/raspExecutionState.js.map +1 -1
- package/lib/commonjs/api/listeners/threat.js +34 -10
- package/lib/commonjs/api/listeners/threat.js.map +1 -1
- package/lib/commonjs/api/methods/native.js +9 -1
- package/lib/commonjs/api/methods/native.js.map +1 -1
- package/lib/commonjs/api/methods/reactNative.js +13 -8
- package/lib/commonjs/api/methods/reactNative.js.map +1 -1
- package/lib/commonjs/channels/threat.js +1 -3
- package/lib/commonjs/channels/threat.js.map +1 -1
- package/lib/commonjs/models/threat.js +2 -1
- package/lib/commonjs/models/threat.js.map +1 -1
- package/lib/module/api/listeners/raspExecutionState.js +29 -9
- package/lib/module/api/listeners/raspExecutionState.js.map +1 -1
- package/lib/module/api/listeners/threat.js +35 -11
- package/lib/module/api/listeners/threat.js.map +1 -1
- package/lib/module/api/methods/native.js +6 -0
- package/lib/module/api/methods/native.js.map +1 -1
- package/lib/module/api/methods/reactNative.js +13 -7
- package/lib/module/api/methods/reactNative.js.map +1 -1
- package/lib/module/channels/threat.js +1 -3
- package/lib/module/channels/threat.js.map +1 -1
- package/lib/module/models/threat.js +2 -1
- package/lib/module/models/threat.js.map +1 -1
- package/lib/typescript/src/api/listeners/raspExecutionState.d.ts +1 -1
- package/lib/typescript/src/api/listeners/raspExecutionState.d.ts.map +1 -1
- package/lib/typescript/src/api/listeners/threat.d.ts +1 -1
- package/lib/typescript/src/api/listeners/threat.d.ts.map +1 -1
- package/lib/typescript/src/api/methods/native.d.ts +2 -0
- package/lib/typescript/src/api/methods/native.d.ts.map +1 -1
- package/lib/typescript/src/api/methods/reactNative.d.ts.map +1 -1
- package/lib/typescript/src/channels/threat.d.ts.map +1 -1
- package/lib/typescript/src/models/threat.d.ts +1 -0
- package/lib/typescript/src/models/threat.d.ts.map +1 -1
- package/lib/typescript/src/types/types.d.ts +1 -0
- package/lib/typescript/src/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/listeners/raspExecutionState.ts +39 -11
- package/src/api/listeners/threat.ts +41 -10
- package/src/api/methods/native.ts +8 -0
- package/src/api/methods/reactNative.ts +17 -8
- package/src/channels/threat.ts +1 -3
- package/src/models/threat.ts +3 -0
- package/src/types/types.ts +1 -0
- package/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt +0 -103
- package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "freerasp-react-native",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NativeEventEmitter, type EmitterSubscription } from 'react-native';
|
|
2
2
|
import { FreeraspReactNative } from '../nativeModules';
|
|
3
|
-
import { onInvalidCallback } from '../methods/native';
|
|
3
|
+
import { onInvalidCallback, removeListenerForEvent } from '../methods/native';
|
|
4
4
|
import type {
|
|
5
5
|
NativeEvent,
|
|
6
6
|
RaspExecutionStateEventActions,
|
|
@@ -12,19 +12,41 @@ import {
|
|
|
12
12
|
import { RaspExecutionState } from '../../models/raspExecutionState';
|
|
13
13
|
|
|
14
14
|
const eventEmitter = new NativeEventEmitter(FreeraspReactNative);
|
|
15
|
-
let eventsListener: EmitterSubscription |
|
|
15
|
+
let eventsListener: EmitterSubscription | null = null;
|
|
16
|
+
let executionStateChannel: string | null = null;
|
|
17
|
+
let executionStateKey: string | null = null;
|
|
18
|
+
|
|
19
|
+
let isMappingPrepared = false;
|
|
20
|
+
let isInitializing = false;
|
|
16
21
|
|
|
17
22
|
export const setRaspExecutionStateListener = async (
|
|
18
23
|
config: RaspExecutionStateEventActions
|
|
19
24
|
) => {
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
if (isInitializing) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
isInitializing = true;
|
|
30
|
+
|
|
31
|
+
await removeRaspExecutionStateEventListener();
|
|
32
|
+
|
|
33
|
+
if (!executionStateChannel || !executionStateKey) {
|
|
34
|
+
[executionStateChannel, executionStateKey] =
|
|
35
|
+
await getRaspExecutionStateChannelData();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!isMappingPrepared) {
|
|
39
|
+
await prepareRaspExecutionStateMapping();
|
|
40
|
+
isMappingPrepared = true;
|
|
41
|
+
}
|
|
22
42
|
|
|
23
43
|
const listener = async (event: NativeEvent) => {
|
|
24
|
-
if (
|
|
44
|
+
if (!executionStateKey) {
|
|
25
45
|
onInvalidCallback();
|
|
46
|
+
return;
|
|
26
47
|
}
|
|
27
|
-
|
|
48
|
+
|
|
49
|
+
switch (event[executionStateKey]) {
|
|
28
50
|
case RaspExecutionState.AllChecksFinished.value:
|
|
29
51
|
config.allChecksFinished?.();
|
|
30
52
|
break;
|
|
@@ -33,10 +55,16 @@ export const setRaspExecutionStateListener = async (
|
|
|
33
55
|
break;
|
|
34
56
|
}
|
|
35
57
|
};
|
|
36
|
-
eventsListener = eventEmitter.addListener(
|
|
58
|
+
eventsListener = eventEmitter.addListener(executionStateChannel, listener);
|
|
59
|
+
isInitializing = false;
|
|
37
60
|
};
|
|
38
61
|
|
|
39
|
-
export const removeRaspExecutionStateEventListener =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
export const removeRaspExecutionStateEventListener =
|
|
63
|
+
async (): Promise<void> => {
|
|
64
|
+
if (!eventsListener || !executionStateChannel) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
await removeListenerForEvent(executionStateChannel);
|
|
68
|
+
eventsListener?.remove();
|
|
69
|
+
eventsListener = null;
|
|
70
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NativeEventEmitter, type EmitterSubscription } from 'react-native';
|
|
2
2
|
import { FreeraspReactNative } from '../nativeModules';
|
|
3
|
-
import { onInvalidCallback } from '../methods/native';
|
|
3
|
+
import { onInvalidCallback, removeListenerForEvent } from '../methods/native';
|
|
4
4
|
import { Threat } from '../../models/threat';
|
|
5
5
|
import type { NativeEvent, ThreatEventActions } from '../../types/types';
|
|
6
6
|
import { parseMalwareData } from '../../utils/malware';
|
|
@@ -10,17 +10,40 @@ import {
|
|
|
10
10
|
} from '../../channels/threat';
|
|
11
11
|
|
|
12
12
|
const eventEmitter = new NativeEventEmitter(FreeraspReactNative);
|
|
13
|
-
let eventsListener: EmitterSubscription |
|
|
13
|
+
let eventsListener: EmitterSubscription | null = null;
|
|
14
|
+
|
|
15
|
+
let threatChannel: string | null = null;
|
|
16
|
+
let threatKey: string | null = null;
|
|
17
|
+
let threatMalwareKey: string | null = null;
|
|
18
|
+
|
|
19
|
+
let isMappingPrepared = false;
|
|
20
|
+
let isInitializing = false;
|
|
14
21
|
|
|
15
22
|
export const setThreatListeners = async (config: ThreatEventActions) => {
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
if (isInitializing) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
isInitializing = true;
|
|
28
|
+
|
|
29
|
+
await removeThreatListener();
|
|
30
|
+
|
|
31
|
+
if (!threatChannel || !threatKey || !threatMalwareKey) {
|
|
32
|
+
[threatChannel, threatKey, threatMalwareKey] = await getThreatChannelData();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!isMappingPrepared) {
|
|
36
|
+
await prepareThreatMapping();
|
|
37
|
+
isMappingPrepared = true;
|
|
38
|
+
}
|
|
18
39
|
|
|
19
40
|
const listener = async (event: NativeEvent) => {
|
|
20
|
-
if (
|
|
41
|
+
if (!threatKey || !threatMalwareKey) {
|
|
21
42
|
onInvalidCallback();
|
|
43
|
+
return;
|
|
22
44
|
}
|
|
23
|
-
|
|
45
|
+
|
|
46
|
+
switch (event[threatKey]) {
|
|
24
47
|
case Threat.PrivilegedAccess.value:
|
|
25
48
|
config.privilegedAccess?.();
|
|
26
49
|
break;
|
|
@@ -61,7 +84,7 @@ export const setThreatListeners = async (config: ThreatEventActions) => {
|
|
|
61
84
|
config.systemVPN?.();
|
|
62
85
|
break;
|
|
63
86
|
case Threat.Malware.value:
|
|
64
|
-
const malwareData = event[
|
|
87
|
+
const malwareData = event[threatMalwareKey];
|
|
65
88
|
config.malware?.(
|
|
66
89
|
await parseMalwareData(Array.isArray(malwareData) ? malwareData : [])
|
|
67
90
|
);
|
|
@@ -87,15 +110,23 @@ export const setThreatListeners = async (config: ThreatEventActions) => {
|
|
|
87
110
|
case Threat.UnsecureWifi.value:
|
|
88
111
|
config.unsecureWifi?.();
|
|
89
112
|
break;
|
|
113
|
+
case Threat.Automation.value:
|
|
114
|
+
config.automation?.();
|
|
115
|
+
break;
|
|
90
116
|
default:
|
|
91
117
|
onInvalidCallback();
|
|
92
118
|
break;
|
|
93
119
|
}
|
|
94
120
|
};
|
|
95
|
-
eventsListener = eventEmitter.addListener(
|
|
121
|
+
eventsListener = eventEmitter.addListener(threatChannel, listener);
|
|
122
|
+
isInitializing = false;
|
|
96
123
|
};
|
|
97
124
|
|
|
98
|
-
export const removeThreatListener = (): void => {
|
|
125
|
+
export const removeThreatListener = async (): Promise<void> => {
|
|
126
|
+
if (!eventsListener || !threatChannel) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
await removeListenerForEvent(threatChannel);
|
|
99
130
|
eventsListener?.remove();
|
|
100
|
-
eventsListener =
|
|
131
|
+
eventsListener = null;
|
|
101
132
|
};
|
|
@@ -25,6 +25,10 @@ export const storeExternalId = (data: string): Promise<string> => {
|
|
|
25
25
|
return FreeraspReactNative.storeExternalId(data);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
export const removeExternalId = (): Promise<string> => {
|
|
29
|
+
return FreeraspReactNative.removeExternalId();
|
|
30
|
+
};
|
|
31
|
+
|
|
28
32
|
export const getAppIcon = (packageName: string): Promise<string> => {
|
|
29
33
|
if (Platform.OS === 'ios') {
|
|
30
34
|
return Promise.reject(
|
|
@@ -37,3 +41,7 @@ export const getAppIcon = (packageName: string): Promise<string> => {
|
|
|
37
41
|
export const onInvalidCallback = (): void => {
|
|
38
42
|
FreeraspReactNative.onInvalidCallback();
|
|
39
43
|
};
|
|
44
|
+
|
|
45
|
+
export const removeListenerForEvent = (channel: string): Promise<string> => {
|
|
46
|
+
return FreeraspReactNative.removeListenerForEvent(channel);
|
|
47
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { talsecStart } from '
|
|
1
|
+
import { talsecStart } from './native';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import {
|
|
4
4
|
setRaspExecutionStateListener,
|
|
@@ -12,6 +12,8 @@ import type {
|
|
|
12
12
|
} from '../../types/types';
|
|
13
13
|
import { onInvalidCallback } from './native';
|
|
14
14
|
|
|
15
|
+
let isRaspStarted = false;
|
|
16
|
+
|
|
15
17
|
export const useFreeRasp = (
|
|
16
18
|
config: TalsecConfig,
|
|
17
19
|
actions: ThreatEventActions,
|
|
@@ -22,21 +24,28 @@ export const useFreeRasp = (
|
|
|
22
24
|
await setThreatListeners(actions);
|
|
23
25
|
raspExecutionStateActions &&
|
|
24
26
|
(await setRaspExecutionStateListener(raspExecutionStateActions));
|
|
27
|
+
|
|
28
|
+
if (isRaspStarted) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
try {
|
|
26
|
-
|
|
33
|
+
const response = await talsecStart(config);
|
|
27
34
|
if (response !== 'freeRASP started') {
|
|
28
35
|
onInvalidCallback();
|
|
29
36
|
}
|
|
30
|
-
|
|
37
|
+
isRaspStarted = true;
|
|
31
38
|
} catch (e: any) {
|
|
32
39
|
console.error(`${e.code}: ${e.message}`);
|
|
33
40
|
}
|
|
34
|
-
|
|
35
|
-
return () => {
|
|
36
|
-
removeThreatListener();
|
|
37
|
-
removeRaspExecutionStateEventListener();
|
|
38
|
-
};
|
|
39
41
|
})();
|
|
42
|
+
|
|
43
|
+
return () => {
|
|
44
|
+
(async () => {
|
|
45
|
+
await removeThreatListener();
|
|
46
|
+
await removeRaspExecutionStateEventListener();
|
|
47
|
+
})();
|
|
48
|
+
};
|
|
40
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
50
|
}, []);
|
|
42
51
|
};
|
package/src/channels/threat.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
1
|
import { getThreatCount, itemsHaveType } from '../utils/utils';
|
|
3
2
|
import { FreeraspReactNative } from '../api/nativeModules';
|
|
4
3
|
import { Threat } from '../models/threat';
|
|
@@ -18,9 +17,8 @@ export const getThreatIdentifiers = async (): Promise<number[]> => {
|
|
|
18
17
|
export const getThreatChannelData = async (): Promise<
|
|
19
18
|
[string, string, string]
|
|
20
19
|
> => {
|
|
21
|
-
const dataLength = Platform.OS === 'ios' ? 2 : 3;
|
|
22
20
|
const data = await FreeraspReactNative.getThreatChannelData();
|
|
23
|
-
if (data.length !==
|
|
21
|
+
if (data.length !== 3 || !itemsHaveType(data, 'string')) {
|
|
24
22
|
onInvalidCallback();
|
|
25
23
|
}
|
|
26
24
|
return data;
|
package/src/models/threat.ts
CHANGED
|
@@ -24,6 +24,7 @@ export class Threat {
|
|
|
24
24
|
static TimeSpoofing = new Threat(0);
|
|
25
25
|
static LocationSpoofing = new Threat(0);
|
|
26
26
|
static UnsecureWifi = new Threat(0);
|
|
27
|
+
static Automation = new Threat(0);
|
|
27
28
|
|
|
28
29
|
constructor(value: number) {
|
|
29
30
|
this.value = value;
|
|
@@ -52,6 +53,7 @@ export class Threat {
|
|
|
52
53
|
this.TimeSpoofing,
|
|
53
54
|
this.LocationSpoofing,
|
|
54
55
|
this.UnsecureWifi,
|
|
56
|
+
this.Automation,
|
|
55
57
|
]
|
|
56
58
|
: [
|
|
57
59
|
this.AppIntegrity,
|
|
@@ -67,6 +69,7 @@ export class Threat {
|
|
|
67
69
|
this.UnofficialStore,
|
|
68
70
|
this.Screenshot,
|
|
69
71
|
this.ScreenRecording,
|
|
72
|
+
this.TimeSpoofing,
|
|
70
73
|
];
|
|
71
74
|
}
|
|
72
75
|
}
|
package/src/types/types.ts
CHANGED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
package com.freeraspreactnative
|
|
2
|
-
|
|
3
|
-
import com.aheaditec.talsec_security.security.api.SuspiciousAppInfo
|
|
4
|
-
import com.aheaditec.talsec_security.security.api.ThreatListener
|
|
5
|
-
import com.freeraspreactnative.events.RaspExecutionStateEvent
|
|
6
|
-
import com.freeraspreactnative.events.ThreatEvent
|
|
7
|
-
|
|
8
|
-
internal object FreeraspThreatHandler : ThreatListener.ThreatDetected, ThreatListener.DeviceState, ThreatListener.RaspExecutionState() {
|
|
9
|
-
|
|
10
|
-
internal var listener: TalsecReactNative? = null
|
|
11
|
-
|
|
12
|
-
override fun onRootDetected() {
|
|
13
|
-
listener?.threatDetected(ThreatEvent.PrivilegedAccess)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
override fun onDebuggerDetected() {
|
|
17
|
-
listener?.threatDetected(ThreatEvent.Debug)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
override fun onEmulatorDetected() {
|
|
21
|
-
listener?.threatDetected(ThreatEvent.Simulator)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
override fun onTamperDetected() {
|
|
25
|
-
listener?.threatDetected(ThreatEvent.AppIntegrity)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
override fun onUntrustedInstallationSourceDetected() {
|
|
29
|
-
listener?.threatDetected(ThreatEvent.UnofficialStore)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
override fun onHookDetected() {
|
|
33
|
-
listener?.threatDetected(ThreatEvent.Hooks)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
override fun onDeviceBindingDetected() {
|
|
37
|
-
listener?.threatDetected(ThreatEvent.DeviceBinding)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
override fun onObfuscationIssuesDetected() {
|
|
41
|
-
listener?.threatDetected(ThreatEvent.ObfuscationIssues)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
override fun onMalwareDetected(suspiciousAppInfos: MutableList<SuspiciousAppInfo>) {
|
|
45
|
-
listener?.malwareDetected(suspiciousAppInfos ?: mutableListOf())
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
override fun onUnlockedDeviceDetected() {
|
|
49
|
-
listener?.threatDetected(ThreatEvent.Passcode)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
override fun onHardwareBackedKeystoreNotAvailableDetected() {
|
|
53
|
-
listener?.threatDetected(ThreatEvent.SecureHardwareNotAvailable)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
override fun onDeveloperModeDetected() {
|
|
57
|
-
listener?.threatDetected(ThreatEvent.DevMode)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
override fun onADBEnabledDetected() {
|
|
61
|
-
listener?.threatDetected(ThreatEvent.ADBEnabled)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
override fun onSystemVPNDetected() {
|
|
65
|
-
listener?.threatDetected(ThreatEvent.SystemVPN)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
override fun onScreenshotDetected() {
|
|
69
|
-
listener?.threatDetected(ThreatEvent.Screenshot)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
override fun onScreenRecordingDetected() {
|
|
73
|
-
listener?.threatDetected(ThreatEvent.ScreenRecording)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
override fun onMultiInstanceDetected() {
|
|
77
|
-
listener?.threatDetected(ThreatEvent.MultiInstance)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
override fun onUnsecureWifiDetected() {
|
|
81
|
-
listener?.threatDetected(ThreatEvent.UnsecureWifi)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
override fun onTimeSpoofingDetected() {
|
|
85
|
-
listener?.threatDetected(ThreatEvent.TimeSpoofing)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
override fun onLocationSpoofingDetected() {
|
|
89
|
-
listener?.threatDetected(ThreatEvent.LocationSpoofing)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
override fun onAllChecksFinished() {
|
|
93
|
-
listener?.raspExecutionStateChanged(RaspExecutionStateEvent.AllChecksFinished)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
internal interface TalsecReactNative {
|
|
97
|
-
fun threatDetected(threatEventType: ThreatEvent)
|
|
98
|
-
|
|
99
|
-
fun malwareDetected(suspiciousApps: MutableList<SuspiciousAppInfo>)
|
|
100
|
-
|
|
101
|
-
fun raspExecutionStateChanged(event: RaspExecutionStateEvent)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
Binary file
|