atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9
以下内容为反编译后的 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 h = !u.class.desiredAssertionStatus();
private String a;
Queue<String> b;
private Integer c;
private Integer d;
private String e;
private boolean f;
private boolean g;
public interface a<RequestResultType> extends NetworkRequest.c<RequestResultType, LoadingError> {
}
public interface b<RequestResultType> extends NetworkRequest.Callback<RequestResultType, LoadingError> {
}
static abstract class c<RequestDataType, RequestResultType> extends NetworkRequest.h<RequestDataType, RequestResultType, LoadingError> {
private final m<?, ?, ?> a;
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.a = mVar;
}
@Override
protected byte[] a(NetworkRequest<RequestDataType, RequestResultType, LoadingError> networkRequest, URLConnection uRLConnection, RequestDataType requestdatatype) {
try {
return l1.a(r1.e, m1.a, this.a, 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 u0 a;
public d(u0 u0Var) {
this.a = u0Var;
}
@Override
protected byte[] a(NetworkRequest networkRequest, URLConnection uRLConnection, JSONObject jSONObject) throws Exception {
return a2((NetworkRequest<JSONObject, JSONObject, LoadingError>) networkRequest, uRLConnection, jSONObject);
}
@Override
public byte[] a2(NetworkRequest<JSONObject, JSONObject, LoadingError> networkRequest, URLConnection uRLConnection, JSONObject jSONObject) throws Exception {
return super.a((NetworkRequest) networkRequest, uRLConnection, this.a.a());
}
}
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.a = null;
this.b = null;
this.f = false;
this.g = 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.g || TextUtils.isEmpty(url) || url.contains("a.appbaqend.com")) {
return null;
}
String headerField = uRLConnection.getHeaderField("X-Signature");
if (TextUtils.isEmpty(this.e) || TextUtils.isEmpty(headerField)) {
return null;
}
byte[] decode = Base64.decode(headerField, 0);
if (h || this.e != null) {
if (a(this.e.getBytes(), decode)) {
return null;
}
return LoadingError.RequestVerificationFailed;
}
throw new AssertionError();
}
static String a(String str) {
return z1.a(z1.c(str.getBytes()));
}
static Queue<String> a(Date date) {
LinkedList linkedList = new LinkedList(a0.a());
Locale locale = Locale.ENGLISH;
String format = new SimpleDateFormat("yyyy", locale).format(date);
String format2 = new SimpleDateFormat("yyyyMM", locale).format(date);
String format3 = new SimpleDateFormat("yyyyMMww", locale).format(date);
linkedList.add(String.format("https://a.%s.com", a(format)));
linkedList.add(String.format("https://a.%s.com", a(format2)));
linkedList.add(String.format("https://a.%s.com", a(format3)));
return linkedList;
}
@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.c = num;
this.d = num2;
}
public void a(boolean z) {
this.f = 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(String str) {
this.a = str;
}
public void b(boolean z) {
this.g = z;
}
@Override
public void beforeExecuteRequest(URLConnection uRLConnection) {
super.beforeExecuteRequest(uRLConnection);
this.e = UUID.randomUUID().toString();
String url = uRLConnection.getURL().toString();
if (!this.g || TextUtils.isEmpty(url) || url.contains("a.appbaqend.com")) {
return;
}
uRLConnection.setRequestProperty("X-Request-ID", this.e);
}
@Override
public String buildUrl(String str, String str2) {
String str3 = this.a;
return str3 != null ? str3 : super.buildUrl(str, str2);
}
@Override
public String getBaseUrl() throws Exception {
String str = this.a;
if (str != null) {
return str;
}
String str2 = a0.a;
return str2 == null ? g0.b() : str2;
}
@Override
public NetworkRequest.g getRetryParams(NetworkRequest.g gVar) {
if (this.f) {
if (this.a != null) {
return null;
}
if (this.b == null) {
this.b = a(new Date());
}
if (this.b.isEmpty()) {
return null;
}
return new NetworkRequest.g(buildUrl(this.b.poll(), getPath()));
}
return super.getRetryParams(gVar);
}
@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.c;
uRLConnection.setConnectTimeout(num != null ? num.intValue() : 20000);
Integer num2 = this.d;
uRLConnection.setReadTimeout(num2 != null ? num2.intValue() : 20000);
}
}