漫漫擼2 v1.3.9版本的 MD5 值为:e07b15db49ff38b958ff7c8268ff1c9b

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


package g.i.b.r.n;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.text.TextUtils;
import android.util.JsonReader;
import android.util.Log;
import com.openmediation.sdk.utils.constant.CommonConstants;
import com.openmediation.sdk.utils.event.AdvanceEventId;
import com.openmediation.sdk.utils.request.network.Headers;
import com.unity3d.ads.metadata.MediationMetaData;
import d.u.u;
import g.i.b.r.g;
import g.i.b.r.n.b;
import g.i.b.r.n.d;
import g.i.b.r.n.f;
import g.i.b.t.h;
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.security.MessageDigest;
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 f12209a = Pattern.compile("[0-9]+s");
    public static final Charset f12210b = Charset.forName(CommonConstants.CHARTSET_UTF8);
    public final Context f12211c;
    public final g.i.b.q.b<h> f12212d;
    public final g.i.b.q.b<g.i.b.p.f> f12213e;
    public final e f12214f = new e();

    public c(Context context, g.i.b.q.b<h> bVar, g.i.b.q.b<g.i.b.p.f> bVar2) {
        this.f12211c = context;
        this.f12212d = bVar;
        this.f12213e = bVar2;
    }

    public static void b(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
        InputStream errorStream = httpURLConnection.getErrorStream();
        String str4 = null;
        if (errorStream != null) {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, f12210b));
            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)) {
            return;
        }
        Log.w("Firebase-Installations", str4);
        Object[] objArr = new Object[3];
        objArr[0] = str2;
        objArr[1] = str3;
        objArr[2] = TextUtils.isEmpty(str) ? "" : g.b.a.a.a.r(", ", str);
        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) {
        u.k(f12209a.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 void i(URLConnection uRLConnection, byte[] bArr) throws IOException {
        OutputStream outputStream = uRLConnection.getOutputStream();
        if (outputStream != null) {
            GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream);
            try {
                gZIPOutputStream.write(bArr);
                try {
                    return;
                } catch (IOException unused) {
                    return;
                }
            } finally {
                try {
                    gZIPOutputStream.close();
                    outputStream.close();
                } catch (IOException unused2) {
                }
            }
        }
        throw new IOException("Cannot send request to FIS servers. No OutputStream available.");
    }

    public final URL a(String str) throws g {
        try {
            return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
        } catch (MalformedURLException e2) {
            throw new g(e2.getMessage(), 2);
        }
    }

    public final HttpURLConnection c(URL url, String str) throws g {
        PackageInfo packageInfo;
        Signature[] signatureArr;
        byte[] bArr;
        MessageDigest a2;
        int a3;
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
            httpURLConnection.setConnectTimeout(AdvanceEventId.CODE_LOAD_WHILE_INIT_PENDING);
            httpURLConnection.setUseCaches(false);
            httpURLConnection.setReadTimeout(AdvanceEventId.CODE_LOAD_WHILE_INIT_PENDING);
            httpURLConnection.addRequestProperty("Content-Type", Headers.VALUE_APPLICATION_JSON);
            httpURLConnection.addRequestProperty(Headers.KEY_ACCEPT, Headers.VALUE_APPLICATION_JSON);
            httpURLConnection.addRequestProperty(Headers.KEY_CONTENT_ENCODING, "gzip");
            httpURLConnection.addRequestProperty("Cache-Control", "no-cache");
            httpURLConnection.addRequestProperty("X-Android-Package", this.f12211c.getPackageName());
            if (this.f12213e.get() != null && this.f12212d.get() != null && (a3 = this.f12213e.get().a("fire-installations-id")) != 1) {
                httpURLConnection.addRequestProperty("x-firebase-client", this.f12212d.get().a());
                httpURLConnection.addRequestProperty("x-firebase-client-log-type", Integer.toString(d.f.a.g.b(a3)));
            }
            String str2 = null;
            try {
                Context context = this.f12211c;
                packageInfo = g.i.a.d.d.p.b.a(context).f9728a.getPackageManager().getPackageInfo(context.getPackageName(), 64);
                signatureArr = packageInfo.signatures;
            } catch (PackageManager.NameNotFoundException e2) {
                StringBuilder D = g.b.a.a.a.D("No such package: ");
                D.append(this.f12211c.getPackageName());
                Log.e("ContentValues", D.toString(), e2);
            }
            if (signatureArr != null && signatureArr.length == 1 && (a2 = g.i.a.d.d.o.a.a("SHA1")) != null) {
                bArr = a2.digest(packageInfo.signatures[0].toByteArray());
                if (bArr != null) {
                    Log.e("ContentValues", "Could not get fingerprint hash for package: " + this.f12211c.getPackageName());
                } else {
                    int length = bArr.length;
                    StringBuilder sb = new StringBuilder(length + length);
                    for (int i2 = 0; i2 < length; i2++) {
                        char[] cArr = g.i.a.d.d.o.d.f9718a;
                        sb.append(cArr[(bArr[i2] & 240) >>> 4]);
                        sb.append(cArr[bArr[i2] & 15]);
                    }
                    str2 = sb.toString();
                }
                httpURLConnection.addRequestProperty("X-Android-Cert", str2);
                httpURLConnection.addRequestProperty("x-goog-api-key", str);
                return httpURLConnection;
            }
            bArr = null;
            if (bArr != null) {
            }
            httpURLConnection.addRequestProperty("X-Android-Cert", str2);
            httpURLConnection.addRequestProperty("x-goog-api-key", str);
            return httpURLConnection;
        } catch (IOException unused) {
            throw new g("Firebase Installations Service is unavailable. Please try again later.", 2);
        }
    }

    public final d e(HttpURLConnection httpURLConnection) throws AssertionError, IOException {
        InputStream inputStream = httpURLConnection.getInputStream();
        JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f12210b));
        f.a a2 = f.a();
        jsonReader.beginObject();
        String str = null;
        String str2 = null;
        String str3 = null;
        f fVar = null;
        while (jsonReader.hasNext()) {
            String nextName = jsonReader.nextName();
            if (nextName.equals(MediationMetaData.KEY_NAME)) {
                str = jsonReader.nextString();
            } else if (nextName.equals("fid")) {
                str2 = jsonReader.nextString();
            } else if (nextName.equals("refreshToken")) {
                str3 = jsonReader.nextString();
            } else if (nextName.equals("authToken")) {
                jsonReader.beginObject();
                while (jsonReader.hasNext()) {
                    String nextName2 = jsonReader.nextName();
                    if (nextName2.equals("token")) {
                        ((b.C0151b) a2).f12206a = jsonReader.nextString();
                    } else if (nextName2.equals("expiresIn")) {
                        a2.b(d(jsonReader.nextString()));
                    } else {
                        jsonReader.skipValue();
                    }
                }
                fVar = a2.a();
                jsonReader.endObject();
            } else {
                jsonReader.skipValue();
            }
        }
        jsonReader.endObject();
        jsonReader.close();
        inputStream.close();
        return new a(str, str2, str3, fVar, d.a.OK, null);
    }

    public final f f(HttpURLConnection httpURLConnection) throws AssertionError, IOException {
        InputStream inputStream = httpURLConnection.getInputStream();
        JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f12210b));
        f.a a2 = f.a();
        jsonReader.beginObject();
        while (jsonReader.hasNext()) {
            String nextName = jsonReader.nextName();
            if (nextName.equals("token")) {
                ((b.C0151b) a2).f12206a = jsonReader.nextString();
            } else if (nextName.equals("expiresIn")) {
                a2.b(d(jsonReader.nextString()));
            } else {
                jsonReader.skipValue();
            }
        }
        jsonReader.endObject();
        jsonReader.close();
        inputStream.close();
        b.C0151b c0151b = (b.C0151b) a2;
        c0151b.f12208c = f.b.OK;
        return c0151b.a();
    }

    public final void g(HttpURLConnection httpURLConnection, String str, String str2) throws IOException {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("fid", str);
            jSONObject.put("appId", str2);
            jSONObject.put("authVersion", "FIS_v2");
            jSONObject.put("sdkVersion", "a:17.0.0");
            i(httpURLConnection, jSONObject.toString().getBytes(CommonConstants.CHARTSET_UTF8));
        } catch (JSONException e2) {
            throw new IllegalStateException(e2);
        }
    }

    public final void h(HttpURLConnection httpURLConnection) throws IOException {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("sdkVersion", "a:17.0.0");
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("installation", jSONObject);
            i(httpURLConnection, jSONObject2.toString().getBytes(CommonConstants.CHARTSET_UTF8));
        } catch (JSONException e2) {
            throw new IllegalStateException(e2);
        }
    }
}