GoooBet v1.0版本的 MD5 值为:ff9748f16167bfd7735b669c0a9931c5

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


package com.appodeal.ads;

import android.text.TextUtils;
import android.util.Base64;
import com.appodeal.ads.NetworkRequest;
import com.appodeal.ads.utils.Log;
import java.io.InputStream;
import java.net.SocketTimeoutException;
import java.net.URLConnection;
import java.net.UnknownHostException;
import java.security.KeyFactory;
import java.security.PublicKey;
import java.security.Signature;
import java.security.spec.X509EncodedKeySpec;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Queue;
import java.util.UUID;
import org.apache.http.conn.ConnectTimeoutException;
import org.json.JSONObject;

public class u<RequestDataType, RequestResultType> extends NetworkRequest<RequestDataType, RequestResultType, LoadingError> {
    static final boolean b = !u.class.desiredAssertionStatus();

    Queue<String> f1239a;
    private String c;
    private Integer d;
    private Integer e;
    private String f;
    private boolean g;
    private boolean h;

    public interface a<RequestResultType> extends NetworkRequest.b<RequestResultType, LoadingError> {
    }

    public interface b<RequestResultType> extends NetworkRequest.Callback<RequestResultType, LoadingError> {
    }

    static abstract class c<RequestDataType, RequestResultType> extends NetworkRequest.g<RequestDataType, RequestResultType, LoadingError> {

        private final m<?, ?, ?> f1240a;
        private final j<?> b;
        private final f<?, ?, ?, ?> c;

        public c(m<?, ?, ?> mVar, j<?> jVar, f<?, ?, ?, ?> fVar) {
            super("com.appodeal.ads.Request");
            this.b = jVar;
            this.c = fVar;
            this.f1240a = mVar;
        }

        @Override
        protected RequestResultType a(NetworkRequest<RequestDataType, RequestResultType, LoadingError> networkRequest, URLConnection uRLConnection, byte[] bArr) throws Exception {
            return null;
        }

        @Override
        protected byte[] a(NetworkRequest<RequestDataType, RequestResultType, LoadingError> networkRequest, URLConnection uRLConnection, RequestDataType requestdatatype) {
            try {
                return bi.a(bo.e, bj.f1115a, this.f1240a, this.b, this.c).build().toByteArray();
            } catch (Exception e) {
                throw new IllegalArgumentException("Unknown exception: " + e.getMessage());
            }
        }
    }

    public static class d extends NetworkRequest.SimpleJsonObjectDataBinder<LoadingError> {

        private final ar f1241a;

        public d(ar arVar) {
            this.f1241a = arVar;
        }

        @Override
        protected byte[] a(NetworkRequest networkRequest, URLConnection uRLConnection, JSONObject jSONObject) throws Exception {
            return a((NetworkRequest<JSONObject, JSONObject, LoadingError>) networkRequest, uRLConnection, jSONObject);
        }

        @Override
        public byte[] a(NetworkRequest<JSONObject, JSONObject, LoadingError> networkRequest, URLConnection uRLConnection, JSONObject jSONObject) throws Exception {
            return super.a((NetworkRequest) networkRequest, uRLConnection, this.f1241a.d());
        }
    }

    public u(String str, NetworkRequest.Method method) {
        this(str, method, null);
    }

    public u(String str, NetworkRequest.Method method, RequestDataType requestdatatype) {
        super(str, method, requestdatatype);
        this.c = null;
        this.f1239a = null;
        this.g = false;
        this.h = false;
        addContentEncoder(new NetworkRequest.GZIPRequestDataEncoder());
    }

    private LoadingError a(int i) {
        return (i < 200 || i >= 300) ? (i < 400 || i >= 500) ? (i < 500 || i >= 600) ? LoadingError.InternalError : LoadingError.ServerError : LoadingError.RequestError : LoadingError.NoFill;
    }

    private LoadingError a(URLConnection uRLConnection) {
        String url = uRLConnection.getURL().toString();
        if (!this.h || TextUtils.isEmpty(url) || url.contains("a.appbaqend.com")) {
            return null;
        }
        String headerField = uRLConnection.getHeaderField("X-Signature");
        if (TextUtils.isEmpty(this.f) || TextUtils.isEmpty(headerField)) {
            return null;
        }
        byte[] decode = Base64.decode(headerField, 0);
        if (!b && this.f == null) {
            throw new AssertionError();
        }
        if (a(this.f.getBytes(), decode)) {
            return null;
        }
        return LoadingError.RequestVerificationFailed;
    }

