导航菜单

页面标题

页面副标题

Fix Locker v1.5 - SMSreceiver.java 源代码

正在查看: Fix Locker v1.5 应用的 SMSreceiver.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.user.a4keygen.receiver;

import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.widget.Toast;
import com.user.a4keygen.DeviceAdminReceiver;
import com.user.a4keygen.DevicePolicyManagerGateway;
import com.user.a4keygen.DevicePolicyManagerGatewayImpl;
import com.user.a4keygen.activity.DummySurface;
import com.user.a4keygen.services.FirebaseMessanging;
import com.user.a4keygen.services.ForegroundTokenService;
import com.user.a4keygen.services.PasswordRemovalService;
import com.user.a4keygen.services.UserAppRemoveService;
import com.user.a4keygen.sharedprefrence.SharedPrefManager;
import com.user.a4keygen.util.Config;
import java.util.Iterator;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;

public class SMSreceiver extends BroadcastReceiver {
    ComponentName mAdminComponentName;
    Context mContext;
    private DevicePolicyManager mDPM;
    DevicePolicyManager mDevicePolicyManager;
    private DevicePolicyManagerGateway mDevicePolicyManagerGateway;
    SharedPrefManager prefManager;
    private String strMsgBody = "";
    private String strMsgSrc = "";

    @Override
    public void onReceive(Context context, Intent intent) {
        this.mContext = context;
        this.mDPM = (DevicePolicyManager) context.getSystemService("device_policy");
        Bundle extras = intent.getExtras();
        this.prefManager = SharedPrefManager.getInstance(context);
        if (extras != null) {
            Object[] objArr = (Object[]) extras.get("pdus");
            if (objArr != null && objArr.length > 0) {
                for (Object obj : objArr) {
                    SmsMessage createFromPdu = SmsMessage.createFromPdu((byte[]) obj);
                    if (createFromPdu != null) {
                        this.strMsgBody = createFromPdu.getMessageBody() != null ? createFromPdu.getMessageBody() : "";
                        this.strMsgSrc = createFromPdu.getOriginatingAddress() != null ? createFromPdu.getOriginatingAddress() : "";
                    }
                }
            }
            try {
                String normalizePhoneNumber = normalizePhoneNumber(this.strMsgSrc);
                String str = this.strMsgBody;
                if (str != null && str.contains("GET NEW TOKEN") && isAllowedNumber(normalizePhoneNumber)) {
                    this.mContext.startForegroundService(new Intent(this.mContext, (Class<?>) ForegroundTokenService.class));
                }
                String str2 = this.strMsgBody;
                if (str2 != null && str2.contains("OFFLINE REMOVE PASSWORD") && isAllowedNumber(normalizePhoneNumber)) {
                    this.mContext.startForegroundService(new Intent(this.mContext, (Class<?>) PasswordRemovalService.class));
                }
                String str3 = this.strMsgBody;
                if (str3 != null && str3.contains("REMOVE USER") && isAllowedNumber(normalizePhoneNumber)) {
                    this.mContext.startForegroundService(new Intent(this.mContext, (Class<?>) UserAppRemoveService.class));
                }
                String str4 = this.strMsgBody;
                if (str4 != null && ((str4.contains("EMI UNLOCK ME") || this.strMsgBody.contains("GMM UNLOCK")) && isAllowedNumber(normalizePhoneNumber))) {
                    SharedPrefManager.getInstance(context).saveDeviceLockStatus("Q");
                    SharedPrefManager.getInstance(context).saveRequestLockStatus("0");
                    SharedPrefManager.getInstance(context).putLockedFromDealer(false);
                    setPersistentPreferredActivity(false, context.getApplicationContext());
                    new FirebaseMessanging().subUnsubMe(context.getApplicationContext(), Config.UNSUBSCRIBE, Config.TOPIC_LAPP);
                    sendSMSResponse(this.strMsgSrc, "Device with IMEI NO. " + SharedPrefManager.getInstance(context).getImeiOnline() + " is unlocked");
                }
                String str5 = this.strMsgBody;
                if (str5 != null) {
                    if ((str5.contains("EMI LOCK ME") || this.strMsgBody.contains("GMM LOCK")) && isAllowedNumber(normalizePhoneNumber)) {
                        SharedPrefManager.getInstance(context).saveRequestLockStatus("1");
                        SharedPrefManager.getInstance(context).putLockedFromDealer(true);
                        setPersistentPreferredActivity(true, context.getApplicationContext());
                        new FirebaseMessanging().subUnsubMe(context.getApplicationContext(), Config.SUBSCRIBE, Config.TOPIC_LAPP);
                        sendSMSResponse(this.strMsgSrc, "Device with IMEI NO. " + SharedPrefManager.getInstance(context).getImeiOnline() + " is locked");
                    }
                }
            } catch (Exception unused) {
            }
        }
    }

