Fast Orange v3.5.3版本的 MD5 值为:33b91aba50c566533dfd683a85f79158
以下内容为反编译后的 a21.java 源代码,内容仅作参考
package com.free.vpn.proxy.hotspot;
import android.content.Context;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.util.JsonReader;
import android.util.Log;
import com.google.android.gms.appindex.ThingPropertyKeys;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.util.AndroidUtilsLight;
import com.google.android.gms.common.util.Hex;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.installations.FirebaseInstallationsException;
import fr.bmartel.protocol.http.constants.HttpHeader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import org.json.JSONException;
public final class a21 {
public static final Pattern d = Pattern.compile("[0-9]+s");
public static final Charset e = Charset.forName("UTF-8");
public final Context a;
public final p83 b;
public final kh3 c = new kh3();
public a21(Context context, p83 p83Var) {
this.a = context;
this.b = p83Var;
}
public static URL a(String str) {
try {
return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
} catch (MalformedURLException e2) {
throw new FirebaseInstallationsException(e2.getMessage(), f21.UNAVAILABLE);
}
}
public static void b(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
String o;
InputStream errorStream = httpURLConnection.getErrorStream();
String str4 = null;
if (errorStream != null) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, e));
try {
StringBuilder sb = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
sb.append(readLine);
sb.append('\n');
}
str4 = String.format("Error when communicating with the Firebase Installations server API. HTTP response: [%d %s: %s]", Integer.valueOf(httpURLConnection.getResponseCode()), httpURLConnection.getResponseMessage(), sb);
} catch (IOException unused) {
} catch (Throwable th) {
try {
bufferedReader.close();
} catch (IOException unused2) {
}
throw th;
}
try {
bufferedReader.close();
} catch (IOException unused3) {
}
}
if (!TextUtils.isEmpty(str4)) {
Log.w("Firebase-Installations", str4);
Object[] objArr = new Object[3];
objArr[0] = str2;
objArr[1] = str3;
if (TextUtils.isEmpty(str)) {
o = "";
} else {
o = jf2.o(", ", str);
}
objArr[2] = o;
Log.w("Firebase-Installations", String.format("Firebase options used while communicating with Firebase server APIs: %s, %s%s", objArr));
}
}
public static long d(String str) {
Preconditions.checkArgument(d.matcher(str).matches(), "Invalid Expiration Timestamp.");
if (str == null || str.length() == 0) {
return 0L;
}
return Long.parseLong(str.substring(0, str.length() - 1));
}
public static fe e(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, e));
zf2 a = ve.a();
ep0 ep0Var = new ep0(10);
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals("name")) {
ep0Var.a = jsonReader.nextString();
} else if (nextName.equals("fid")) {
ep0Var.b = jsonReader.nextString();
} else if (nextName.equals("refreshToken")) {
ep0Var.c = jsonReader.nextString();
} else if (nextName.equals("authToken")) {
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName2 = jsonReader.nextName();
if (nextName2.equals(ThingPropertyKeys.TOKEN)) {
a.a = jsonReader.nextString();
} else if (nextName2.equals("expiresIn")) {
a.b = Long.valueOf(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
ep0Var.d = a.k();
jsonReader.endObject();
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
ep0Var.e = ko1.OK;
return ep0Var.f();
}
public static ve f(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, e));
zf2 a = ve.a();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals(ThingPropertyKeys.TOKEN)) {
a.a = jsonReader.nextString();
} else if (nextName.equals("expiresIn")) {
a.b = Long.valueOf(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
a.c = ag4.OK;
return a.k();
}
public static void g(HttpURLConnection httpURLConnection, String str, String str2) {
try {
ar1 ar1Var = new ar1();
ar1Var.x(str, "fid");
ar1Var.x(str2, "appId");
ar1Var.x("FIS_v2", "authVersion");
ar1Var.x("a:17.1.4", "sdkVersion");
i(httpURLConnection, ar1Var.toString().getBytes("UTF-8"));
} catch (JSONException e2) {
throw new IllegalStateException(e2);
}
}
public static void h(HttpURLConnection httpURLConnection) {
try {
ar1 ar1Var = new ar1();
ar1Var.x("a:17.1.4", "sdkVersion");
ar1 ar1Var2 = new ar1();
ar1Var2.x(ar1Var, "installation");
i(httpURLConnection, ar1Var2.toString().getBytes("UTF-8"));
} catch (JSONException e2) {
throw new IllegalStateException(e2);
}
}
public static void i(URLConnection uRLConnection, byte[] bArr) {
OutputStream outputStream = uRLConnection.getOutputStream();
if (outputStream == null) {
throw new IOException("Cannot send request to FIS servers. No OutputStream available.");
}
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream);
try {
gZIPOutputStream.write(bArr);
} finally {
try {
gZIPOutputStream.close();
outputStream.close();
} catch (IOException unused) {
}
}
}
public final HttpURLConnection c(URL url, String str) {
String str2;
byte[] packageCertificateHashBytes;
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setUseCaches(false);
httpURLConnection.setReadTimeout(10000);
httpURLConnection.addRequestProperty(HttpHeader.CONTENT_TYPE, "application/json");
httpURLConnection.addRequestProperty("Accept", "application/json");
httpURLConnection.addRequestProperty(HttpHeader.CONTENT_ENCODING, "gzip");
httpURLConnection.addRequestProperty(HttpHeader.CACHE_CONTROL, "no-cache");
Context context = this.a;
httpURLConnection.addRequestProperty("X-Android-Package", context.getPackageName());
gf1 gf1Var = (gf1) this.b.get();
if (gf1Var != null) {
try {
httpURLConnection.addRequestProperty("x-firebase-client", (String) Tasks.await(((ye0) gf1Var).a()));
} catch (InterruptedException e2) {
e = e2;
Thread.currentThread().interrupt();
Log.w("ContentValues", "Failed to get heartbeats header", e);
packageCertificateHashBytes = AndroidUtilsLight.getPackageCertificateHashBytes(context, context.getPackageName());
if (packageCertificateHashBytes == null) {
}
} catch (ExecutionException e3) {
e = e3;
Log.w("ContentValues", "Failed to get heartbeats header", e);
packageCertificateHashBytes = AndroidUtilsLight.getPackageCertificateHashBytes(context, context.getPackageName());
if (packageCertificateHashBytes == null) {
}
}
}
try {
packageCertificateHashBytes = AndroidUtilsLight.getPackageCertificateHashBytes(context, context.getPackageName());
} catch (PackageManager.NameNotFoundException e4) {
Log.e("ContentValues", "No such package: " + context.getPackageName(), e4);
}
if (packageCertificateHashBytes == null) {
Log.e("ContentValues", "Could not get fingerprint hash for package: " + context.getPackageName());
str2 = null;
httpURLConnection.addRequestProperty("X-Android-Cert", str2);
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
}
str2 = Hex.bytesToStringUppercase(packageCertificateHashBytes, false);
httpURLConnection.addRequestProperty("X-Android-Cert", str2);
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
} catch (IOException unused) {
throw new FirebaseInstallationsException("Firebase Installations Service is unavailable. Please try again later.", f21.UNAVAILABLE);
}
}
}