freerasp-react-native 4.5.1 → 5.0.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +4 -7
  4. package/android/src/main/java/com/freeraspreactnative/PluginThreatHandler.kt +0 -5
  5. package/android/src/main/java/com/freeraspreactnative/dispatchers/ExecutionStateDispatcher.kt +1 -1
  6. package/android/src/main/java/com/freeraspreactnative/dispatchers/ThreatDispatcher.kt +1 -1
  7. package/android/src/main/java/com/freeraspreactnative/models/RNSuspiciousAppInfo.kt +1 -1
  8. package/android/src/main/java/com/freeraspreactnative/utils/Extensions.kt +22 -2
  9. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
  10. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +51 -40
  11. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
  12. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  13. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +1 -1
  14. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +7 -7
  15. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +4 -4
  16. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +1 -1
  17. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  18. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
  19. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +193 -193
  20. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
  21. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/_CodeSignature/CodeResources +377 -0
  22. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  23. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +2 -2
  24. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +7 -7
  25. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +4 -4
  26. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +1 -1
  27. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  28. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
  29. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +124 -124
  30. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +124 -124
  31. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
  32. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +17 -39
  33. package/lib/commonjs/api/methods/native.js +2 -1
  34. package/lib/commonjs/api/methods/native.js.map +1 -1
  35. package/lib/commonjs/utils/config.js +31 -0
  36. package/lib/commonjs/utils/config.js.map +1 -0
  37. package/lib/commonjs/utils/malware.js +1 -1
  38. package/lib/commonjs/utils/malware.js.map +1 -1
  39. package/lib/module/api/methods/native.js +2 -1
  40. package/lib/module/api/methods/native.js.map +1 -1
  41. package/lib/module/utils/config.js +23 -0
  42. package/lib/module/utils/config.js.map +1 -0
  43. package/lib/module/utils/malware.js +1 -1
  44. package/lib/module/utils/malware.js.map +1 -1
  45. package/lib/typescript/src/api/methods/native.d.ts.map +1 -1
  46. package/lib/typescript/src/types/types.d.ts +16 -8
  47. package/lib/typescript/src/types/types.d.ts.map +1 -1
  48. package/lib/typescript/src/utils/config.d.ts +4 -0
  49. package/lib/typescript/src/utils/config.d.ts.map +1 -0
  50. package/package.json +1 -1
  51. package/src/api/methods/native.ts +2 -1
  52. package/src/types/types.ts +25 -9
  53. package/src/utils/config.ts +42 -0
  54. package/src/utils/malware.ts +1 -1
  55. package/example/Gemfile +0 -10
  56. package/example/Gemfile.lock +0 -121
  57. package/example/android/app/build.gradle +0 -120
  58. package/example/android/app/debug.keystore +0 -0
  59. package/example/android/app/proguard-rules.pro +0 -10
  60. package/example/android/app/src/debug/AndroidManifest.xml +0 -9
  61. package/example/android/app/src/main/AndroidManifest.xml +0 -35
  62. package/example/android/app/src/main/java/com/freerasp/rn/example/MainActivity.kt +0 -22
  63. package/example/android/app/src/main/java/com/freerasp/rn/example/MainApplication.kt +0 -44
  64. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -37
  65. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  66. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  67. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  68. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  69. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  70. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  71. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  72. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  73. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  74. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  75. package/example/android/app/src/main/res/values/strings.xml +0 -3
  76. package/example/android/app/src/main/res/values/styles.xml +0 -9
  77. package/example/android/build.gradle +0 -21
  78. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  79. package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -7
  80. package/example/android/gradle.properties +0 -39
  81. package/example/android/gradlew +0 -251
  82. package/example/android/gradlew.bat +0 -94
  83. package/example/android/settings.gradle +0 -6
  84. package/example/app.json +0 -4
  85. package/example/assets/arrow-down.png +0 -0
  86. package/example/assets/arrow-up.png +0 -0
  87. package/example/assets/checkmark-circle-outline.png +0 -0
  88. package/example/assets/checkmark-circle-outline.svg +0 -1
  89. package/example/assets/close-circle-outline.png +0 -0
  90. package/example/assets/close-circle-outline.svg +0 -1
  91. package/example/assets/talsec-logo.png +0 -0
  92. package/example/index.d.ts +0 -1
  93. package/example/index.js +0 -9
  94. package/example/ios/FreeraspRNExample/AppDelegate.swift +0 -30
  95. package/example/ios/FreeraspRNExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
  96. package/example/ios/FreeraspRNExample/Images.xcassets/Contents.json +0 -6
  97. package/example/ios/FreeraspRNExample/Info.plist +0 -51
  98. package/example/ios/FreeraspRNExample/LaunchScreen.storyboard +0 -47
  99. package/example/ios/FreeraspRNExample/PrivacyInfo.xcprivacy +0 -37
  100. package/example/ios/FreeraspRNExample.xcodeproj/project.pbxproj +0 -488
  101. package/example/ios/FreeraspRNExample.xcodeproj/xcshareddata/xcschemes/FreeraspRNExample.xcscheme +0 -88
  102. package/example/ios/FreeraspRNExample.xcworkspace/contents.xcworkspacedata +0 -10
  103. package/example/ios/Podfile +0 -35
  104. package/example/metro.config.js +0 -39
  105. package/example/package.json +0 -42
  106. package/example/react-native.config.js +0 -10
  107. package/example/src/App.tsx +0 -329
  108. package/example/src/DemoApp.tsx +0 -392
  109. package/example/src/MalwareItem.tsx +0 -161
  110. package/example/src/MalwareModal.tsx +0 -116
  111. package/example/src/checks.ts +0 -28
  112. package/example/src/styles.ts +0 -10
  113. package/example/yarn.lock +0 -6263
