导航菜单

页面标题

页面副标题

Fancy Optimizer v4.6.3 - a.java 源代码

正在查看: Fancy Optimizer v4.6.3 应用的 a.java JAVA 源代码文件

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


package cm;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.Signature;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.security.MessageDigest;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import kotlin.jvm.internal.s;
import org.json.JSONException;
import org.json.JSONObject;

public final class a {
    public static String k;
    public static final HashMap l;
    public final Context a;
    public final com.trustlook.sdk.data.e b;
    public String c;
    public final int d;
    public final int e;
    public hk.a h;
    public int f = 0;
    public int g = 0;
    public Boolean i = Boolean.FALSE;
    public final b j = new b(Looper.getMainLooper());

    public static class C0004a {
        public final Context a;
        public com.trustlook.sdk.data.e b;
        public int c = 10000;
        public int d = 10000;

        public C0004a(Context context) {
            this.a = context.getApplicationContext();
            a.k = context.getClass().getSimpleName();
        }
    }

    public class b extends Handler {
        public b(Looper looper) {
            super(looper);
        }

        @Override
        public final void handleMessage(Message message) {
            hk.a aVar;
            int i = message.what;
            a aVar2 = a.this;
            if (i == 1) {
                hk.a aVar3 = aVar2.h;
                if (aVar3 != null) {
                    aVar3.v();
                    return;
                }
                return;
            }
            if (i == 7) {
                if (!aVar2.i.booleanValue() || (aVar = aVar2.h) == null) {
                    return;
                }
                aVar.r();
                aVar2.h = null;
                return;
            }
            if (i == 3) {
                int i2 = aVar2.g + 1;
                aVar2.g = i2;
                int i3 = aVar2.f;
                com.trustlook.sdk.data.b bVar = (com.trustlook.sdk.data.b) message.obj;
                if (aVar2.h == null || aVar2.i.booleanValue()) {
                    return;
                }
                aVar2.h.u(i2, i3, bVar);
                return;
            }
            if (i != 4) {
                if (i != 5) {
                    return;
                }
                List list = (List) message.obj;
                if (aVar2.h != null && !aVar2.i.booleanValue()) {
                    aVar2.h.t(list);
                }
                aVar2.h = null;
                return;
            }
            Object obj = message.obj;
            if (obj instanceof Integer) {
                int intValue = ((Integer) obj).intValue();
                hk.a aVar4 = aVar2.h;
                if (aVar4 != null) {
                    aVar4.s(intValue, "");
                }
                aVar2.h = null;
                return;
            }
            String obj2 = obj.toString();
            hk.a aVar5 = aVar2.h;
            if (aVar5 != null) {
                aVar5.s(0, obj2);
            }
            aVar2.h = null;
        }
    }

    static {
        HashMap hashMap = new HashMap();
        l = hashMap;
        hashMap.put(com.trustlook.sdk.data.e.INTL, "https://sla-intl.trustlook.com/");
        hashMap.put(com.trustlook.sdk.data.e.CHN, "https://api.luweitech.com/");
        hashMap.put(com.trustlook.sdk.data.e.BAIDU, "http://queryapi-1431840856.bceapp.com/");
    }

    public a(C0004a c0004a) {
        int i = 0;
        Context context = c0004a.a;
        this.a = context;
        com.trustlook.sdk.data.e eVar = c0004a.b;
        this.b = eVar;
        this.c = (String) l.get(eVar);
        this.d = c0004a.c;
        this.e = c0004a.d;
        Long valueOf = Long.valueOf(context.getSharedPreferences("trustlook_cloudscan_sdk_shared_pref", 0).getLong("key_expire", 0L));
        SharedPreferences.Editor edit = context.getSharedPreferences("trustlook_cloudscan_sdk_shared_pref", 0).edit();
        edit.clear();
        edit.commit();
        long longValue = valueOf.longValue();
        SharedPreferences.Editor edit2 = context.getSharedPreferences("trustlook_cloudscan_sdk_shared_pref", 0).edit();
        edit2.putLong("key_expire", longValue);
        edit2.commit();
        com.trustlook.sdk.data.e eVar2 = c0004a.b;
        if (com.trustlook.sdk.data.e.CHN == eVar2) {
            i = 1;
        } else if (com.trustlook.sdk.data.e.BAIDU == eVar2) {
            i = 2;
        }
        com.trustlook.sdk.data.c.b(context, i, "client_region");
        com.trustlook.sdk.data.c.b(context, c0004a.c, "client_connection_timeout");
        com.trustlook.sdk.data.c.b(context, c0004a.d, "client_socket_timeout");
    }

    public static int a(Exception exc) {
        int i = 2;
        if (exc instanceof h) {
            StringBuilder c = dg.e.c("========== HTTP_REQUEST_EXCEPTION: ");
            int i2 = ((h) exc).c;
            c.append(i2);
            c.append(" ========");
            Log.e("TL", c.toString());
            if (i2 == 403) {
                i = 8;
            } else if (i2 != 406) {
                i = (i2 == 504 || i2 == 502) ? 9 : i2;
            }
            j4.b.h(exc, dg.e.c("handleExceptions HttpRequestException: "));
            return i;
        }
        if (exc instanceof JSONException) {
            Log.e("TL", "========== JSON_EXCEPTION ========");
            StringBuilder sb = new StringBuilder();
            sb.append("handleExceptions JSON_EXCEPTION: ");
            j4.b.h(exc, sb);
            return 4;
        }
        if (exc instanceof UnknownHostException) {
            Log.e("TL", "========== NO NETWORK ========");
            StringBuilder sb2 = new StringBuilder();
            sb2.append("handleExceptions NO_NETWORK: ");
            j4.b.h(exc, sb2);
            return 6;
        }
        if (exc instanceof SocketTimeoutException) {
            Log.e("TL", "========== SOCKET TIMEOUT EXCEPTION ========");
            StringBuilder sb3 = new StringBuilder();
            sb3.append("handleExceptions SOCKET_TIMEOUT_EXCEPTION: ");
            j4.b.h(exc, sb3);
            return 7;
        }
        if (exc instanceof i) {
            Log.e("TL", "========== INVALID INPUT EXCEPTION ========");
            StringBuilder sb4 = new StringBuilder();
            sb4.append("handleExceptions INVALID_INPUT: ");
            j4.b.h(exc, sb4);
            return 2;
        }
        if (exc instanceof IOException) {
            Log.e("TL", "========== IO EXCEPTION ========");
            exc.printStackTrace();
            StringBuilder sb5 = new StringBuilder();
            sb5.append("handleExceptions IO_EXCEPTION: ");
            j4.b.h(exc, sb5);
            return 5;
        }
        Log.e("TL", "========== UNKNOWN ERROR ========");
        exc.printStackTrace();
        StringBuilder sb6 = new StringBuilder();
        sb6.append("handleExceptions UNKNOWN_ERROR: ");
        j4.b.h(exc, sb6);
        return 0;
    }

    public static void d(com.trustlook.sdk.data.b bVar) {
        String str;
        byte[] bytes = d.B().toUpperCase().getBytes();
        byte[] bArr = new byte[524288];
        if (bVar.g > 7 || (str = bVar.d) == null || str.isEmpty()) {
            return;
        }
        try {
            FileInputStream fileInputStream = new FileInputStream(bVar.d);
            int i = 0;
            while (true) {
                if (fileInputStream.read(bArr) == -1 || i >= 1) {
                    break;
                }
                i++;
                if (j4.b.E(bArr, bytes) > -1) {
                    bVar.g = 8;
                    bVar.j = "EICAR-Test-File (not a virus)";
                    break;
                }
            }
            fileInputStream.close();
        } catch (IOException e) {
            e.getMessage();
        }
    }

    public static ArrayList f(a aVar, ArrayList arrayList) {
        aVar.getClass();
        ArrayList arrayList2 = new ArrayList();
        String upperCase = d.B().toUpperCase();
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            String str = (String) it.next();
            boolean z = false;
            if (aVar.i.booleanValue()) {
                aVar.c(7, 0);
                return null;
            }
            String str2 = "";
            com.trustlook.sdk.data.b bVar = new com.trustlook.sdk.data.b("", "");
            bVar.d = str;
            try {
                if (new File(str).length() <= 500) {
                    byte[] bytes = upperCase.getBytes();
                    byte[] bArr = new byte[524288];
                    FileInputStream fileInputStream = new FileInputStream(str);
                    int i = 0;
                    while (fileInputStream.read(bArr) != -1 && i < 1) {
                        i++;
                        if (j4.b.E(bArr, bytes) > -1) {
                            fileInputStream.close();
                            z = true;
                            break;
                        }
                    }
                    fileInputStream.close();
                }
            } catch (IOException e) {
                e.getMessage();
            }
            if (z) {
                File file = new File(str);
                try {
                    str2 = em.a.a(file);
                } catch (Exception e2) {
                    e2.getStackTrace();
                    Log.e("TL", "Failed to calculate md5 for " + file.getAbsolutePath());
                }
                bVar.g = 8;
                bVar.c = str2;
                bVar.j = "EICAR-Test-File (not a virus)";
                arrayList2.add(bVar);
            }
            aVar.c(3, bVar);
        }
        return arrayList2;
    }

    public final String b() {
        Context context = this.a;
        try {
            CertificateFactory certificateFactory = CertificateFactory.getInstance("X509");
            Signature[] signatureArr = context.getPackageManager().getPackageInfo(context.getPackageName(), 64).signatures;
            if (signatureArr.length > 0) {
                ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(signatureArr[0].toByteArray());
                X509Certificate x509Certificate = (X509Certificate) certificateFactory.generateCertificate(byteArrayInputStream);
                x509Certificate.getIssuerDN().toString();
                long time = x509Certificate.getNotBefore().getTime() / 1000;
                long time2 = x509Certificate.getNotAfter().getTime() / 1000;
                x509Certificate.getSerialNumber().toString(16);
                MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
                messageDigest.update(x509Certificate.getEncoded());
                byte[] digest = messageDigest.digest();
                byteArrayInputStream.close();
                return f.a(digest);
            }
        } catch (Exception unused) {
        }
        return null;
    }

    public final void c(int i, Object obj) {
        Message message = new Message();
        message.what = i;
        message.obj = obj;
        this.j.sendMessage(message);
    }

    public final void e(JSONObject jSONObject) throws JSONException {
        JSONObject jSONObject2 = new JSONObject();
        Context context = this.a;
        if (context != null) {
            try {
                Objects.toString(context.getResources().getConfiguration().locale);
                Locale locale = context.getResources().getConfiguration().locale;
                if (locale != null) {
                    jSONObject2.put("lc", locale.toString().toLowerCase());
                } else {
                    jSONObject2.put("lc", Locale.US.toString().toLowerCase());
                }
            } catch (JSONException unused) {
            }
        }
        String str = Build.MODEL;
        if (str != null) {
            jSONObject2.put("mod", str);
        }
        String str2 = Build.VERSION.RELEASE;
        if (str2 != null) {
            jSONObject2.put("os", str2);
        }
        String str3 = Build.VERSION.SECURITY_PATCH;
        if (str3 != null) {
            jSONObject2.put("pat", str3);
        }
        if (d.C() != null) {
            jSONObject2.put("di", d.C());
        }
        jSONObject.put("info", jSONObject2);
    }

    public final void g(JSONObject jSONObject) throws JSONException {
        com.trustlook.sdk.data.f fVar;
        String str;
        Context context = this.a;
        String a = com.trustlook.sdk.data.c.a(context, "extra_info_field", "");
        if (s.r(a)) {
            return;
        }
        String[] split = a.split(",");
        ?? arrayList = new ArrayList();
        if (context.getSharedPreferences("trustlook_cloudscan_sdk_shared_pref", 0).getBoolean("extra_info_sent", false)) {
            for (String str2 : split) {
                if (str2.equals("longitude") || str2.equals("latitude")) {
                    arrayList.add(str2);
                }
            }
        } else {
            arrayList = Arrays.asList(split);
        }
        ArrayList arrayList2 = new ArrayList();
        for (String str3 : arrayList) {
            str3.getClass();
            if (str3.equals("device_id")) {
                fVar = new com.trustlook.sdk.data.f();
                fVar.b = d.C();
            } else {
                fVar = null;
            }
            if (fVar != null && (str = fVar.b) != null && !str.isEmpty()) {
                arrayList2.add(fVar);
            }
        }
        if (arrayList2.size() >= 1) {
            JSONObject jSONObject2 = new JSONObject();
            Iterator it = arrayList2.iterator();
            while (it.hasNext()) {
                com.trustlook.sdk.data.f fVar2 = (com.trustlook.sdk.data.f) it.next();
                jSONObject2.put(fVar2.a, fVar2.b);
            }
            jSONObject.put("exif", jSONObject2);
            jSONObject.getString("exif");
        }
    }

    public final void h(JSONObject jSONObject) throws JSONException {
        String str;
        jSONObject.put("sv", "5.0.5.20230614");
        Context context = this.a;
        jSONObject.put("hpn", context.getPackageName());
        String b2 = b();
        if (b2 != null) {
            jSONObject.put("hcs1", b2);
        }
        jSONObject.put("ha", k);
        Integer num = null;
        try {
            str = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
        } catch (Exception unused) {
            str = null;
        }
        if (str != null) {
            jSONObject.put("hvn", str);
        }
        try {
            num = Integer.valueOf(context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode);
        } catch (Exception unused2) {
        }
        if (num != null) {
            jSONObject.put("hvc", num.toString());
        }
    }
}