@@ -24,7 +24,7 @@ public class TalsecPlugin : MonoBehaviour
2424 private static extern void _initTalsec ( string [ ] appBundleIds , int appBundleIdsCount , string appTeamId , string watcherMailAddress , bool isProd ) ;
2525 #endif
2626
27- readonly string ControllerName = "com.unity.free.rasp.Controller" ;
27+ private readonly string ControllerName = "com.unity.free.rasp.Controller" ;
2828
2929 // Singleton instance
3030 private static TalsecPlugin _instance ;
@@ -105,91 +105,90 @@ public void setiOSCallback(IOSThreatDetectedCallback callback) {
105105 public void scanResultIOS ( string threatType )
106106 {
107107 if ( this . iosCallback != null ) {
108-
109- if ( threatType == "signature" ) {
110- this . iosCallback . signatureDetected ( ) ;
111- }
112- if ( threatType == "jailbreak" ) {
113- this . iosCallback . jailbreakDetected ( ) ;
114- }
115- if ( threatType == "debugger" ) {
116- this . iosCallback . debuggerDetected ( ) ;
117- }
118- if ( threatType == "runtimeManipulation" ) {
119- this . iosCallback . runtimeManipulationDetected ( ) ;
120- }
121- if ( threatType == "passcode" ) {
122- this . iosCallback . passcodeDetected ( ) ;
123- }
124- if ( threatType == "passcodeChange" ) {
125- this . iosCallback . passcodeChangeDetected ( ) ;
126- }
127- if ( threatType == "simulator" ) {
128- this . iosCallback . simulatorDetected ( ) ;
129- }
130- if ( threatType == "missingSecureEnclave" ) {
131- this . iosCallback . missingSecureEnclaveDetected ( ) ;
132- }
133- if ( threatType == "deviceChange" ) {
134- this . iosCallback . deviceBindingDetected ( ) ;
135- }
136- if ( threatType == "deviceID" ) {
137- this . iosCallback . deviceIDDetected ( ) ;
138- }
139- if ( threatType == "unofficialStore" ) {
140- this . iosCallback . unofficialStoreDetected ( ) ;
141- }
142- if ( threatType == "systemVPN" ) {
143- this . iosCallback . systemVPNDetected ( ) ;
144- }
145- if ( threatType == "screenshot" ) {
146- this . iosCallback . screenshotDetected ( ) ;
147- }
148- if ( threatType == "screenRecording" ) {
149- this . iosCallback . screenRecordingDetected ( ) ;
108+ switch ( threatType ) {
109+ case "signature" :
110+ this . iosCallback . signatureDetected ( ) ;
111+ break ;
112+ case "jailbreak" :
113+ this . iosCallback . jailbreakDetected ( ) ;
114+ break ;
115+ case "debugger" :
116+ this . iosCallback . debuggerDetected ( ) ;
117+ break ;
118+ case "runtimeManipulation" :
119+ this . iosCallback . runtimeManipulationDetected ( ) ;
120+ break ;
121+ case "passcode" :
122+ this . iosCallback . passcodeDetected ( ) ;
123+ break ;
124+ case "passcodeChange" :
125+ this . iosCallback . passcodeChangeDetected ( ) ;
126+ break ;
127+ case "simulator" :
128+ this . iosCallback . simulatorDetected ( ) ;
129+ break ;
130+ case "missingSecureEnclave" :
131+ this . iosCallback . missingSecureEnclaveDetected ( ) ;
132+ break ;
133+ case "deviceChange" :
134+ this . iosCallback . deviceBindingDetected ( ) ;
135+ break ;
136+ case "deviceID" :
137+ this . iosCallback . deviceIDDetected ( ) ;
138+ break ;
139+ case "unofficialStore" :
140+ this . iosCallback . unofficialStoreDetected ( ) ;
141+ break ;
142+ case "systemVPN" :
143+ this . iosCallback . systemVPNDetected ( ) ;
144+ break ;
145+ case "screenshot" :
146+ this . iosCallback . screenshotDetected ( ) ;
147+ break ;
148+ case "screenRecording" :
149+ this . iosCallback . screenRecordingDetected ( ) ;
150+ break ;
150151 }
151152 }
152-
153153 }
154154
155155 // this method is called by the java side module
156156 public void scanResultAndroid ( string talsecScanResultCallbackName ) {
157157 // Debug.Log("Scan Result Callback Name: " + talsecScanResultCallbackName);
158158 if ( Application . platform == RuntimePlatform . Android )
159159 {
160- if ( talsecScanResultCallbackName == "onRootDetected" ) {
161- this . androidCallback . onRootDetected ( ) ;
162- }
163- if ( talsecScanResultCallbackName == "onTamperDetected" ) {
164- this . androidCallback . onTamperDetected ( ) ;
165- }
166- if ( talsecScanResultCallbackName == "onDebuggerDetected" ) {
167- this . androidCallback . onDebuggerDetected ( ) ;
168- }
169- if ( talsecScanResultCallbackName == "onEmulatorDetected" ) {
170- this . androidCallback . onEmulatorDetected ( ) ;
171- }
172- if ( talsecScanResultCallbackName == "onObfuscationIssuesDetected" ) {
173- this . androidCallback . onObfuscationIssuesDetected ( ) ;
174- }
175- if ( talsecScanResultCallbackName == "onScreenshotDetected" ) {
176- this . androidCallback . onScreenshotDetected ( ) ;
177- }
178- if ( talsecScanResultCallbackName == "onScreenRecordingDetected" ) {
179- this . androidCallback . onScreenRecordingDetected ( ) ;
180- }
181- if ( talsecScanResultCallbackName == "onUntrustedInstallationSourceDetected" ) {
182- this . androidCallback . onUntrustedInstallationSourceDetected ( ) ;
160+ switch ( talsecScanResultCallbackName ) {
161+ case "onRootDetected" :
162+ this . androidCallback . onRootDetected ( ) ;
163+ break ;
164+ case "onTamperDetected" :
165+ this . androidCallback . onTamperDetected ( ) ;
166+ break ;
167+ case "onDebuggerDetected" :
168+ this . androidCallback . onDebuggerDetected ( ) ;
169+ break ;
170+ case "onEmulatorDetected" :
171+ this . androidCallback . onEmulatorDetected ( ) ;
172+ break ;
173+ case "onObfuscationIssuesDetected" :
174+ this . androidCallback . onObfuscationIssuesDetected ( ) ;
175+ break ;
176+ case "onScreenshotDetected" :
177+ this . androidCallback . onScreenshotDetected ( ) ;
178+ break ;
179+ case "onScreenRecordingDetected" :
180+ this . androidCallback . onScreenRecordingDetected ( ) ;
181+ break ;
182+ case "onUntrustedInstallationSourceDetected" :
183+ this . androidCallback . onUntrustedInstallationSourceDetected ( ) ;
184+ break ;
185+ case "onHookDetected" :
186+ this . androidCallback . onHookDetected ( ) ;
187+ break ;
188+ case "onDeviceBindingDetected" :
189+ this . androidCallback . onDeviceBindingDetected ( ) ;
190+ break ;
183191 }
184192 }
185193 }
186-
187- // this method is called by the java side module
188- public void onMalwareDetected ( string result ) {
189- // Debug.Log("C# onMalwareDetected " + result);
190- List < SuspiciousAppInfo > malwareList = JsonUtility . FromJson < SuspiciousAppInfoList > (
191- "{ \" items\" : " + result + "}"
192- ) . items ;
193- this . androidCallback . onMalwareDetected ( malwareList ) ;
194- }
195194}
0 commit comments