Java tutorial
package net.easysol.dsb; import android.app.Application; import android.content.Context; import android.util.Log; import android.view.View; import android.widget.FrameLayout; import java.util.Map; import net.easysol.dsb.connection_protector.BlockingConnectionResponseListener; import net.easysol.dsb.device_protector.DeviceProtectorEventListener; import net.easysol.dsb.licensing.protected_sites.ProtectedSite; import net.easysol.dsb.malware_protector.MalwareProtectorEventListener; import net.easysol.dsb.malware_protector.blacklist.App; import net.easysol.dsb.malware_protector.blacklist.MalwareApp; import net.easysol.dsb.malware_protector.overlay.OverlapingApp; import net.easysol.dsb.malware_protector.overlay.OverlayListener; import net.easysol.dsb.sms_protector.SMSObject; import net.easysol.dsb.sms_protector.SMSProtectorPreferences; import net.easysol.dsb.web_protector.WebProtectorEventListener; import org.apache.cordova.BuildConfig; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaInterface; import org.apache.cordova.CordovaPlugin; import org.apache.cordova.CordovaWebView; import org.apache.cordova.PluginResult; import org.apache.cordova.PluginResult.Status; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class DSBSDKCordovaPlugin extends CordovaPlugin implements UpdateListener, DeviceProtectorEventListener, WebProtectorEventListener, MalwareProtectorEventListener, BlockingConnectionResponseListener, OverlayListener { private static final String TAG = "DSBSDK.PhoneGap"; private DSB DSBSDK; private CallbackContext callbackContextBrowsingMalware; private CallbackContext callbackContextBrowsingPharming; private CallbackContext callbackContextBrowsingPhishing; private CallbackContext callbackContextCertificateFailing; private CallbackContext callbackContextMalwareAppScan; private CallbackContext callbackContextOverlayAttack; private CallbackContext callbackContextPostUpdate; private CallbackContext callbackContextPreUpdate; private CallbackContext callbackContextRiskBlockingConnection; private CallbackContext callbackContextScanDevice; private CallbackContext callbackContextScanHost; private FrameLayout container; private View mainView; private Application myApplication; private Context myContext; /* renamed from: net.easysol.dsb.DSBSDKCordovaPlugin.1 */ class C02331 implements Runnable { final /* synthetic */ CallbackContext val$callbackContext; C02331(CallbackContext callbackContext) { this.val$callbackContext = callbackContext; } public void run() { JSONArray mArray = new JSONArray(); for (SMSObject smsObject : DSBSDKCordovaPlugin.this.DSBSDK.SMS_PROTECTOR_API.getAllSecuredSMS()) { try { JSONObject mObject = new JSONObject(); mObject.put("id", smsObject.getId()); mObject.put(SMSProtectorPreferences.TIMESTAPMILLIS, smsObject.getTimestampMillis()); mObject.put(SMSProtectorPreferences.ORIGINATINGADDRESS, smsObject.getOriginatingAddress()); mObject.put(SMSProtectorPreferences.MESSAGEBODY, smsObject.getMessageBody()); mArray.put(mObject); } catch (JSONException e) { Log.i(DSBSDKCordovaPlugin.TAG, e.toString()); } } PluginResult result = new PluginResult(Status.OK, mArray); Log.d(DSBSDKCordovaPlugin.TAG, "DSBSDK getAllSecuredSMS method was called"); this.val$callbackContext.sendPluginResult(result); } } private class SecureByRiskRulesTask implements Runnable { private CallbackContext callbackContext; public SecureByRiskRulesTask(CallbackContext callbackContext) { this.callbackContext = callbackContext; } public void run() { Boolean secure = Boolean .valueOf(DSBSDKCordovaPlugin.this.DSBSDK.CONNECTION_PROTECTOR_API.isSecureByRiskRules()); Log.d(DSBSDKCordovaPlugin.TAG, "DSBSDK isSecureByRiskRules AskTask method was called"); PluginResult result = new PluginResult(Status.OK, secure.booleanValue()); result.setKeepCallback(false); this.callbackContext.sendPluginResult(result); Log.d(DSBSDKCordovaPlugin.TAG, "DSBSDK isSecureByRiskRules result: " + secure); } } private class SecureCertificateTask implements Runnable { private CallbackContext callbackContext; private String url; public SecureCertificateTask(String url, CallbackContext callbackContext) { this.url = url; this.callbackContext = callbackContext; } public void run() { Log.d(DSBSDKCordovaPlugin.TAG, "DSBSDK isSecureCertificate requested URL:" + this.url); Boolean secure = Boolean.valueOf( DSBSDKCordovaPlugin.this.DSBSDK.CONNECTION_PROTECTOR_API.isSecureCertificate(this.url)); Log.d(DSBSDKCordovaPlugin.TAG, "DSBSDK isSecureCertificate AskTask method was called"); PluginResult result = new PluginResult(Status.OK, secure.booleanValue()); result.setKeepCallback(false); this.callbackContext.sendPluginResult(result); Log.d(DSBSDKCordovaPlugin.TAG, "DSBSDK isSecureCertificate result: " + secure); } } private class SecureConnectionTask implements Runnable { private CallbackContext callbackContext; private String url; public SecureConnectionTask(String url, CallbackContext callbackContext) { this.url = url; this.callbackContext = callbackContext; } public void run() { Log.d(DSBSDKCordovaPlugin.TAG, "DSBSDK isSecureConnection requested URL:" + this.url); Boolean secure = Boolean .valueOf(DSBSDKCordovaPlugin.this.DSBSDK.CONNECTION_PROTECTOR_API.isSecureConnection(this.url)); Log.d(DSBSDKCordovaPlugin.TAG, "DSBSDK isSecureConnection AskTask method was called"); PluginResult result = new PluginResult(Status.OK, secure.booleanValue()); result.setKeepCallback(false); this.callbackContext.sendPluginResult(result); Log.d(DSBSDKCordovaPlugin.TAG, "DSBSDK isSecureConnection result: " + secure); } } public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); } public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { boolean valueSDK = true; Log.d(TAG, "Arguments received : " + args); JSONObject arg_object = null; this.myContext = this.cordova.getActivity().getApplicationContext(); this.myApplication = this.cordova.getActivity().getApplication(); Log.d(TAG, "Context reference: " + this.myContext.toString()); this.DSBSDK = DSB.sdk(this.myContext); if (args.length() > 0) { arg_object = args.getJSONObject(0); } Log.d(TAG, "Action called: " + action); if (action.equals("init")) { String licenseKey = arg_object.getString("licenseKey"); if (licenseKey != null) { Log.d(TAG, "licenseKey for init service: " + licenseKey); this.DSBSDK.init(licenseKey); Log.d(TAG, "DSBSDK init method was called"); callbackContext.success(); } else { callbackContext.error(BuildConfig.FLAVOR); valueSDK = false; } } else { boolean enabled; if (action.equals("setAutomaticUpdateEnabled")) { enabled = arg_object.getBoolean("enabled"); this.DSBSDK.setAutomaticUpdateEnabled(enabled); Log.d(TAG, "DSBSDK setAutomaticUpdateEnabled method was called"); callbackContext.success(); } else { if (action.equals("setAutomaticUpdateInterval")) { long updateInterval = arg_object.getLong("updateInterval"); this.DSBSDK.setAutomaticUpdateInterval(1000 * updateInterval); Log.d(TAG, "DSBSDK setAutomaticUpdateInterval method was called"); callbackContext.success(); } else { if (action.equals("setEventsReportingEnabled")) { enabled = arg_object.getBoolean("enabled"); this.DSBSDK.setEventsReportingEnabled(enabled); Log.d(TAG, "DSBSDK setEventsReportingEnabled method was called"); callbackContext.success(); } else { if (action.equals("setEventReportingUsername")) { String userName = arg_object.getString("userName"); int publicKeyId = arg_object.getInt("publicKeyId"); boolean cipher = arg_object.getBoolean("cipher"); if (userName != null) { this.DSBSDK.setEventReportingUsername(userName, publicKeyId, cipher); Log.d(TAG, "DSBSDK setEventReportingUsername method was called"); callbackContext.success(); } else { valueSDK = false; callbackContext.error(BuildConfig.FLAVOR); } } else { PluginResult pluginResult; if (action.equals("setPreUpdateListener")) { Log.d(TAG, "DSBSDK setPreUpdateListener method is called"); this.DSBSDK.setUpdateListener(this); this.callbackContextPreUpdate = callbackContext; pluginResult = new PluginResult(Status.NO_RESULT); pluginResult.setKeepCallback(true); Log.d(TAG, "DSBSDK setPreUpdateListener method was called"); callbackContext.sendPluginResult(pluginResult); } else { if (action.equals("setPostUpdateListener")) { Log.d(TAG, "DSBSDK setPostUpdateListener method is called"); this.DSBSDK.setUpdateListener(this); this.callbackContextPostUpdate = callbackContext; pluginResult = new PluginResult(Status.NO_RESULT); pluginResult.setKeepCallback(true); Log.d(TAG, "DSBSDK setPostUpdateListener method was called"); callbackContext.sendPluginResult(pluginResult); } else { if (action.equals("getInformationAPI")) { String informationAPI = this.DSBSDK.getInformationAPI(); Log.d(TAG, "DSBSDK getInformationAPI method was called: " + informationAPI); callbackContext.success(informationAPI); } else { if (action.equals("scanDeviceStatus")) { this.DSBSDK.DEVICE_PROTECTOR_API.scanDeviceStatus(); Log.d(TAG, "DSBSDK scanDeviceStatus method was called"); callbackContext.success(); } else { if (action.equals("scanDeviceHosts")) { boolean status = this.DSBSDK.DEVICE_PROTECTOR_API.scanDeviceHosts(); Log.d(TAG, "DSBSDK scanDeviceHosts method was called"); callbackContext.success(Boolean.toString(status)); } else { if (action.equals("restoreDeviceHosts")) { this.DSBSDK.DEVICE_PROTECTOR_API.restoreDeviceHosts(); Log.d(TAG, "DSBSDK restoreDeviceHosts method was called"); callbackContext.success(); } else { if (action.equals("setScanDeviceListener")) { Log.d(TAG, "DSBSDK setScanDeviceListener method is called"); this.DSBSDK.DEVICE_PROTECTOR_API .setEventsReportListener(this); this.callbackContextScanDevice = callbackContext; pluginResult = new PluginResult(Status.NO_RESULT); pluginResult.setKeepCallback(true); Log.d(TAG, "DSBSDK setScanDeviceListener method was called"); callbackContext.sendPluginResult(pluginResult); } else { if (action.equals("setScanHostListener")) { Log.d(TAG, "DSBSDK setScanHostListener method is called"); this.DSBSDK.DEVICE_PROTECTOR_API .setEventsReportListener(this); this.callbackContextScanHost = callbackContext; pluginResult = new PluginResult(Status.NO_RESULT); pluginResult.setKeepCallback(true); Log.d(TAG, "DSBSDK setScanHostListener method was called"); callbackContext.sendPluginResult(pluginResult); } else { if (action.equals("isDeviceRooted")) { boolean isDeviceRooted = this.DSBSDK.DEVICE_PROTECTOR_API .isDeviceRooted(); Log.d(TAG, "DSBSDK isDeviceRooted method was called: " + isDeviceRooted); callbackContext .success(Boolean.toString(isDeviceRooted)); } else { if (action .equals("isDeviceAllowingUnknownSources")) { boolean isDeviceAllowUnknowSources = this.DSBSDK.DEVICE_PROTECTOR_API .isDeviceAllowingUnknownSources(); Log.d(TAG, "DSBSDK isDeviceAllowingUnknownSources method was called: " + isDeviceAllowUnknowSources); callbackContext.success(Boolean .toString(isDeviceAllowUnknowSources)); } else { if (action.equals( "setBrowsingMalwareGUINotificationEnabled")) { enabled = arg_object.getBoolean("enabled"); this.DSBSDK.WEB_PROTECTOR_API .setBrowsingMalwareGUINotificationEnabled( enabled); Log.d(TAG, "DSBSDK setBrowsingMalwareGUINotificationEnabled method was called"); callbackContext.success(); } else { if (action.equals( "setWebProtectionEnabled")) { enabled = arg_object .getBoolean("enabled"); this.DSBSDK.WEB_PROTECTOR_API .setWebProtectionEnabled( enabled); Log.d(TAG, "DSBSDK setWebProtectionEnabled method was called"); callbackContext.success(); } else { if (action.equals( "setWebBlockingEnabled")) { enabled = arg_object .getBoolean("enabled"); this.DSBSDK.WEB_PROTECTOR_API .setWebBlockingEnabled( enabled); Log.d(TAG, "DSBSDK setWebBlockingEnabled method was called"); callbackContext.success(); } else { if (action.equals( "setBrowsingPhishingListener")) { Log.d(TAG, "DSBSDK setBrowsingPhishingListener method is called"); this.DSBSDK.WEB_PROTECTOR_API .setEventsReportListener( this); this.callbackContextBrowsingPhishing = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback(true); Log.d(TAG, "DSBSDK setBrowsingPhishingListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action.equals( "setBrowsingMalwareListener")) { Log.d(TAG, "DSBSDK setBrowsingMalwareListener method is called"); this.DSBSDK.WEB_PROTECTOR_API .setEventsReportListener( this); this.callbackContextBrowsingMalware = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setBrowsingMalwareListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action.equals( "setBrowsingPharmingListener")) { Log.d(TAG, "DSBSDK setBrowsingPharmingListener method is called"); this.DSBSDK.WEB_PROTECTOR_API .setEventsReportListener( this); this.callbackContextBrowsingPharming = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setBrowsingPharmingListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { String drawableName; String title; String message; int id; if (action.equals( "configureBrowsingMalwareGUINotification")) { try { drawableName = arg_object .getString( "drawableName"); if (arg_object .getString( "title") .equals("null")) { title = null; } else { title = arg_object .getString( "title"); } if (arg_object .getString( "message") .equals("null")) { message = null; } else { message = arg_object .getString( "message"); } id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.WEB_PROTECTOR_API .configureBrowsingMalwareGUINotification( id, title, message); Log.d(TAG, "DSBSDK configureBrowsingMalwareGUINotification method was called"); callbackContext .success(); } catch (Exception e) { Log.d(TAG, e .getMessage()); this.DSBSDK.WEB_PROTECTOR_API .configureBrowsingMalwareGUINotification( 0, null, null); Log.d(TAG, "DSBSDK configureBrowsingMalwareGUINotification method was configure by default"); callbackContext .error("resource not found"); } } else { if (action.equals( "startMalwareScanning")) { this.DSBSDK.MALWARE_PROTECTOR_API .startMalwareScanning(); Log.d(TAG, "DSBSDK startMalwareScanning method was called"); callbackContext .success(); } else { if (action .equals("setMalwareAppScanListener")) { Log.d(TAG, "DSBSDK setMalwareAppScanListener method is called"); this.DSBSDK.MALWARE_PROTECTOR_API .setEventsReportListener( this); this.callbackContextMalwareAppScan = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setBrowsingPharmingListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action .equals("setMalwareResultDialogEnable")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.MALWARE_PROTECTOR_API .setMalwareResultDialogEnable( enabled); Log.d(TAG, "DSBSDK setMalwareResultDialogEnable method was called"); callbackContext .success(); } else { if (action .equals("setMalwareInstallGUINotificationEnabled")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.MALWARE_PROTECTOR_API .setMalwareInstallGUINotificationEnabled( enabled); Log.d(TAG, "DSBSDK setMalwareInstallGUINotificationEnabled method was called"); callbackContext .success(); } else { if (action .equals("setAutomaticMalwareScanEnabled")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.MALWARE_PROTECTOR_API .setAutomaticMalwareScanEnabled( enabled); Log.d(TAG, "DSBSDK setAutomaticMalwareScanEnabled method was called"); callbackContext .success(); } else { if (action .equals("setMalwareScanOnInstallationEnabled")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.MALWARE_PROTECTOR_API .setMalwareScanOnInstallationEnabled( enabled); Log.d(TAG, "DSBSDK setMalwareScanOnInstallationEnabled method was called"); callbackContext .success(); } else { if (action .equals("configureInstallCertificateAppGUINotification")) { drawableName = arg_object .getString( "drawableName"); title = arg_object .getString( "title"); message = arg_object .getString( "message"); try { id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallCertificateAppGUINotification( id, title, message); Log.d(TAG, "DSBSDK configureInstallCertificateAppGUINotification method was called"); callbackContext .success(); } catch (Exception e2) { Log.d(TAG, "DSBSDK configureBrowsingMalwareGUINotification method was configure by default"); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallCertificateAppGUINotification( 0, null, null); Log.d(TAG, e2.getMessage()); callbackContext .error("resource not found"); } } else { if (action .equals("configureInstallMalwareAppGUINotification")) { drawableName = arg_object .getString( "drawableName"); title = arg_object .getString( "title"); message = arg_object .getString( "message"); try { id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallMalwareAppGUINotification( id, title, message); Log.d(TAG, "DSBSDK configureInstallMalwareAppGUINotification method was called"); callbackContext .success(); } catch (Exception e22) { Log.d(TAG, "DSBSDK configureInstallMalwareAppGUINotification method was configure by default"); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallMalwareAppGUINotification( 0, null, null); Log.d(TAG, e22.getMessage()); callbackContext .error("resource not found"); } } else { if (action .equals("startOverlappingProtection")) { this.DSBSDK.MALWARE_PROTECTOR_API .startOverlappingProtection( this.myApplication); Log.d(TAG, "DSBSDK startOverlappingProtection method was called"); callbackContext .success(); } else { if (action .equals("addOverlayListener")) { Log.d(TAG, "DSBSDK addOverlayListener method is called"); this.DSBSDK.MALWARE_PROTECTOR_API .addOverlayListener( this); this.callbackContextOverlayAttack = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK addOverlayListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action .equals("configureOverlappingMalwareGUINotification")) { drawableName = arg_object .getString( "drawableName"); title = arg_object .getString( "title"); message = arg_object .getString( "message"); try { id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.MALWARE_PROTECTOR_API .configureOverlappingMalwareGUINotification( id, title, message); Log.d(TAG, "DSBSDK configureOverlappingMalwareGUINotification method was called"); callbackContext .success(); } catch (Exception e222) { Log.d(TAG, "DSBSDK configureOverlappingMalwareGUINotification method was configure by default"); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallMalwareAppGUINotification( 0, null, null); Log.d(TAG, e222.getMessage()); callbackContext .error("resource not found"); } } else { String url; if (action .equals("isSecureConnection")) { url = arg_object .getString( ProtectedSite.URL); if (url != null) { Log.d(TAG, "DSBSDK isSecureConnection method was called"); pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); callbackContext .sendPluginResult( pluginResult); this.cordova .getThreadPool() .execute( new SecureConnectionTask( url, callbackContext)); } else { valueSDK = false; callbackContext .error(BuildConfig.FLAVOR); } } else { if (action .equals("isSecureCertificate")) { url = arg_object .getString( ProtectedSite.URL); if (url != null) { Log.d(TAG, "DSBSDK isSecureCertificate method was called"); pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); callbackContext .sendPluginResult( pluginResult); this.cordova .getThreadPool() .execute( new SecureCertificateTask( url, callbackContext)); } else { valueSDK = false; callbackContext .error(BuildConfig.FLAVOR); } } else { if (action .equals("isSecureByRiskRules")) { Log.d(TAG, "DSBSDK isSecureByRiskRules method was called"); pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); callbackContext .sendPluginResult( pluginResult); this.cordova .getThreadPool() .execute( new SecureByRiskRulesTask( callbackContext)); } else { if (action .equals("setCertificateFailingListener")) { Log.d(TAG, "DSBSDK setCertificateFailingListener method is called"); this.DSBSDK.CONNECTION_PROTECTOR_API .setBlockingConnectionResponseListener( this); this.callbackContextCertificateFailing = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setCertificateFailingListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action .equals("setRiskBlockingConnectionListener")) { Log.d(TAG, "DSBSDK setRiskBlockingConnectionListener method is called"); this.DSBSDK.CONNECTION_PROTECTOR_API .setBlockingConnectionResponseListener( this); this.callbackContextRiskBlockingConnection = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setRiskBlockingConnectionListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action .equals("enableUnknownAppBlockingConnection")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.CONNECTION_PROTECTOR_API .enableUnknownAppBlockingConnection( enabled); Log.d(TAG, "DSBSDK enableUnknownAppBlockingConnection method was called"); callbackContext .success(); } else { if (action .equals("configureSMSFilterNumbers")) { try { JSONArray arr = arg_object .getJSONArray( "senderNumber"); String[] senderNumber = new String[arr .length()]; for (int i = 0; i < arr .length(); i++) { senderNumber[i] = arr .getString( i); } this.DSBSDK.SMS_PROTECTOR_API .configureSMSFilterNumbers( senderNumber); Log.d(TAG, "DSBSDK configureSMSFilterNumbers method was called"); callbackContext .success(); } catch (Exception e2222) { Log.d(TAG, "DSBSDK configureSMSFilterNumbers method was configure by default"); Log.d(TAG, e2222.getMessage()); callbackContext .error(BuildConfig.FLAVOR); } } else { if (action .equals("displaySecuredSMS")) { this.DSBSDK.SMS_PROTECTOR_API .displaySecuredSMS(); Log.d(TAG, "DSBSDK displaySecuredSMS method was called"); callbackContext .success(); } else { if (action .equals("scanInboxSMS")) { this.DSBSDK.SMS_PROTECTOR_API .scanInboxSMS(); Log.d(TAG, "DSBSDK scanInboxSMS method was called"); callbackContext .success(); } else { if (action .equals("configureRogueSMSNotification")) { drawableName = arg_object .getString( "drawableName"); title = arg_object .getString( "title"); message = arg_object .getString( "message"); try { id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.SMS_PROTECTOR_API .configureRogueSMSNotification( id, title, message); Log.d(TAG, "DSBSDK configureRogueSMSNotification method was called"); callbackContext .success(); } catch (Exception e22222) { Log.d(TAG, "DSBSDK configureRogueSMSNotification method was configure by default"); this.DSBSDK.SMS_PROTECTOR_API .configureRogueSMSNotification( 0, null, null); Log.d(TAG, e22222.getMessage()); callbackContext .error("resource not found"); } } else { if (action .equals("getAllSecuredSMS")) { this.cordova .getThreadPool() .execute( new C02331( callbackContext)); } else { if (action .equals("deleteSecuredSMS")) { JSONObject jSONObject = new JSONObject( arg_object .getString( "sms")); for (SMSObject sms : this.DSBSDK.SMS_PROTECTOR_API .getAllSecuredSMS()) { if (sms.getTimestampMillis() == jSONObject .getLong( SMSProtectorPreferences.TIMESTAPMILLIS)) { this.DSBSDK.SMS_PROTECTOR_API .deleteSecuredSMS( sms); break; } } Log.d(TAG, "DSBSDK deleteSecuredSMS method was called"); callbackContext .success(); } else { if (action .equals("deleteAllSecuredSMS")) { this.DSBSDK.SMS_PROTECTOR_API .deleteAllSecuredSMS(); Log.d(TAG, "DSBSDK deleteAllSecuredSMS method was called"); callbackContext .success(); } else { valueSDK = false; Log.d(TAG, "Method " + action + " is not defined on DSB SDK "); callbackContext .error("not supported methos"); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } Log.d(TAG, "Returned valueSDK: " + valueSDK); return valueSDK; } public void onPreUpdate() { Log.d(TAG, "Preupdate response"); if (this.callbackContextPreUpdate != null) { Log.d(TAG, "From Preupdate callback"); PluginResult result = new PluginResult(Status.OK); result.setKeepCallback(true); this.callbackContextPreUpdate.sendPluginResult(result); } } public void onPostUpdate() { Log.d(TAG, "PostUpdate response"); if (this.callbackContextPostUpdate != null) { Log.d(TAG, "From PostUpdate callback"); PluginResult result = new PluginResult(Status.OK); result.setKeepCallback(true); this.callbackContextPostUpdate.sendPluginResult(result); } } public void onScanDeviceStateEvent(Map<String, String> eventMap) { Log.d(TAG, "Scan device event "); if (this.callbackContextScanDevice != null) { Log.d(TAG, "From Scan device event"); try { PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextScanDevice.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } } public void onScanHostsEvent(Map<String, String> eventMap) { Log.d(TAG, "Scan host event "); if (this.callbackContextScanHost != null) { Log.d(TAG, "From host device event"); try { PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextScanHost.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } } public void onBrowsingPhishingEvent(Map<String, String> eventMap) { Log.d(TAG, "report Phishing events "); if (this.callbackContextBrowsingPhishing != null) { Log.d(TAG, "From Phishing events "); try { PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextBrowsingPhishing.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } } public void onBrowsingMalwareAppEvent(Map<String, String> eventMap) { Log.d(TAG, "report malware events "); if (this.callbackContextBrowsingMalware != null) { Log.d(TAG, "From malware events "); try { PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextBrowsingMalware.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } } public void onBrowsingPharmingEvent(Map<String, String> eventMap) { Log.d(TAG, "report pharming events "); if (this.callbackContextBrowsingPharming != null) { Log.d(TAG, "From pharming events "); try { PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextBrowsingPharming.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } } public void onMalwareAppScanEvent(Map<String, String> eventMap) { Log.d(TAG, "report malware scaning events"); if (this.callbackContextMalwareAppScan != null) { Log.d(TAG, "From malware scaning events "); try { PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextMalwareAppScan.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } } public void onCertificateFailingResponse() { Log.d(TAG, "setCertificateFailingListener response "); if (this.callbackContextCertificateFailing != null) { Log.d(TAG, "From setCertificateFailingListener callback"); PluginResult result = new PluginResult(Status.OK); result.setKeepCallback(true); this.callbackContextCertificateFailing.sendPluginResult(result); } } public void onRiskBlockingConnectionResponse(Map<String, Boolean> response) { Log.d(TAG, "onRiskBlockingConnectionResponse reponse"); if (this.callbackContextRiskBlockingConnection != null) { Log.d(TAG, "From onRiskBlockingConnectionResponse callback"); try { PluginResult result = new PluginResult(Status.OK, new JSONObject(response)); result.setKeepCallback(true); this.callbackContextRiskBlockingConnection.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } } public void onSuspiciousOverlay(OverlapingApp app) { Log.d(TAG, "onSuspiciousOverlay reponse"); if (this.callbackContextOverlayAttack != null) { Log.d(TAG, "From onSuspiciousOverlay callback"); try { JSONObject objReponse = new JSONObject(); objReponse.put("appName", app.appName); objReponse.put("packageName", app.packageName); objReponse.put("versionName", app.versionName); objReponse.put("versionCode", app.versionCode); objReponse.put(App.PATH, app.path); objReponse.put(MalwareApp.SIGNATURE, app.signature); PluginResult result = new PluginResult(Status.OK, objReponse); result.setKeepCallback(true); this.callbackContextOverlayAttack.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } } }