吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1368|回复: 2
收起左侧

[求助] 从某加固软件里面抽取了一个工具类结果得到结果不一样

[复制链接]
027rainguai 发表于 2023-6-21 18:00
本帖最后由 027rainguai 于 2023-6-21 18:01 编辑

String iMei = DeviceInfoUtils.getIMEI(getContext());
                if (!TextUtils.isEmpty(iMei)) {
                    this.iMei = DeviceInfoUtils.getIMEI(getContext());
                } else {
                     this.iMei = "000000000000000";
                }
  String uniqueID = DeviceInfoUtils.getDeviceId(getContext());

  让后把 iMei 和 uniqueID 显示在界面上
某软件里面根据设备码来做授权验证,上面是 uniqueID 获取方法。 提取出来,打包到一个新apk 结果,和原来安装的那个需要破解的apk,获取到的不一致。这是个什么情况。
附上抽取出来的工具类
[Plain Text] 纯文本查看 复制代码

import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import com.bumptech.glide.load.Key;
import java.security.MessageDigest;
import java.util.Locale;
import java.util.UUID;


public class DeviceInfoUtils {
    public static String getDeviceManufacturer() {
        return Build.MANUFACTURER;
    }

    public static String getDeviceProduct() {
        return Build.PRODUCT;
    }

    public static String getDeviceBrand() {
        return Build.BRAND;
    }

    public static String getDeviceModel() {
        return Build.MODEL;
    }

    public static String getDeviceBoard() {
        return Build.BOARD;
    }

    public static String getDeviceDevice() {
        return Build.DEVICE;
    }

    public static String getDeviceFubgerprint() {
        return Build.FINGERPRINT;
    }

    public static String getDeviceHardware() {
        return Build.HARDWARE;
    }

    public static String getDeviceHost() {
        return Build.HOST;
    }

    public static String getDeviceDisplay() {
        return Build.DISPLAY;
    }

    public static String getDeviceId() {
        return Build.ID;
    }

    public static String getDeviceUser() {
        return Build.USER;
    }

    public static String getDeviceSerial() {
        return Build.SERIAL;
    }

    public static int getDeviceSDK() {
        return Build.VERSION.SDK_INT;
    }

    public static String getDeviceAndroidVersion() {
        return Build.VERSION.RELEASE;
    }

    public static String getDeviceDefaultLanguage() {
        return Locale.getDefault().getLanguage();
    }

    public static String getDeviceManufacturers() {
        return Build.MANUFACTURER;
    }

    public static String getDeviceName() {
        return Build.DEVICE;
    }

    public static String getModelName() {
        return Build.MODEL;
    }

    public static double getPingMuSize(Context context) {
        DisplayMetrics displayMetrics = new DisplayMetrics();
        ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
        double sqrt = Math.sqrt(Math.pow(displayMetrics.widthPixels, 2.0d) + Math.pow(displayMetrics.heightPixels, 2.0d));
        double d = displayMetrics.density * 160.0f;
        Double.isNaN(d);
        return sqrt / d;
    }

    public static String getDeviceAllInfo(Context context) {
        return "\n\n1. IMEI:\n\t\t" + getIMEI(context) + "\n\n10. 系统默认语言:\n\t\t" + getDeviceDefaultLanguage() + "\n\n11. 硬件序列号(设备名):\n\t\t" + Build.SERIAL + "\n\n12. 手机型号:\n\t\t" + Build.MODEL + "\n\n13. 生产厂商:\n\t\t" + Build.MANUFACTURER + "\n\n14. 手机Fingerprint标识:\n\t\t" + Build.FINGERPRINT + "\n\n15. Android 版本:\n\t\t" + Build.VERSION.RELEASE + "\n\n16. Android SDK版本:\n\t\t" + Build.VERSION.SDK_INT + "\n\n17. 安全patch 时间:\n\t\t" + Build.VERSION.SECURITY_PATCH + "\n\n19. 版本类型:\n\t\t" + Build.TYPE + "\n\n20. 用户名:\n\t\t" + Build.USER + "\n\n21. 产品名:\n\t\t" + Build.PRODUCT + "\n\n22. ID:\n\t\t" + Build.ID + "\n\n23. 显示ID:\n\t\t" + Build.DISPLAY + "\n\n24. 硬件名:\n\t\t" + Build.HARDWARE + "\n\n25. 产品名:\n\t\t" + Build.DEVICE + "\n\n26. Bootloader:\n\t\t" + Build.BOOTLOADER + "\n\n27. 主板名:\n\t\t" + Build.BOARD + "\n\n28. CodeName:\n\t\t" + Build.VERSION.CODENAME;
    }

    public static String getDeviceId(Context context) {
        StringBuilder sb = new StringBuilder();
        String imei = getIMEI(context);
        String androidId = getAndroidId(context);
        String serial = getSERIAL();
        String replace = getDeviceUUID().replace("-", "");
        if (imei != null && imei.length() > 0) {
            sb.append(imei);
            sb.append("|");
        }
        if (androidId != null && androidId.length() > 0) {
            sb.append(androidId);
            sb.append("|");
        }
        if (serial != null && serial.length() > 0) {
            sb.append(serial);
            sb.append("|");
        }
        if (replace != null && replace.length() > 0) {
            sb.append(replace);
        }
        if (sb.length() > 0) {
            try {
                String bytesToHex = bytesToHex(getHashByString(sb.toString()));
                if (bytesToHex != null) {
                    if (bytesToHex.length() > 0) {
                        return bytesToHex;
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return UUID.randomUUID().toString().replace("-", "");
    }

    public static String getIMEI(Context context) {
        try {
            return ((TelephonyManager) context.getSystemService("phone")).getDeviceId();
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    private static String getAndroidId(Context context) {
        try {
            return Settings.Secure.getString(context.getContentResolver(), "android_id");
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    private static String getSERIAL() {
        try {
            return Build.SERIAL;
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    private static String getDeviceUUID() {
        try {
            return new UUID(("3991986" + (Build.BOARD.length() % 10) + (Build.BRAND.length() % 10) + (Build.DEVICE.length() % 10) + (Build.HARDWARE.length() % 10) + (Build.ID.length() % 10) + (Build.MODEL.length() % 10) + (Build.PRODUCT.length() % 10) + (Build.SERIAL.length() % 10)).hashCode(), Build.SERIAL.hashCode()).toString();
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    private static byte[] getHashByString(String str) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
            messageDigest.reset();
            messageDigest.update(str.getBytes(Key.STRING_CHARSET_NAME));
            return messageDigest.digest();
        } catch (Exception unused) {
            return "".getBytes();
        }
    }

    private static String bytesToHex(byte[] bArr) {
        StringBuilder sb = new StringBuilder();
        for (byte b : bArr) {
            String hexString = Integer.toHexString(b & 255);
            if (hexString.length() == 1) {
                sb.append("0");
            }
            sb.append(hexString);
        }
        return sb.toString().toUpperCase(Locale.CHINA);
    }
}

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

laos 发表于 2023-6-21 20:34
目测是签名不一样, AndroidId变了
无闻无问 发表于 2023-6-22 08:50
如果静态找不到原因,就动态干,两边同时动态调试,一条一条比……
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-24 22:27

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表