正在查看: Tarjeta Transporte v3.0.29 应用的 z10.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tarjeta Transporte v3.0.29 应用的 z10.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.sgcr;
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.itextpdf.text.pdf.PdfObject;
import com.itextpdf.text.pdf.codec.TIFFConstants;
import com.itextpdf.text.xml.xmp.XmpWriter;
import com.sgcr.cn1;
import com.sgcr.g20;
import com.sgcr.vc0;
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 z10 {
public final i01 f16876for;
public final Context f16877if;
public final a61 f16878new = new a61();
public static final Pattern f16875try = Pattern.compile("[0-9]+s");
public static final Charset f16874case = Charset.forName(XmpWriter.UTF8);
public z10(Context context, i01 i01Var) {
this.f16877if = context;
this.f16876for = i01Var;
}
public static boolean m18979break(int i) {
return i >= 200 && i < 300;
}
public static void m18980catch() {
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 m18981class(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
String m18988throw = m18988throw(httpURLConnection);
if (TextUtils.isEmpty(m18988throw)) {
return;
}
Log.w("Firebase-Installations", m18988throw);
Log.w("Firebase-Installations", m18984if(str, str2, str3));
}
public static long m18982final(String str) {
wx0.m18049for(f16875try.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 JSONObject m18983for(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:18.0.0");
return jSONObject;
} catch (JSONException e) {
throw new IllegalStateException(e);
}
}
public static String m18984if(String str, String str2, String str3) {
String str4;
Object[] objArr = new Object[3];
objArr[0] = str2;
objArr[1] = str3;
if (TextUtils.isEmpty(str)) {
str4 = PdfObject.NOTHING;
} 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 m18985new() {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("sdkVersion", "a:18.0.0");
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("installation", jSONObject);
return jSONObject2;
} catch (JSONException e) {
throw new IllegalStateException(e);
}
}
public static void m18986public(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 static byte[] m18987this(JSONObject jSONObject) {
return jSONObject.toString().getBytes(XmpWriter.UTF8);
}
public static String m18988throw(HttpURLConnection httpURLConnection) {
InputStream errorStream = httpURLConnection.getErrorStream();
if (errorStream == null) {
return null;
}
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, f16874case));
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 cn1 m18989case(String str, String str2, String str3, String str4) {
int responseCode;
cn1 m18997while;
cn1.Cif mo6325for;
if (!this.f16878new.m5397for()) {
throw new g20("Firebase Installations Service is unavailable. Please try again later.", g20.Cif.UNAVAILABLE);
}
URL m18992goto = m18992goto(String.format("projects/%s/installations/%s/authTokens:generate", str3, str2));
for (int i = 0; i <= 1; i++) {
TrafficStats.setThreadStatsTag(TIFFConstants.COMPRESSION_CCITTRLEW);
HttpURLConnection m18990const = m18990const(m18992goto, str);
try {
try {
m18990const.setRequestMethod("POST");
m18990const.addRequestProperty("Authorization", "FIS_v2 " + str4);
m18990const.setDoOutput(true);
m18994native(m18990const);
responseCode = m18990const.getResponseCode();
this.f16878new.m5396else(responseCode);
} finally {
m18990const.disconnect();
TrafficStats.clearThreadStatsTag();
}
} catch (IOException | AssertionError unused) {
}
if (m18979break(responseCode)) {
m18997while = m18997while(m18990const);
} else {
m18981class(m18990const, null, str, str3);
if (responseCode != 401 && responseCode != 404) {
if (responseCode == 429) {
throw new g20("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", g20.Cif.TOO_MANY_REQUESTS);
}
if (responseCode < 500 || responseCode >= 600) {
m18980catch();
mo6325for = cn1.m6547if().mo6325for(cn1.Cfor.BAD_CONFIG);
m18997while = mo6325for.mo6326if();
} else {
m18990const.disconnect();
TrafficStats.clearThreadStatsTag();
}
}
mo6325for = cn1.m6547if().mo6325for(cn1.Cfor.AUTH_ERROR);
m18997while = mo6325for.mo6326if();
}
return m18997while;
}
throw new g20("Firebase Installations Service is unavailable. Please try again later.", g20.Cif.UNAVAILABLE);
}
public final HttpURLConnection m18990const(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.f16877if.getPackageName());
s90 s90Var = (s90) this.f16876for.get();
if (s90Var != null) {
try {
httpURLConnection.addRequestProperty("x-firebase-client", (String) al1.m5574if(s90Var.mo7834if()));
} catch (InterruptedException e) {
e = e;
Thread.currentThread().interrupt();
Log.w("ContentValues", "Failed to get heartbeats header", e);
httpURLConnection.addRequestProperty("X-Android-Cert", m18991else());
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
} catch (ExecutionException e2) {
e = e2;
Log.w("ContentValues", "Failed to get heartbeats header", e);
httpURLConnection.addRequestProperty("X-Android-Cert", m18991else());
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
}
}
httpURLConnection.addRequestProperty("X-Android-Cert", m18991else());
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
} catch (IOException unused) {
throw new g20("Firebase Installations Service is unavailable. Please try again later.", g20.Cif.UNAVAILABLE);
}
}
public final String m18991else() {
try {
Context context = this.f16877if;
byte[] m18978if = z1.m18978if(context, context.getPackageName());
if (m18978if != null) {
return z90.m19104for(m18978if, false);
}
Log.e("ContentValues", "Could not get fingerprint hash for package: " + this.f16877if.getPackageName());
return null;
} catch (PackageManager.NameNotFoundException e) {
Log.e("ContentValues", "No such package: " + this.f16877if.getPackageName(), e);
return null;
}
}
public final URL m18992goto(String str) {
try {
return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
} catch (MalformedURLException e) {
throw new g20(e.getMessage(), g20.Cif.UNAVAILABLE);
}
}
public final void m18993import(HttpURLConnection httpURLConnection, String str, String str2) {
m18986public(httpURLConnection, m18987this(m18983for(str, str2)));
}
public final void m18994native(HttpURLConnection httpURLConnection) {
m18986public(httpURLConnection, m18987this(m18985new()));
}
public final vc0 m18995super(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f16874case));
cn1.Cif m6547if = cn1.m6547if();
vc0.Cif m17161if = vc0.m17161if();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals("name")) {
m17161if.mo10679else(jsonReader.nextString());
} else if (nextName.equals("fid")) {
m17161if.mo10682new(jsonReader.nextString());
} else if (nextName.equals("refreshToken")) {
m17161if.mo10683try(jsonReader.nextString());
} else if (nextName.equals("authToken")) {
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName2 = jsonReader.nextName();
if (nextName2.equals("token")) {
m6547if.mo6327new(jsonReader.nextString());
} else if (nextName2.equals("expiresIn")) {
m6547if.mo6328try(m18982final(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
m17161if.mo10680for(m6547if.mo6326if());
jsonReader.endObject();
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
return m17161if.mo10678case(vc0.Cfor.OK).mo10681if();
}
public vc0 m18996try(String str, String str2, String str3, String str4, String str5) {
int responseCode;
vc0 m18995super;
if (!this.f16878new.m5397for()) {
throw new g20("Firebase Installations Service is unavailable. Please try again later.", g20.Cif.UNAVAILABLE);
}
URL m18992goto = m18992goto(String.format("projects/%s/installations", str3));
for (int i = 0; i <= 1; i++) {
TrafficStats.setThreadStatsTag(32769);
HttpURLConnection m18990const = m18990const(m18992goto, str);
try {
try {
m18990const.setRequestMethod("POST");
m18990const.setDoOutput(true);
if (str5 != null) {
m18990const.addRequestProperty("x-goog-fis-android-iid-migration-auth", str5);
}
m18993import(m18990const, str2, str4);
responseCode = m18990const.getResponseCode();
this.f16878new.m5396else(responseCode);
} catch (IOException | AssertionError unused) {
}
if (m18979break(responseCode)) {
m18995super = m18995super(m18990const);
} else {
m18981class(m18990const, str4, str, str3);
if (responseCode == 429) {
throw new g20("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", g20.Cif.TOO_MANY_REQUESTS);
}
if (responseCode < 500 || responseCode >= 600) {
m18980catch();
m18995super = vc0.m17161if().mo10678case(vc0.Cfor.BAD_CONFIG).mo10681if();
} else {
m18990const.disconnect();
TrafficStats.clearThreadStatsTag();
}
}
return m18995super;
} finally {
m18990const.disconnect();
TrafficStats.clearThreadStatsTag();
}
}
throw new g20("Firebase Installations Service is unavailable. Please try again later.", g20.Cif.UNAVAILABLE);
}
public final cn1 m18997while(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f16874case));
cn1.Cif m6547if = cn1.m6547if();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals("token")) {
m6547if.mo6327new(jsonReader.nextString());
} else if (nextName.equals("expiresIn")) {
m6547if.mo6328try(m18982final(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
return m6547if.mo6325for(cn1.Cfor.OK).mo6326if();
}
}