@@ -1,392 +0,0 @@
1
- /* eslint-disable react-native/no-inline-styles */
2
- import * as React from 'react';
3
- import { Box, Flex, HStack, Text, VStack } from '@react-native-material/core';
4
- import CheckmarkCircle from '../assets/checkmark-circle-outline.png';
5
- import CloseCircle from '../assets/close-circle-outline.png';
6
- import TalsecLogo from '../assets/talsec-logo.png';
7
- import {
8
- ScrollView,
9
- Image,
10
- TouchableOpacity,
11
- StyleSheet,
12
- TextInput,
13
- View,
14
- Modal,
15
- ActivityIndicator,
16
- } from 'react-native';
17
- import { Colors } from './styles';
18
- import { MalwareModal } from './MalwareModal';
19
- import {
20
- isScreenCaptureBlocked,
21
- blockScreenCapture,
22
- type SuspiciousAppInfo,
23
- storeExternalId,
24
- removeExternalId,
25
- } from 'freerasp-react-native';
26
- import {
27
- ALERT_TYPE,
28
- AlertNotificationRoot,
29
- Toast,
30
- } from 'react-native-alert-notification';
31
-
32
- export const DemoApp: React.FC<{
33
- checks: {
34
- name: string;
35
- status: string;
36
- }[];
37
- suspiciousApps: SuspiciousAppInfo[];
38
- allChecksFinishedStatus: 'in progress' | 'completed';
39
- }> = ({ checks, suspiciousApps, allChecksFinishedStatus }) => {
40
- const [hasScreenCaptureBlocked, setHasScreenCaptureBlocked] =
41
- React.useState(false);
42
- const [externalIdValue, setExternalIdValue] = React.useState('');
43
- const [modalVisible, setModalVisible] = React.useState(false);
44
-
45
- React.useEffect(() => {
46
- (async () => {
47
- await updateScreenCaptureStatus();
48
- })();
49
- }, []);
50
-
51
- const updateScreenCaptureStatus = async () => {
52
- try {
53
- const isBlocked = await isScreenCaptureBlocked();
54
- setHasScreenCaptureBlocked(isBlocked);
55
- } catch (error) {
56
- console.error('Error fetching screen capture status:', error);
57
- }
58
- };
59
-
60
- const toggleScreenCaptureBlock = async () => {
61
- try {
62
- const response = await blockScreenCapture(!hasScreenCaptureBlocked);
63
- console.info('Changing Screen Capture Status:', response);
64
- await updateScreenCaptureStatus();
65
- } catch (error: any) {
66
- console.error('Screen capture Error:', error.message);
67
- }
68
- };
69
-
70
- const handleModalSend = async () => {
71
- setModalVisible(false);
72
- try {
73
- await storeExternalId(externalIdValue);
74
- Toast.show({
75
- type: ALERT_TYPE.SUCCESS,
76
- title: 'Success',
77
- textBody: 'External ID stored',
78
- });
79
- } catch (error: any) {
80
- Toast.show({
81
- type: ALERT_TYPE.WARNING,
82
- title: 'Warning',
83
- textBody: 'External ID not stored',
84
- });
85
- }
86
- };
87
-
88
- const handleModalRemove = async () => {
89
- setModalVisible(false);
90
- try {
91
- await removeExternalId();
92
- Toast.show({
93
- type: ALERT_TYPE.SUCCESS,
94
- title: 'Success',
95
- textBody: 'External ID removed',
96
- });
97
- } catch (error: any) {
98
- Toast.show({
99
- type: ALERT_TYPE.WARNING,
100
- title: 'Warning',
101
- textBody: 'External ID not removed',
102
- });
103
- }
104
- };
105
-
106
- const handleModalDismiss = () => {
107
- setModalVisible(false);
108
- };
109
-
110
- return (
111
- <>
112
- <AlertNotificationRoot>
113
- <Flex fill style={styles.flex}>
114
- <ScrollView>
115
- <VStack>
116
- <Image source={TalsecLogo} style={{ alignSelf: 'center' }} />;
117
- <HStack
118
- style={{ justifyContent: 'space-evenly', paddingTop: 10 }}>
119
- <TouchableOpacity
120
- onPress={toggleScreenCaptureBlock}
121
- style={[
122
- styles.button,
123
- hasScreenCaptureBlocked && styles.blockedButton,
124
- ]}>
125
- <Text
126
- style={[
127
- styles.buttonText,
128
- { color: hasScreenCaptureBlocked ? 'white' : 'black' },
129
- ]}>
130
- {hasScreenCaptureBlocked
131
- ? 'Enable Screen Capture'
132
- : 'Block Screen Capture'}
133
- </Text>
134
- </TouchableOpacity>
135
- <TouchableOpacity
136
- onPress={() => setModalVisible(true)}
137
- style={[styles.button]}>
138
- <Text style={[styles.buttonText, { color: 'black' }]}>
139
- Set External ID
140
- </Text>
141
- </TouchableOpacity>
142
- <Modal
143
- transparent
144
- visible={modalVisible}
145
- animationType="fade"
146
- onRequestClose={handleModalDismiss}>
147
- <View style={styles.modalOverlay}>
148
- <View style={styles.modalContent}>
149
- <Text style={styles.title}>Set External ID</Text>
150
- <TextInput
151
- style={styles.input}
152
- placeholder="Type something..."
153
- value={externalIdValue}
154
- onChangeText={setExternalIdValue}
155
- />
156
- <View style={styles.buttonRow}>
157
- <TouchableOpacity
158
- style={styles.sendButton}
159
- onPress={handleModalSend}>
160
- <Text style={styles.modalText}>Send</Text>
161
- </TouchableOpacity>
162
- <TouchableOpacity
163
- style={styles.removeButton}
164
- onPress={handleModalRemove}>
165
- <Text style={styles.modalText}>Remove</Text>
166
- </TouchableOpacity>
167
- <TouchableOpacity
168
- style={styles.dismissButton}
169
- onPress={handleModalDismiss}>
170
- <Text style={styles.modalText}>Dismiss</Text>
171
- </TouchableOpacity>
172
- </View>
173
- </View>
174
- </View>
175
- </Modal>
176
- </HStack>
177
- <Text style={styles.titleText}>RASP Execution State:</Text>
178
- <Box
179
- style={[
180
- styles.box,
181
- allChecksFinishedStatus === 'completed'
182
- ? styles.boxCheckOk
183
- : styles.boxProgress,
184
- ]}>
185
- <HStack
186
- style={{
187
- justifyContent: 'space-between',
188
- alignItems: 'center',
189
- }}>
190
- <Text
191
- style={{
192
- color:
193
- allChecksFinishedStatus === 'completed'
194
- ? 'green'
195
- : Colors.progressDark,
196
- fontWeight: 'bold',
197
- alignSelf: 'center',
198
- }}>
199
- All Checks Finished
200
- </Text>
201
- {allChecksFinishedStatus === 'completed' ? (
202
- <Image
203
- source={CheckmarkCircle}
204
- style={[
205
- styles.checkIcon,
206
- {
207
- tintColor: Colors.checkOkDark,
208
- },
209
- ]}
210
- />
211
- ) : (
212
- <ActivityIndicator size={30} color={Colors.progressDark} />
213
- )}
214
- </HStack>
215
- </Box>
216
- <Text style={styles.titleText}>freeRASP checks:</Text>
217
- {checks.map((check: any, idx: number) => (
218
- <Box
219
- key={idx}
220
- style={[
221
- styles.box,
222
- check.status === 'ok'
223
- ? styles.boxCheckOk
224
- : styles.boxCheckNok,
225
- ]}>
226
- <HStack style={{ justifyContent: 'space-between' }}>
227
- <Text
228
- style={{
229
- color:
230
- check.status === 'ok' ? 'green' : 'rgb(200, 0, 0)',
231
- fontWeight: 'bold',
232
- alignSelf: 'center',
233
- }}>
234
- {check.name}
235
- </Text>
236
- {check.name === 'Malware' && (
237
- <MalwareModal
238
- isDisabled={check.status === 'ok'}
239
- suspiciousApps={suspiciousApps}
240
- />
241
- )}
242
- {check.status === 'ok' ? (
243
- <Image
244
- source={CheckmarkCircle}
245
- style={[
246
- styles.checkIcon,
247
- {
248
- tintColor: Colors.checkOkDark,
249
- },
250
- ]}
251
- />
252
- ) : (
253
- <Image
254
- source={CloseCircle}
255
- style={[
256
- styles.checkIcon,
257
- {
258
- tintColor: Colors.checkNokDark,
259
- },
260
- ]}
261
- />
262
- )}
263
- </HStack>
264
- </Box>
265
- ))}
266
- </VStack>
267
- </ScrollView>
268
- </Flex>
269
- </AlertNotificationRoot>
270
- </>
271
- );
272
- };
273
-
274
- const styles = StyleSheet.create({
275
- flex: {
276
- paddingTop: 50,
277
- backgroundColor: Colors.background,
278
- justifyContent: 'center',
279
- },
280
- buttonText: {
281
- fontSize: 16,
282
- fontWeight: '500',
283
- alignSelf: 'center',
284
- textAlign: 'center',
285
- },
286
- button: {
287
- justifyContent: 'center',
288
- alignItems: 'center',
289
- width: 180,
290
- height: 50,
291
- backgroundColor: Colors.checkOkLight,
292
- borderRadius: 10,
293
- padding: 2,
294
- marginTop: 20,
295
- },
296
- blockedButton: {
297
- backgroundColor: Colors.checkNokDark,
298
- },
299
- colorCheckNok: {
300
- color: Colors.checkNokDark,
301
- },
302
- colorCheckOk: {
303
- color: Colors.checkOkDark,
304
- },
305
- boxCheckNok: {
306
- borderColor: Colors.checkNokDark,
307
- backgroundColor: Colors.checkNokLight,
308
- },
309
- boxCheckOk: {
310
- borderColor: Colors.checkOkDark,
311
- backgroundColor: Colors.checkOkLight,
312
- },
313
- boxProgress: {
314
- borderColor: Colors.progressDark,
315
- backgroundColor: Colors.progressLight,
316
- },
317
- box: {
318
- borderWidth: 1,
319
- paddingHorizontal: 30,
320
- paddingVertical: 4,
321
- marginVertical: 8,
322
- marginHorizontal: 20,
323
- borderRadius: 15,
324
- },
325
- checkIcon: {
326
- width: 30,
327
- height: 30,
328
- },
329
- titleText: {
330
- alignSelf: 'center',
331
- fontWeight: 'bold',
332
- fontSize: 25,
333
- color: 'white',
334
- paddingTop: 15,
335
- },
336
- modalOverlay: {
337
- flex: 1,
338
- height: 10,
339
- backgroundColor: 'rgba(0,0,0,0.5)',
340
- justifyContent: 'center',
341
- alignItems: 'center',
342
- },
343
- modalContent: {
344
- width: '80%',
345
- backgroundColor: 'white',
346
- padding: 20,
347
- borderRadius: 10,
348
- },
349
- title: {
350
- fontSize: 18,
351
- fontWeight: 'bold',
352
- marginBottom: 10,
353
- },
354
- input: {
355
- borderWidth: 1,
356
- borderColor: '#ccc',
357
- borderRadius: 5,
358
- padding: 10,
359
- marginBottom: 20,
360
- },
361
- buttonRow: {
362
- flexDirection: 'row',
363
- justifyContent: 'space-between',
364
- },
365
- sendButton: {
366
- backgroundColor: '#4CAF50',
367
- padding: 10,
368
- borderRadius: 5,
369
- flex: 1,
370
- marginRight: 10,
371
- alignItems: 'center',
372
- },
373
- removeButton: {
374
- backgroundColor: '#FF9800',
375
- padding: 10,
376
- borderRadius: 5,
377
- flex: 1,
378
- marginRight: 10,
379
- alignItems: 'center',
380
- },
381
- dismissButton: {
382
- backgroundColor: '#f44336',
383
- padding: 10,
384
- borderRadius: 5,
385
- flex: 1,
386
- alignItems: 'center',
387
- },
388
- modalText: {
389
- color: '#fff',
390
- fontWeight: 'bold',
391
- },
392
- });
@@ -1,161 +0,0 @@
1
- import { Button, HStack } from '@react-native-material/core';
2
- import {
3
- addToWhitelist,
4
- getAppIcon,
5
- type SuspiciousAppInfo,
6
- } from 'freerasp-react-native';
7
- import ArrowUp from '../assets/arrow-up.png';
8
- import ArrowDown from '../assets/arrow-down.png';
9
- import React, { useEffect } from 'react';
10
- import { useState } from 'react';
11
- import { TouchableOpacity, View, Text, Image, StyleSheet } from 'react-native';
12
- import { Colors } from './styles';
13
-
14
- export const MalwareItem: React.FC<{ app: SuspiciousAppInfo }> = ({ app }) => {
15
- const [expanded, setExpanded] = useState(false);
16
-
17
- useEffect(() => {
18
- (async () => {
19
- // retrieve app icons for detected malware
20
- const appIcon = await getAppIcon(app.packageInfo.packageName);
21
- app.packageInfo.appIcon = appIcon;
22
- })();
23
- }, [app.packageInfo]);
24
-
25
- const appUninstall = async () => {
26
- alert('Implement yourself!');
27
- };
28
-
29
- const whitelistApp = async (packageName: string) => {
30
- try {
31
- const whitelistResponse = await addToWhitelist(packageName);
32
- console.info(
33
- `Malware Whitelist response for ${app}: ${whitelistResponse}`
34
- );
35
- alert('Restart app for whitelist to take effect');
36
- } catch (error: any) {
37
- console.info('Error while adding app to malware whitelist: ', error);
38
- }
39
- };
40
-
41
- return (
42
- <View style={styles.item}>
43
- <TouchableOpacity onPress={() => setExpanded(!expanded)}>
44
- <HStack>
45
- <Image
46
- style={styles.iconSmall}
47
- source={{
48
- uri: `data:image/png;base64,${app.packageInfo.appIcon}`,
49
- }}
50
- />
51
- <View style={styles.textView}>
52
- <Text numberOfLines={1} style={styles.titleText}>
53
- {app.packageInfo.appName}
54
- </Text>
55
- </View>
56
-
57
- <View style={styles.buttonView}>
58
- <Image
59
- source={expanded ? ArrowUp : ArrowDown}
60
- style={styles.expandArrow}
61
- />
62
- </View>
63
- </HStack>
64
- </TouchableOpacity>
65
- {expanded && (
66
- <>
67
- <View style={styles.spacer} />
68
- <Text style={styles.listItemTitle}>Package name:</Text>
69
- <Text style={styles.listItem}>{app.packageInfo.packageName}</Text>
70
- <Text style={styles.listItemTitle}>App name:</Text>
71
- <Text style={styles.listItem}>
72
- {app.packageInfo.appName ?? 'Not specified'}
73
- </Text>
74
- <Text style={styles.listItemTitle}>App version:</Text>
75
- <Text style={styles.listItem}>
76
- {app.packageInfo.version ?? 'Not specified'}
77
- </Text>
78
- <Text style={styles.listItemTitle}>App Icon:</Text>
79
- {app.packageInfo.appIcon ? (
80
- <Image
81
- style={styles.icon}
82
- source={{
83
- uri: `data:image/png;base64,${app.packageInfo.appIcon}`,
84
- }}
85
- />
86
- ) : (
87
- <Text style={styles.listItem}>Not specified</Text>
88
- )}
89
- <Text style={styles.listItemTitle}>Installer store:</Text>
90
- <Text style={styles.listItem}>
91
- {app.packageInfo.installerStore ?? 'Not specified'}
92
- </Text>
93
- <Text style={styles.listItemTitle}>Detection reason:</Text>
94
- <Text style={styles.listItem}>{app.reason}</Text>
95
- <Text style={styles.listItemTitle}>Granted permissions:</Text>
96
- <Text style={styles.listItem}>
97
- {app.permissions?.join(', ') ?? 'Not specified'}
98
- </Text>
99
- <HStack style={styles.buttonGroup}>
100
- <Button
101
- title={'Add to whitelist'}
102
- onPress={() => whitelistApp(app.packageInfo.packageName)}
103
- />
104
- <Button title={'Uninstall'} onPress={appUninstall} />
105
- </HStack>
106
- </>
107
- )}
108
- </View>
109
- );
110
- };
111
-
112
- const styles = StyleSheet.create({
113
- item: {
114
- backgroundColor: '#d4e4ff',
115
- borderRadius: 20,
116
- padding: 20,
117
- marginVertical: 8,
118
- },
119
- listItemTitle: {
120
- fontSize: 20,
121
- fontWeight: 'bold',
122
- },
123
- listItem: {
124
- fontSize: 16,
125
- paddingBottom: 5,
126
- },
127
- titleText: {
128
- fontSize: 20,
129
- },
130
- icon: {
131
- marginTop: 5,
132
- marginBottom: 5,
133
- width: 50,
134
- height: 50,
135
- },
136
- iconSmall: {
137
- width: 40,
138
- height: 40,
139
- },
140
- textView: {
141
- justifyContent: 'center',
142
- flex: 1,
143
- marginLeft: 20,
144
- marginRight: 30,
145
- },
146
- buttonView: {
147
- justifyContent: 'center',
148
- },
149
- spacer: {
150
- height: 15,
151
- },
152
- buttonGroup: {
153
- marginTop: 10,
154
- justifyContent: 'space-between',
155
- },
156
- expandArrow: {
157
- tintColor: Colors.grey,
158
- width: 30,
159
- height: 30,
160
- },
161
- });
@@ -1,116 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- Alert,
4
- FlatList,
5
- Modal,
6
- Pressable,
7
- SafeAreaView,
8
- StyleSheet,
9
- Text,
10
- View,
11
- Button,
12
- } from 'react-native';
13
- import type { SuspiciousAppInfo } from 'freerasp-react-native';
14
- import { MalwareItem } from './MalwareItem';
15
-
16
- export const MalwareModal: React.FC<{
17
- isDisabled: boolean;
18
- suspiciousApps: SuspiciousAppInfo[];
19
- }> = ({ isDisabled, suspiciousApps }) => {
20
- const [modalVisible, setModalVisible] = useState(false);
21
-
22
- return (
23
- <>
24
- {!isDisabled && (
25
- <>
26
- <View style={styles.viewFlex} />
27
- <Button
28
- title={'Details'}
29
- color="#cf000a"
30
- disabled={isDisabled}
31
- onPress={() => setModalVisible(true)}
32
- />
33
- <View style={styles.viewWithMargin} />
34
- </>
35
- )}
36
-
37
- <Modal
38
- animationType="slide"
39
- transparent={true}
40
- visible={modalVisible}
41
- style={styles.modal}
42
- onRequestClose={() => {
43
- Alert.alert('Modal has been closed.');
44
- setModalVisible(false);
45
- }}>
46
- <View style={styles.centeredView}>
47
- <View style={styles.modalView}>
48
- <SafeAreaView style={styles.container}>
49
- <Text style={styles.title}>Detected malware:</Text>
50
- <FlatList
51
- data={suspiciousApps}
52
- renderItem={({ item }) => <MalwareItem app={item} />}
53
- keyExtractor={(_, index) => index.toString()}
54
- />
55
- </SafeAreaView>
56
- <Pressable
57
- style={[styles.button, styles.buttonClose]}
58
- onPress={() => setModalVisible(false)}>
59
- <Text style={styles.textStyle}>Close</Text>
60
- </Pressable>
61
- </View>
62
- </View>
63
- </Modal>
64
- </>
65
- );
66
- };
67
-
68
- const styles = StyleSheet.create({
69
- centeredView: {
70
- flex: 1,
71
- justifyContent: 'center',
72
- alignItems: 'center',
73
- },
74
- modalView: {
75
- margin: 10,
76
- backgroundColor: 'white',
77
- borderRadius: 20,
78
- padding: 15,
79
- alignItems: 'center',
80
- elevation: 5,
81
- flex: 1,
82
- width: '98%',
83
- },
84
- button: {
85
- borderRadius: 20,
86
- paddingHorizontal: 30,
87
- paddingVertical: 10,
88
- marginTop: 15,
89
- },
90
- buttonClose: {
91
- backgroundColor: '#2196F3',
92
- },
93
- textStyle: {
94
- color: 'white',
95
- fontWeight: 'bold',
96
- textAlign: 'center',
97
- },
98
- container: {
99
- flex: 1,
100
- width: '100%',
101
- },
102
- title: {
103
- fontSize: 32,
104
- fontWeight: 'bold',
105
- textAlign: 'center',
106
- },
107
- viewFlex: {
108
- flex: 1,
109
- },
110
- viewWithMargin: {
111
- margin: 5,
112
- },
113
- modal: {
114
- flex: 1,
115
- },
116
- });
@@ -1,28 +0,0 @@
1
- export const commonChecks = [
2
- { name: 'App Integrity', status: 'ok' },
3
- { name: 'Privileged Access', status: 'ok' },
4
- { name: 'Debug', status: 'ok' },
5
- { name: 'Hooks', status: 'ok' },
6
- { name: 'Passcode', status: 'ok' },
7
- { name: 'Simulator', status: 'ok' },
8
- { name: 'Secure Hardware Not Available', status: 'ok' },
9
- { name: 'System VPN', status: 'ok' },
10
- { name: 'Device Binding', status: 'ok' },
11
- { name: 'Unofficial Store', status: 'ok' },
12
- { name: 'Screenshot', status: 'ok' },
13
- { name: 'Screen Recording', status: 'ok' },
14
- { name: 'Time Spoofing', status: 'ok' },
15
- ];
16
-
17
- export const iosChecks = [{ name: 'Device ID', status: 'ok' }];
18
-
19
- export const androidChecks = [
20
- { name: 'Obfuscation Issues', status: 'ok' },
21
- { name: 'Developer Mode', status: 'ok' },
22
- { name: 'Malware', status: 'ok' },
23
- { name: 'ADB Enabled', status: 'ok' },
24
- { name: 'Multi Instance', status: 'ok' },
25
- { name: 'Location Spoofing', status: 'ok' },
26
- { name: 'Unsecure Wifi', status: 'ok' },
27
- { name: 'Automation', status: 'ok' },
28
- ];
@@ -1,10 +0,0 @@
1
- export const Colors = {
2
- background: 'rgba(26, 31, 45, 255)',
3
- checkOkLight: 'rgba(173, 247, 187, 1)',
4
- checkNokLight: 'rgba(247, 173, 173, 1)',
5
- checkOkDark: 'green',
6
- checkNokDark: 'rgb(200, 0, 0)',
7
- grey: 'rgb(120, 120, 120)',
8
- progressLight: 'rgba(173, 216, 230, 1)', // light blue
9
- progressDark: 'rgb(30, 144, 255)', // dodger blue
10
- };