正在查看: Pesohere v1.0.5 应用的 c.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Pesohere v1.0.5 应用的 c.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package f.e.c.x.s;
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.TrafficStats;
import android.text.TextUtils;
import android.util.JsonReader;
import android.util.Log;
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.common.util.VisibleForTesting;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.wang.avi.BuildConfig;
import f.e.c.u.i;
import f.e.c.x.j;
import f.e.c.x.s.d;
import f.e.c.x.s.f;
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;
import org.json.JSONObject;
public class c {
public static final Pattern f3492d = Pattern.compile("[0-9]+s");
public static final Charset f3493e = Charset.forName("UTF-8");
public final Context a;
public final f.e.c.w.b<i> b;
public final e f3494c = new e();
public c(Context context, f.e.c.w.b<i> bVar) {
this.a = context;
this.b = bVar;
}
public static String a(String str, String str2, String str3) {
String str4;
Object[] objArr = new Object[3];
objArr[0] = str2;
objArr[1] = str3;
if (TextUtils.isEmpty(str)) {
str4 = BuildConfig.FLAVOR;
} else {
str4 = ", " + str;
}
objArr[2] = str4;
return String.format("Firebase options used while communicating with Firebase server APIs: %s, %s%s", objArr);
}
public static JSONObject b(String str, String str2) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("fid", str);
jSONObject.put("appId", str2);
jSONObject.put("authVersion", "FIS_v2");
jSONObject.put("sdkVersion", "a:17.1.3");
return jSONObject;
} catch (JSONException e2) {
throw new IllegalStateException(e2);
}
}
public static JSONObject c() {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("sdkVersion", "a:17.1.3");
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("installation", jSONObject);
return jSONObject2;
} catch (JSONException e2) {
throw new IllegalStateException(e2);
}
}
public static byte[] h(JSONObject jSONObject) {
return jSONObject.toString().getBytes("UTF-8");
}
public static boolean i(int i2) {
return i2 >= 200 && i2 < 300;
}
public static void j() {
Log.e("Firebase-Installations", "Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.");
}
public static void k(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
String o = o(httpURLConnection);
if (TextUtils.isEmpty(o)) {
return;
}
Log.w("Firebase-Installations", o);
Log.w("Firebase-Installations", a(str, str2, str3));
}
@VisibleForTesting
public static long m(String str) {
Preconditions.checkArgument(f3492d.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 String o(HttpURLConnection httpURLConnection) {
InputStream errorStream = httpURLConnection.getErrorStream();
if (errorStream == null) {
return null;
}
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, f3493e));
try {
try {
StringBuilder sb = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
sb.append(readLine);
sb.append('\n');
}
String format = String.format("Error when communicating with the Firebase Installations server API. HTTP response: [%d %s: %s]", Integer.valueOf(httpURLConnection.getResponseCode()), httpURLConnection.getResponseMessage(), sb);
try {
bufferedReader.close();
} catch (IOException unused) {
}
return format;
} catch (IOException unused2) {
return null;
}
} catch (IOException unused3) {
bufferedReader.close();
return null;
} catch (Throwable th) {
try {
bufferedReader.close();
} catch (IOException unused4) {
}
throw th;
}
}
public static void s(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 d d(String str, String str2, String str3, String str4, String str5) {
int responseCode;
d n;
if (!this.f3494c.b()) {
throw new j("Firebase Installations Service is unavailable. Please try again later.", j.a.UNAVAILABLE);
}
URL g2 = g(String.format("projects/%s/installations", str3));
for (int i2 = 0; i2 <= 1; i2++) {
TrafficStats.setThreadStatsTag(32769);
HttpURLConnection l2 = l(g2, str);
try {
try {
l2.setRequestMethod("POST");
l2.setDoOutput(true);
if (str5 != null) {
l2.addRequestProperty("x-goog-fis-android-iid-migration-auth", str5);
}
q(l2, str2, str4);
responseCode = l2.getResponseCode();
this.f3494c.f(responseCode);
} catch (IOException | AssertionError unused) {
}
if (i(responseCode)) {
n = n(l2);
} else {
k(l2, str4, str, str3);
if (responseCode == 429) {
throw new j("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", j.a.TOO_MANY_REQUESTS);
}
if (responseCode < 500 || responseCode >= 600) {
j();
d.a a = d.a();
a.e(d.b.BAD_CONFIG);
n = a.a();
} else {
l2.disconnect();
TrafficStats.clearThreadStatsTag();
}
}
return n;
} finally {
l2.disconnect();
TrafficStats.clearThreadStatsTag();
}
}
throw new j("Firebase Installations Service is unavailable. Please try again later.", j.a.UNAVAILABLE);
}
public f e(String str, String str2, String str3, String str4) {
int responseCode;
f p;
if (!this.f3494c.b()) {
throw new j("Firebase Installations Service is unavailable. Please try again later.", j.a.UNAVAILABLE);
}
URL g2 = g(String.format("projects/%s/installations/%s/authTokens:generate", str3, str2));
for (int i2 = 0; i2 <= 1; i2++) {
TrafficStats.setThreadStatsTag(32771);
HttpURLConnection l2 = l(g2, str);
try {
try {
l2.setRequestMethod("POST");
l2.addRequestProperty("Authorization", "FIS_v2 " + str4);
l2.setDoOutput(true);
r(l2);
responseCode = l2.getResponseCode();
this.f3494c.f(responseCode);
} finally {
l2.disconnect();
TrafficStats.clearThreadStatsTag();
}
} catch (IOException | AssertionError unused) {
}
if (i(responseCode)) {
p = p(l2);
} else {
k(l2, null, str, str3);
if (responseCode != 401 && responseCode != 404) {
if (responseCode == 429) {
throw new j("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", j.a.TOO_MANY_REQUESTS);
}
if (responseCode < 500 || responseCode >= 600) {
j();
f.a a = f.a();
a.b(f.b.BAD_CONFIG);
p = a.a();
} else {
l2.disconnect();
TrafficStats.clearThreadStatsTag();
}
}
f.a a2 = f.a();
a2.b(f.b.AUTH_ERROR);
p = a2.a();
}
return p;
}
throw new j("Firebase Installations Service is unavailable. Please try again later.", j.a.UNAVAILABLE);
}
public final String f() {
try {
byte[] packageCertificateHashBytes = AndroidUtilsLight.getPackageCertificateHashBytes(this.a, this.a.getPackageName());
if (packageCertificateHashBytes != null) {
return Hex.bytesToStringUppercase(packageCertificateHashBytes, false);
}
Log.e("ContentValues", "Could not get fingerprint hash for package: " + this.a.getPackageName());
return null;
} catch (PackageManager.NameNotFoundException e2) {
Log.e("ContentValues", "No such package: " + this.a.getPackageName(), e2);
return null;
}
}
public final URL g(String str) {
try {
return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
} catch (MalformedURLException e2) {
throw new j(e2.getMessage(), j.a.UNAVAILABLE);
}
}
public final HttpURLConnection l(URL url, String str) {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setUseCaches(false);
httpURLConnection.setReadTimeout(10000);
httpURLConnection.addRequestProperty("Content-Type", "application/json");
httpURLConnection.addRequestProperty("Accept", "application/json");
httpURLConnection.addRequestProperty("Content-Encoding", "gzip");
httpURLConnection.addRequestProperty("Cache-Control", "no-cache");
httpURLConnection.addRequestProperty("X-Android-Package", this.a.getPackageName());
i iVar = this.b.get();
if (iVar != null) {
try {
httpURLConnection.addRequestProperty("x-firebase-client", (String) Tasks.await(iVar.a()));
} catch (InterruptedException e2) {
Thread.currentThread().interrupt();
Log.w("ContentValues", "Failed to get heartbeats header", e2);
} catch (ExecutionException e3) {
Log.w("ContentValues", "Failed to get heartbeats header", e3);
}
}
httpURLConnection.addRequestProperty("X-Android-Cert", f());
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
} catch (IOException unused) {
throw new j("Firebase Installations Service is unavailable. Please try again later.", j.a.UNAVAILABLE);
}
}
public final d n(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f3493e));
f.a a = f.a();
d.a a2 = d.a();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals(AppMeasurementSdk.ConditionalUserProperty.NAME)) {
a2.f(jsonReader.nextString());
} else if (nextName.equals("fid")) {
a2.c(jsonReader.nextString());
} else if (nextName.equals("refreshToken")) {
a2.d(jsonReader.nextString());
} else if (nextName.equals("authToken")) {
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName2 = jsonReader.nextName();
if (nextName2.equals(FirebaseMessagingService.EXTRA_TOKEN)) {
a.c(jsonReader.nextString());
} else if (nextName2.equals("expiresIn")) {
a.d(m(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
a2.b(a.a());
jsonReader.endObject();
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
a2.e(d.b.OK);
return a2.a();
}
public final f p(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f3493e));
f.a a = f.a();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals(FirebaseMessagingService.EXTRA_TOKEN)) {
a.c(jsonReader.nextString());
} else if (nextName.equals("expiresIn")) {
a.d(m(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
a.b(f.b.OK);
return a.a();
}
public final void q(HttpURLConnection httpURLConnection, String str, String str2) {
s(httpURLConnection, h(b(str, str2)));
}
public final void r(HttpURLConnection httpURLConnection) {
s(httpURLConnection, h(c()));
}
}