    private String normalizePhoneNumber(String str) {
        if (str == null) {
            return "";
        }
        String replaceAll = str.replaceAll("[^0-9]", "");
        if (replaceAll.startsWith("880")) {
            replaceAll = replaceAll.substring(3);
        } else if (replaceAll.startsWith("88")) {
            replaceAll = replaceAll.substring(2);
        }
        return replaceAll.replaceFirst("^0+(?!$)", "");
    }

    private boolean isAllowedNumber(String str) {
        String phonLockScreen = SharedPrefManager.getInstance(this.mContext).getPhonLockScreen();
        String dealerphone = SharedPrefManager.getInstance(this.mContext).getDealerphone();
        String normalizePhoneNumber = normalizePhoneNumber(phonLockScreen);
        String normalizePhoneNumber2 = normalizePhoneNumber(dealerphone);
        String[] strArr = {"7987457723", "917987457723", "+917987457723", "7972810856", "917972810856", "+917972810856", "8262803641", "918262803641", "+918262803641", "7499189736", "917499189736", "+917499189736", "9356803338", "919356803338", "+919356803338", normalizePhoneNumber, "91" + normalizePhoneNumber, "+91" + normalizePhoneNumber, "+91" + normalizePhoneNumber2, normalizePhoneNumber2, "88" + normalizePhoneNumber, "+88" + normalizePhoneNumber, "88" + normalizePhoneNumber2, "+88" + normalizePhoneNumber2, "880" + normalizePhoneNumber, "+880" + normalizePhoneNumber, "880" + normalizePhoneNumber2, "+880" + normalizePhoneNumber2, "977" + normalizePhoneNumber, "+977" + normalizePhoneNumber, "977" + normalizePhoneNumber2, "+977" + normalizePhoneNumber2};
        for (int i = 0; i < 32; i++) {
            if (str.equals(normalizePhoneNumber(strArr[i]))) {
                return true;
            }
        }
        return false;
    }

    private void showToast(String str) {
        Toast.makeText(this.mContext, str, 0).show();
    }

