Proxy Master v3.4.9版本的 MD5 值为:14d0aa2468d13530c8f6e96bcc114bf5

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


package d5;

import android.text.TextUtils;
import androidx.appcompat.app.y;
import c5.d;
import c5.f;
import com.google.common.net.HttpHeaders;
import f5.c;
import io.appmetrica.analytics.coreutils.internal.StringUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class a {
    public static final a f21556g = new a();
    public static final int f21557h = 3600000;
    public static final int f21558i = 10;
    public final String f21559a = "https://api.gameanalytics.com/v2";
    public final String f21560b = "https://api.gameanalytics.com/remote_configs/v1";
    public final String f21561c = "init";
    public final String f21562d = "events";
    public final boolean f21563e = true;
    public final HashMap<String, b> f21564f = new HashMap<>();

    public class C0167a {
        public int f21565a;
        public JSONObject f21566b;
    }

    public static class b {
        public long f21567a;
        public int f21568b = 0;

        public b(long j10) {
            this.f21567a = j10;
        }
    }

    public static HttpURLConnection a(byte[] bArr, String str, boolean z6) {
        HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
        httpURLConnection.setDoOutput(true);
        httpURLConnection.setDoInput(true);
        httpURLConnection.setRequestMethod("POST");
        httpURLConnection.setRequestProperty(HttpHeaders.CONTENT_LENGTH, String.valueOf(bArr.length));
        if (z6) {
            httpURLConnection.setRequestProperty(HttpHeaders.CONTENT_ENCODING, "gzip");
        }
        httpURLConnection.setRequestProperty(HttpHeaders.AUTHORIZATION, i5.a.b(c.S.H, bArr));
        httpURLConnection.setRequestProperty(HttpHeaders.CONTENT_TYPE, "application/json");
        return httpURLConnection;
    }

    public static int b(HttpURLConnection httpURLConnection, String str) {
        int i10;
        try {
            i10 = httpURLConnection.getResponseCode();
        } catch (IOException | Exception unused) {
            i10 = 0;
        }
        if (str.length() == 0) {
            try {
                httpURLConnection.getResponseMessage();
                return 1;
            } catch (IOException | Exception unused2) {
                return 1;
            }
        } else if (i10 == 200) {
            return 10;
        } else {
            if (i10 == 201) {
                return 11;
            }
            if (i10 == 0 || i10 == 401) {
                return 8;
            }
            if (i10 == 400) {
                return 7;
            }
            return i10 == 500 ? 6 : 9;
        }
    }

    public final C0167a c(ArrayList<JSONObject> arrayList) {
        ?? r12;
        String str;
        int b6;
        JSONObject jSONObject;
        JSONArray jSONArray;
        ?? r122;
        String stringBuffer;
        byte[] bytes;
        arrayList.isEmpty();
        C0167a c0167a = new C0167a();
        String str2 = c.S.G;
        StringBuilder sb2 = new StringBuilder();
        android.support.v4.media.c.w(sb2, this.f21559a, "/", str2, "/");
        sb2.append(this.f21562d);
        String sb3 = sb2.toString();
        String d10 = i5.a.d(arrayList);
        if (d10.length() == 0) {
            c0167a.f21566b = null;
            c0167a.f21565a = 4;
            return c0167a;
        }
        String str3 = "";
        try {
            boolean z6 = this.f21563e;
            try {
                try {
                    if (z6) {
                        bytes = i5.a.a(d10);
                        int length = d10.getBytes("UTF-8").length;
                        int length2 = bytes.length;
                    } else {
                        bytes = d10.getBytes("UTF-8");
                    }
                    r122 = a(bytes, sb3, z6);
                    try {
                        r122.getOutputStream().write(bytes);
                        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(r122.getInputStream()));
                        StringBuffer stringBuffer2 = new StringBuffer();
                        while (true) {
                            String readLine = bufferedReader.readLine();
                            if (readLine == null) {
                                break;
                            }
                            stringBuffer2.append(readLine);
                        }
                        bufferedReader.close();
                        stringBuffer = stringBuffer2.toString();
                        d10 = r122;
                    } catch (IOException unused) {
                        BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(r122.getErrorStream()));
                        StringBuffer stringBuffer3 = new StringBuffer();
                        while (true) {
                            String readLine2 = bufferedReader2.readLine();
                            if (readLine2 == null) {
                                break;
                            }
                            stringBuffer3.append(readLine2);
                        }
                        bufferedReader2.close();
                        stringBuffer = stringBuffer3.toString();
                        d10 = r122;
                        str3 = stringBuffer;
                        str = str3;
                        r12 = d10;
                        b6 = b(r12, str);
                        if (b6 == 10) {
                        }
                        try {
                            jSONObject = new JSONObject(str);
                        } catch (JSONException unused2) {
                            jSONObject = null;
                        }
                        if (jSONObject == null) {
                        }
                        c0167a.f21566b = jSONObject;
                        c0167a.f21565a = b6;
                        return c0167a;
                    }
                } catch (Exception e10) {
                    throw e10;
                }
            } catch (IOException unused3) {
                r122 = 0;
            } catch (Exception unused4) {
                str = "";
                r12 = 0;
            }
            str3 = stringBuffer;
        } catch (IOException | Exception unused5) {
        }
        str = str3;
        r12 = d10;
        b6 = b(r12, str);
        if (b6 == 10 && b6 != 7) {
            r12.getRequestProperty(HttpHeaders.AUTHORIZATION);
            c0167a.f21566b = null;
            c0167a.f21565a = b6;
            return c0167a;
        }
        jSONObject = new JSONObject(str);
        if (jSONObject == null) {
            try {
                jSONArray = new JSONArray(str);
            } catch (JSONException unused6) {
                jSONArray = null;
            }
            if (jSONArray == null) {
                c0167a.f21566b = null;
                c0167a.f21565a = 5;
                a aVar = f21556g;
                c5.c cVar = c5.c.Http;
                c5.b bVar = c5.b.EventsHttp;
                c5.a aVar2 = c5.a.FailHttpJsonDecode;
                c cVar2 = c.S;
                aVar.d(cVar, bVar, aVar2, str, cVar2.G, cVar2.H);
                return c0167a;
            }
        }
        c0167a.f21566b = jSONObject;
        c0167a.f21565a = b6;
        return c0167a;
    }

    public final void d(c5.c cVar, c5.b bVar, c5.a aVar, String str, String str2, String str3) {
        e(cVar, bVar, aVar, d.Undefined, str, str2, str3);
    }

    public final void e(c5.c cVar, c5.b bVar, c5.a aVar, d dVar, String str, String str2, String str3) {
        String str4;
        String str5 = "";
        if (c.S.f22537p) {
            String str6 = bVar.f4644b;
            long currentTimeMillis = System.currentTimeMillis();
            HashMap<String, b> hashMap = this.f21564f;
            boolean z6 = true;
            if (hashMap.containsKey(str6)) {
                b bVar2 = hashMap.get(str6);
                if (bVar2.f21568b >= f21558i) {
                    if (currentTimeMillis - bVar2.f21567a <= f21557h) {
                        return;
                    }
                    bVar2.f21567a = currentTimeMillis;
                    bVar2.f21568b = 0;
                }
                bVar2.f21568b++;
            } else {
                b bVar3 = new b(currentTimeMillis);
                bVar3.f21568b++;
                hashMap.put(str6, bVar3);
            }
            boolean z9 = i5.a.f(str2, "^[A-z0-9]{32}$") && i5.a.f(str3, "^[A-z0-9]{40}$");
            String str7 = bVar.f4644b;
            if ((!z9 || cVar.f4650b.length() == 0 || str7.length() == 0 || aVar.f4630b.length() == 0) ? false : false) {
                StringBuilder sb2 = new StringBuilder();
                android.support.v4.media.c.w(sb2, this.f21559a, "/", str2, "/");
                sb2.append(this.f21562d);
                String sb3 = sb2.toString();
                try {
                    JSONObject g10 = c.g();
                    String str8 = cVar.f4650b;
                    g10.put("error_category", str8);
                    String str9 = "" + str8;
                    try {
                        g10.put("error_area", str7);
                        str4 = str9 + StringUtils.PROCESS_POSTFIX_DELIMITER + str7;
                        g10.put("error_action", aVar.f4630b);
                        StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
                        g10.put("function_name", stackTrace[4].getMethodName());
                        g10.put("line_number", stackTrace[4].getLineNumber());
                        StringBuilder sb4 = new StringBuilder();
                        for (int i10 = 4; i10 < stackTrace.length; i10++) {
                            sb4.append(stackTrace[i10].toString() + "\n");
                        }
                        if (sb4.length() > 4096) {
                            sb4.setLength(4096);
                        }
                        g10.put("stacktrace", sb4.toString());
                        String str10 = dVar.f4656b;
                        if (!TextUtils.isEmpty(str10)) {
                            g10.put("error_parameter", str10);
                        }
                        if (!TextUtils.isEmpty(str)) {
                            g10.put("reason", str.length() > 256 ? str.substring(0, 256) : str);
                        }
                        ArrayList arrayList = new ArrayList();
                        arrayList.add(g10);
                        str5 = i5.a.d(arrayList);
                    } catch (JSONException e10) {
                        e = e10;
                        e.printStackTrace();
                        if (TextUtils.isEmpty(str5)) {
                        }
                    }
                } catch (JSONException e11) {
                    e = e11;
                    str4 = "";
                }
                if (TextUtils.isEmpty(str5)) {
                    try {
                        i5.b.f23353a.execute(new y(6, new f(sb3, str4, str3, str5.getBytes("UTF-8")), null));
                    } catch (UnsupportedEncodingException e12) {
                        e12.printStackTrace();
                    }
                }
            }
        }
    }
}