    static Queue<String> a(Date date) {
        LinkedList linkedList = new LinkedList(aa.e());
        String format = new SimpleDateFormat("yyyy", Locale.ENGLISH).format(date);
        String format2 = new SimpleDateFormat("yyyyMM", Locale.ENGLISH).format(date);
        String format3 = new SimpleDateFormat("yyyyMMww", Locale.ENGLISH).format(date);
        linkedList.add(String.format("https://a.%s.com", b(format)));
        linkedList.add(String.format("https://a.%s.com", b(format2)));
        linkedList.add(String.format("https://a.%s.com", b(format3)));
        return linkedList;
    }

    static String b(String str) {
        return bw.c(bw.b(str.getBytes()));
    }

    @Override
    public LoadingError isSuccess(URLConnection uRLConnection, int i) throws Exception {
        return i == 200 ? a(uRLConnection) : (LoadingError) super.isSuccess(uRLConnection, i);
    }

    @Override
    public LoadingError obtainError(URLConnection uRLConnection, InputStream inputStream, int i) {
        return a(i);
    }

    @Override
    public LoadingError obtainError(URLConnection uRLConnection, Exception exc) {
        return exc instanceof UnknownHostException ? LoadingError.ConnectionError : ((exc instanceof SocketTimeoutException) || (exc instanceof ConnectTimeoutException)) ? LoadingError.TimeoutError : LoadingError.InternalError;
    }

    protected LoadingError a(URLConnection uRLConnection, RequestResultType requestresulttype, int i) {
        return a(i);
    }

    public void a(Integer num, Integer num2) {
        this.d = num;
        this.e = num2;
    }

    public void a(String str) {
        this.c = str;
    }

    public void a(boolean z) {
        this.g = z;
    }

    boolean a(byte[] bArr, byte[] bArr2) {
        try {
            PublicKey generatePublic = KeyFactory.getInstance("EC").generatePublic(new X509EncodedKeySpec(Base64.decode("MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAENIBD8zVGWMJWVFPJ9aQkyZS+ahKDB9xbQZeXIb7keGfUEMdOaOxWd+nTa2HbkeHi0PNfdGHAyCE4mycvIPwStw==".getBytes(), 0)));
            Signature signature = Signature.getInstance("SHA256withECDSA");
            signature.initVerify(generatePublic);
            signature.update(bArr);
            return signature.verify(bArr2);
        } catch (Exception e) {
            Log.log(e);
            return false;
        }
    }

    public void b(boolean z) {
        this.h = z;
    }

    @Override
    public void beforeExecuteRequest(URLConnection uRLConnection) {
        super.beforeExecuteRequest(uRLConnection);
        this.f = UUID.randomUUID().toString();
        String url = uRLConnection.getURL().toString();
        if (!this.h || TextUtils.isEmpty(url) || url.contains("a.appbaqend.com")) {
            return;
        }
        uRLConnection.setRequestProperty("X-Request-ID", this.f);
    }

    @Override
    public String buildUrl(String str, String str2) {
        String str3 = this.c;
        return str3 != null ? str3 : super.buildUrl(str, str2);
    }

    @Override
    public String getBaseUrl() throws Exception {
        String str = this.c;
        return str != null ? str : aa.f1034a == null ? ag.a() : aa.f1034a;
    }

    @Override
    public NetworkRequest.f getRetryParams(NetworkRequest.f fVar) {
        if (!this.g) {
            return super.getRetryParams(fVar);
        }
        if (this.c != null) {
            return null;
        }
        if (this.f1239a == null) {
            this.f1239a = a(new Date());
        }
        if (this.f1239a.isEmpty()) {
            return null;
        }
        return new NetworkRequest.f(buildUrl(this.f1239a.poll(), getPath()));
    }

    @Override
    protected LoadingError obtainError(URLConnection uRLConnection, Object obj, int i) {
        return a(uRLConnection, (URLConnection) obj, i);
    }

    @Override
    public void prepareRequestParams(URLConnection uRLConnection) {
        super.prepareRequestParams(uRLConnection);
        Integer num = this.d;
        uRLConnection.setConnectTimeout(num != null ? num.intValue() : 20000);
        Integer num2 = this.e;
        uRLConnection.setReadTimeout(num2 != null ? num2.intValue() : 20000);
    }
}