导航菜单

页面标题

页面副标题

Credmex v3.12.2 - AutoFillSmsService.java 源代码

正在查看: Credmex v3.12.2 应用的 AutoFillSmsService.java JAVA 源代码文件

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


package com.credmex.services;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import android.provider.Telephony;
import android.telephony.SmsMessage;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import androidx.core.app.s4;
import com.credmex.models.event.SmsCodeEvent;
import com.sensorsdata.analytics.android.sdk.aop.push.PushAutoTrackHelper;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.greenrobot.eventbus.EventBus;

public class AutoFillSmsService extends Service {
    private int a;

    private String a(String str) {
        Matcher matcher = Pattern.compile(": \\d{6}").matcher(str);
        if (matcher.find()) {
            String group = matcher.group(0);
            if (!TextUtils.isEmpty(group)) {
                return group.replace(": ", "");
            }
        }
        return "";
    }

    private void b(Intent intent) {
        if (Build.VERSION.SDK_INT < 26) {
            return;
        }
        for (SmsMessage smsMessage : Telephony.Sms.Intents.getMessagesFromIntent(intent)) {
            String displayMessageBody = smsMessage.getDisplayMessageBody();
            if (!TextUtils.isEmpty(displayMessageBody)) {
                try {
                    EventBus.c().k(new SmsCodeEvent(a(displayMessageBody)));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }

    @Override
    @Nullable
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        if (Build.VERSION.SDK_INT >= 26) {
            s4.a((NotificationManager) getSystemService("notification"), new NotificationChannel("ph_auto_fill_sms_channel", "Auto Fill Sms Notification", 3));
            Notification build = new NotificationCompat.Builder(this, "ph_auto_fill_sms_channel").setContentTitle("").setContentText("").build();
            int b = NotificationIdManager.b(this);
            this.a = b;
            startForeground(b, build);
        }
    }

    @Override
    public void onStart(Intent intent, int i2) {
        PushAutoTrackHelper.onServiceStart(this, intent, i2);
        super.onStart(intent, i2);
        b(intent);
        NotificationIdManager.a(this, Integer.valueOf(this.a));
        stopSelf();
    }
}