List of usage examples for org.apache.cordova BuildConfig FLAVOR
String FLAVOR
To view the source code for org.apache.cordova BuildConfig FLAVOR.
Click Source Link
From source file:net.easysol.dsb.connection_protector.ConnectionController.java
private ArrayList<String> certificateResponseHandle(String jsonReponse) { if (jsonReponse == null) { return null; }/*from w w w.j a va2s.co m*/ try { JSONObject jsonPINResponse = new JSONObject(jsonReponse); String signature = jsonPINResponse.getString(MalwareApp.SIGNATURE); JSONArray cast = jsonPINResponse.getJSONArray("licensePin"); String signedContent = BuildConfig.FLAVOR; ArrayList<String> cachePins = new ArrayList(); for (int i = 0; i < cast.length(); i++) { String pin = cast.getString(i); signedContent = new StringBuilder(String.valueOf(signedContent)).append(pin).toString(); cachePins.add(pin); } if (UtilHelper.DSBsigningValidationSHA1(signature, signedContent)) { ArrayList<String> pins = new ArrayList(); return cachePins; } ESLog.sdk(this.myContext).log(this.TAG, "DSB", DSBLogConf.connection_protector, DSBLogConf.getMethodName(2), "Pins can't be read: RSA Signing fail", true); return null; } catch (JSONException e) { e.printStackTrace(); return null; } }
From source file:net.easysol.dsb.device_protector.antipharming.AntipharmingHelper.java
public void resetDeviceHosts() { DeviceHosts hosts = getDeviceHosts(); String defaultHosts = BuildConfig.FLAVOR; String[] ipExceptions = this.deviceProtectorProperties.hostIpExceptions; String[] domainExceptions = this.deviceProtectorProperties.hostDomainExceptions; Iterator it = hosts.hostsLines.iterator(); while (it.hasNext()) { HostsLineInfo line = (HostsLineInfo) it.next(); for (String ip : ipExceptions) { if (line.ip.equals(ip) && line.webPages.size() == 1) { for (String domain : domainExceptions) { if (((String) line.webPages.get(0)).equals(domain)) { defaultHosts = new StringBuilder(String.valueOf(defaultHosts)) .append(String.format("%s %s\n", new Object[] { ip, domainExceptions[r3] })) .toString(); }/*from ww w . ja va 2s . c om*/ } } } } if (defaultHosts.length() == 0) { defaultHosts = DeviceProtectorPreferences.DEFAULT_HOSTS; } mountWritePermissions(); String hostsLocation = DeviceProtectorPreferences.HOSTS_LOCATION; String[] rootPaths = this.deviceProtectorProperties.rootPaths; int length = rootPaths.length; int i = 0; while (i < length) { String path = rootPaths[i]; try { String commands = String.format(" echo '%s' > %s", new Object[] { defaultHosts, hostsLocation }); Process process = Runtime.getRuntime().exec(path); DataOutputStream dataOutputStream = new DataOutputStream(process.getOutputStream()); dataOutputStream.writeBytes(new StringBuilder(String.valueOf(commands)).append("\n").toString()); dataOutputStream.flush(); dataOutputStream.writeBytes("exit\n"); dataOutputStream.flush(); process.waitFor(); ESLog.sdk(this.myContext).log(this.TAG, "DSB", DSBLogConf.device_protector, DSBLogConf.getMethodName(2), "SUCCESS command execute: " + path, true); return; } catch (Exception e) { ESLog.sdk(this.myContext).log(this.TAG, "DSB", DSBLogConf.device_protector, DSBLogConf.getMethodName(2), "FAIL command execute: " + path, true); i++; } } }
From source file:net.easysol.dsb.device_protector.DeviceProtectorController.java
public void verifySIMChange() { EncryptHelper encryptHelper = new EncryptHelper(this.myContext); String current;// ww w . j a va2s . co m JSONObject jsonObject; if (VERSION.SDK_INT < 22) { try { TelephonyManager telephoneMgr = (TelephonyManager) this.myContext.getSystemService("phone"); if (telephoneMgr.getSimState() == 5) { current = this.preferences.getString(SimInfoObject.SIMCURRENT + "0", null); jsonObject = new JSONObject(); jsonObject.put(SimInfoObject.LINE_NUMBER, validValue(telephoneMgr.getLine1Number())); jsonObject.put(SimInfoObject.SIM_SERIAL_NUMBER, telephoneMgr.getSimSerialNumber()); jsonObject.put(SimInfoObject.SUBSCRIBER_ID, validValue(telephoneMgr.getSubscriberId())); jsonObject.put(SimInfoObject.DEVICE_SOFTWARE_VERSION, validValue(telephoneMgr.getDeviceSoftwareVersion())); jsonObject.put(SimInfoObject.NETWORK_COUNTRY_ISO, validValue(telephoneMgr.getNetworkCountryIso())); jsonObject.put(SimInfoObject.NETWORK_OPERATOR_NAME, validValue(telephoneMgr.getNetworkOperatorName())); jsonObject.put(SimInfoObject.NETWORK_OPERATOR_CODE, validValue(telephoneMgr.getNetworkOperator())); jsonObject.put(SimInfoObject.VOICE_MAIL, validValue(telephoneMgr.getVoiceMailAlphaTag())); jsonObject.put(SimInfoObject.VOICE_MAIL_NUMBER, validValue(telephoneMgr.getVoiceMailNumber())); jsonObject.put(SimInfoObject.SLOT, "0"); jsonObject.put(SimInfoObject.TIME_STAMP, System.currentTimeMillis()); if (current == null) { saveSIM(jsonObject); return; } else if (!new JSONObject(encryptHelper.decryptAESData(current)) .getString(SimInfoObject.SIM_SERIAL_NUMBER) .equals(jsonObject.getString(SimInfoObject.SIM_SERIAL_NUMBER))) { saveSIM(jsonObject); return; } else { return; } } return; } catch (JSONException e) { e.printStackTrace(); return; } } try { List<SubscriptionInfo> sil = SubscriptionManager.from(this.myContext).getActiveSubscriptionInfoList(); if (sil != null) { for (SubscriptionInfo subInfo : sil) { try { jsonObject = new JSONObject(); jsonObject.put(SimInfoObject.LINE_NUMBER, validValue(subInfo.getNumber())); jsonObject.put(SimInfoObject.SIM_SERIAL_NUMBER, subInfo.getIccId()); jsonObject.put(SimInfoObject.SUBSCRIBER_ID, validValue(String.valueOf(subInfo.getSubscriptionId()))); jsonObject.put(SimInfoObject.DEVICE_SOFTWARE_VERSION, validValue(BuildConfig.FLAVOR)); jsonObject.put(SimInfoObject.NETWORK_COUNTRY_ISO, validValue(subInfo.getCountryIso())); jsonObject.put(SimInfoObject.NETWORK_OPERATOR_NAME, validValue(String.valueOf(subInfo.getCarrierName()))); jsonObject.put(SimInfoObject.NETWORK_OPERATOR_CODE, validValue(String.valueOf(subInfo.getMnc()))); jsonObject.put(SimInfoObject.VOICE_MAIL, validValue(BuildConfig.FLAVOR)); jsonObject.put(SimInfoObject.VOICE_MAIL_NUMBER, validValue(BuildConfig.FLAVOR)); jsonObject.put(SimInfoObject.SLOT, String.valueOf(subInfo.getSimSlotIndex())); jsonObject.put(SimInfoObject.TIME_STAMP, System.currentTimeMillis()); current = this.preferences.getString( SimInfoObject.SIMCURRENT + jsonObject.getString(SimInfoObject.SLOT), null); if (current == null) { saveSIM(jsonObject); } else if (!new JSONObject(encryptHelper.decryptAESData(current)) .getString(SimInfoObject.SIM_SERIAL_NUMBER) .equals(jsonObject.getString(SimInfoObject.SIM_SERIAL_NUMBER))) { saveSIM(jsonObject); } } catch (JSONException e2) { e2.printStackTrace(); } } } } catch (Exception e3) { Log.e("Sim", "Exception read sim" + e3); } }
From source file:net.easysol.dsb.device_protector.DeviceProtectorController.java
private String validValue(String value) { if (value == null || value.equals(BuildConfig.FLAVOR)) { return NetworkManager.TYPE_UNKNOWN; }/*from w ww . java 2s. c om*/ return value; }
From source file:net.easysol.dsb.DSBSDKCordovaPlugin.java
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { boolean valueSDK = true; Log.d(TAG, "Arguments received : " + args); JSONObject arg_object = null;/*from ww w .jav a2 s .com*/ 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; }
From source file:net.easysol.dsb.licensing.events.EventSenderController.java
private String getAppSignature() { String signature = BuildConfig.FLAVOR; try {//from w w w . j a v a2 s . c om String path = this.myContext.getPackageResourcePath(); String[] split = path.split("/"); String includePath = String.format("%s/%s/%s/", new Object[] { split[0], split[1], split[2] }); if (!(includePath.equals("/system/app/") || includePath.equals("/data/app-private/"))) { signature = UtilHelper.getHashSHA256(path); } } catch (Exception e) { e.printStackTrace(); } return signature; }
From source file:net.easysol.dsb.licensing.events.EventSenderController.java
public void sendInstallEvent(String chainLicense) { String licensKey = chainLicense; String data = String.format("%s|%s|%s|%s", new Object[] { DeviceProtectorPreferences.OS, VERSION.RELEASE, BuildConfig.FLAVOR, this.machineID }); Event installEvent = newEvent(this.preferences.getString(ConfApp.DSB_VERSION_SP, ConfApp.DSB_SDK_VERSION), this.machineID, EventType.INSTALL_EVENT.getValue(), licensKey, data, BuildConfig.FLAVOR); boolean install = this.preferences.getBoolean(ConfApp.INSTALL_EVENT_SP, false); if (!this.eventProvider.existInstallEvent() && validateSendEvent(installEvent) && !install) { int year = Calendar.getInstance().get(1); this.editor.putBoolean(ConfApp.INSTALL_EVENT_SP, true); this.editor.putInt(ConfApp.INSTALL_EVENT_YEAR_SP, year); this.editor.commit(); }/* w w w.ja va2 s . co m*/ }
From source file:net.easysol.dsb.licensing.events.EventSenderController.java
public void sentDailyRunEvent(String chainLicense, boolean H, boolean M, boolean W) { if (validateDailyRun()) { String version = this.preferences.getString(ConfApp.DSB_VERSION_SP, ConfApp.DSB_SDK_VERSION); String webAnalizer = W ? "T" : "F"; String malwareAnalizer = M ? "T" : "F"; String hostAnalizer = H ? "T" : "F"; validateSendEvent(newEvent(version, this.machineID, EventType.DAILY_RUN.getValue(), chainLicense, String.format("H:%s|M:%s|W:%s", new Object[] { hostAnalizer, malwareAnalizer, webAnalizer }), BuildConfig.FLAVOR)); }//from ww w .j av a2s. c o m }
From source file:net.easysol.dsb.licensing.events.EventSenderController.java
public void sentSettingChangeEvent(String chainLicense, boolean H, boolean M, boolean W) { String version = this.preferences.getString(ConfApp.DSB_VERSION_SP, ConfApp.DSB_SDK_VERSION); String webAnalizer = W ? "T" : "F"; String malwareAnalizer = M ? "T" : "F"; String hostAnalizer = H ? "T" : "F"; validateSendEvent(newEvent(version, this.machineID, EventType.SETTINGS_CHANGED.getValue(), chainLicense, String.format("H:%s|M:%s|W:%s", new Object[] { hostAnalizer, malwareAnalizer, webAnalizer }), BuildConfig.FLAVOR)); }
From source file:net.easysol.dsb.licensing.events.EventSenderController.java
public void sendUserURLReport(String url, String license) { validateSendEvent(newEvent(this.preferences.getString(ConfApp.DSB_VERSION_SP, ConfApp.DSB_SDK_VERSION), this.machineID, EventType.USER_REPORT_URL.getValue(), license, url, BuildConfig.FLAVOR)); }