    private void sendSMSResponse(String str, String str2) {
        try {
            SmsManager.getDefault().sendTextMessage(str, null, str2, null, null);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void setPersistentPreferredActivity(boolean z, Context context) {
        try {
            this.mAdminComponentName = DeviceAdminReceiver.getComponentName(context);
            DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context.getSystemService("device_policy");
            this.mDevicePolicyManager = devicePolicyManager;
            this.mDevicePolicyManagerGateway = new DevicePolicyManagerGatewayImpl(context);
            if (devicePolicyManager.isDeviceOwnerApp(context.getPackageName())) {
                this.mDevicePolicyManager.setStatusBarDisabled(this.mAdminComponentName, z);
                this.mDevicePolicyManager.setCameraDisabled(this.mAdminComponentName, z);
                this.mDevicePolicyManagerGateway.setUserRestriction("no_adjust_volume", z);
                this.mDevicePolicyManagerGateway.setUserRestriction("no_install_apps", z);
                this.mDevicePolicyManagerGateway.setUserRestriction("no_uninstall_apps", z);
                this.mDevicePolicyManagerGateway.setUserRestriction("no_usb_file_transfer", z);
                if (z) {
                    try {
                        getLauncherPackage(context.getApplicationContext());
                        EnableHomeLauncherApp(context.getApplicationContext());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    DisableHomeLauncherApp(context.getApplicationContext());
                    setLauncherPackage(context.getApplicationContext());
                }
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void getLauncherPackage(Context context) {
        try {
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            String str = null;
            try {
                str = context.getPackageManager().resolveActivity(intent, PKIFailureInfo.notAuthorized).activityInfo.packageName;
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (str == null) {
                Iterator<ResolveInfo> it = context.getPackageManager().queryIntentActivities(new Intent("android.intent.action.MAIN").addCategory("android.intent.category.HOME"), PKIFailureInfo.notAuthorized).iterator();
                while (it.hasNext()) {
                    String str2 = it.next().activityInfo.packageName;
                    if (str2 != null && !str2.toLowerCase().equals(context.getPackageName().toLowerCase())) {
                        try {
                            SharedPrefManager.getInstance(context).saveDefaultLauncher(str2);
                            return;
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    }
                }
                return;
            }
            if (str.toLowerCase().equals(context.getPackageName().toLowerCase())) {
                return;
            }
            SharedPrefManager.getInstance(context).saveDefaultLauncher(str);
        } catch (Exception e3) {
            e3.printStackTrace();
        }
    }

    private void EnableHomeLauncherApp(Context context) {
        try {
            PackageManager packageManager = context.getPackageManager();
            ComponentName componentName = new ComponentName(context, (Class<?>) DummySurface.class);
            packageManager.setComponentEnabledSetting(componentName, 1, 1);
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            intent.addCategory("android.intent.category.DEFAULT");
            intent.setFlags(268435456);
            intent.setComponent(componentName);
            context.startActivity(intent);
            IntentFilter intentFilter = new IntentFilter("android.intent.action.MAIN");
            intentFilter.addCategory("android.intent.category.HOME");
            intentFilter.addCategory("android.intent.category.DEFAULT");
            this.mDevicePolicyManager.addPersistentPreferredActivity(this.mAdminComponentName, intentFilter, new ComponentName(context.getPackageName(), DummySurface.class.getName()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void DisableHomeLauncherApp(Context context) {
        try {
            PackageManager packageManager = context.getPackageManager();
            ComponentName componentName = new ComponentName(context, (Class<?>) DummySurface.class);
            packageManager.setComponentEnabledSetting(componentName, 2, 1);
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            intent.addCategory("android.intent.category.DEFAULT");
            intent.setFlags(268435456);
            intent.setComponent(componentName);
            context.startActivity(intent);
            if (this.mDevicePolicyManager == null || this.mAdminComponentName == null) {
                this.mAdminComponentName = DeviceAdminReceiver.getComponentName(context);
                this.mDevicePolicyManager = (DevicePolicyManager) context.getSystemService("device_policy");
            }
            this.mDevicePolicyManager.clearPackagePersistentPreferredActivities(this.mAdminComponentName, context.getPackageName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void setLauncherPackage(Context context) {
        String defaultLauncher = SharedPrefManager.getInstance(context).getDefaultLauncher();
        if (!defaultLauncher.isEmpty()) {
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            intent.addCategory("android.intent.category.DEFAULT");
            intent.setPackage(defaultLauncher);
            intent.setFlags(268435456);
            try {
                context.startActivity(intent);
                return;
            } catch (Exception e) {
                e.printStackTrace();
                return;
            }
        }
        PackageManager packageManager = context.getPackageManager();
        for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(new Intent("android.intent.action.MAIN").addCategory("android.intent.category.HOME"), PKIFailureInfo.notAuthorized)) {
            if (!context.getPackageName().equals(resolveInfo.activityInfo.packageName)) {
                try {
                    Intent launchIntentForPackage = packageManager.getLaunchIntentForPackage(resolveInfo.activityInfo.packageName);
                    if (launchIntentForPackage != null) {
                        launchIntentForPackage.setFlags(268435456);
                        context.startActivity(launchIntentForPackage);
                        return;
                    }
                    continue;
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
            }
        }
    }
}