小源钱包 v1.0.0版本的 MD5 值为:2fddb51fa9867693f901004082511bea

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


package com.unicom.xiaowo.account.shield.d;

import android.net.Network;
import android.os.Build;
import android.text.TextUtils;
import com.alibaba.sdk.android.oss.common.utils.HttpHeaders;
import com.jufu.kakahua.apiloan.ui.SupportBankCardActivity;
import com.unicom.xiaowo.account.shield.UniAccountHelper;
import com.unicom.xiaowo.account.shield.e.d;
import com.unicom.xiaowo.account.shield.e.f;
import com.unicom.xiaowo.account.shield.e.g;
import com.unicom.xiaowo.account.shield.e.i;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.SecureRandom;
import java.util.HashMap;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import org.json.JSONObject;
public class b {
    private String a(InputStream inputStream) {
        ByteArrayOutputStream byteArrayOutputStream;
        Throwable th;
        try {
            byteArrayOutputStream = new ByteArrayOutputStream();
            try {
                byte[] bArr = new byte[1024];
                while (true) {
                    int read = inputStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    byteArrayOutputStream.write(bArr, 0, read);
                }
                String str = new String(byteArrayOutputStream.toByteArray());
                try {
                    byteArrayOutputStream.close();
                    inputStream.close();
                } catch (Exception unused) {
                }
                return str;
            } catch (Exception unused2) {
                if (byteArrayOutputStream != null) {
                    try {
                        byteArrayOutputStream.close();
                    } catch (Exception unused3) {
                        return null;
                    }
                }
                if (inputStream != null) {
                    inputStream.close();
                }
                return null;
            } catch (Throwable th2) {
                th = th2;
                if (byteArrayOutputStream != null) {
                    try {
                        byteArrayOutputStream.close();
                    } catch (Exception unused4) {
                        throw th;
                    }
                }
                if (inputStream != null) {
                    inputStream.close();
                }
                throw th;
            }
        } catch (Exception unused5) {
            byteArrayOutputStream = null;
        } catch (Throwable th3) {
            byteArrayOutputStream = null;
            th = th3;
        }
    }

    public String a(String str, HashMap<String, String> hashMap, Network network) {
        String str2;
        f.a("url:" + str);
        if (Build.VERSION.SDK_INT < 21) {
            return c(str, hashMap, network);
        }
        try {
            URL url = new URL(str);
            str2 = "https://" + url.getHost();
        } catch (MalformedURLException e10) {
            e10.printStackTrace();
            str2 = "";
        }
        g.c(str);
        try {
            URL url2 = new URL(str);
            HttpsURLConnection httpsURLConnection = (HttpsURLConnection) ((network == null || Build.VERSION.SDK_INT < 21) ? url2.openConnection() : network.openConnection(url2));
            httpsURLConnection.setDoInput(true);
            httpsURLConnection.setDoOutput(false);
            httpsURLConnection.setUseCaches(false);
            httpsURLConnection.setInstanceFollowRedirects(false);
            httpsURLConnection.setReadTimeout(30000);
            httpsURLConnection.setConnectTimeout(30000);
            httpsURLConnection.setRequestMethod("GET");
            httpsURLConnection.setHostnameVerifier(new HostnameVerifier() {
                @Override
                public boolean verify(String str3, SSLSession sSLSession) {
                    f.a("HostnameVerifier:" + str3);
                    if (TextUtils.isEmpty(str3)) {
                        return false;
                    }
                    return str3.equals("opencloud.wostore.cn") || str3.contains("10010.com");
                }
            });
            if (hashMap != null) {
                for (String str3 : hashMap.keySet()) {
                    httpsURLConnection.setRequestProperty(str3, hashMap.get(str3));
                }
            }
            httpsURLConnection.addRequestProperty("Connection", str.startsWith("https://opencloud.wostore.cn/openapi/netauth/precheck/wp?") ? "Keep-Alive" : "close");
            httpsURLConnection.connect();
            if (httpsURLConnection.getResponseCode() == 200) {
                String a10 = a(httpsURLConnection.getInputStream());
                if (TextUtils.isEmpty(a10)) {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("code", 10012);
                    jSONObject.put("msg", "10012");
                    jSONObject.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                    return jSONObject.toString();
                }
                return a10;
            } else if (httpsURLConnection.getResponseCode() != 302) {
                JSONObject jSONObject2 = new JSONObject();
                jSONObject2.put("code", 10010);
                jSONObject2.put("msg", "https状态码" + httpsURLConnection.getResponseCode());
                jSONObject2.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                return jSONObject2.toString();
            } else {
                String headerField = httpsURLConnection.getHeaderField(HttpHeaders.LOCATION);
                if (!TextUtils.isEmpty(headerField)) {
                    return headerField.startsWith("https") ? a(headerField, null, network) : b(headerField, null, network);
                }
                JSONObject jSONObject3 = new JSONObject();
                jSONObject3.put("code", 10013);
                jSONObject3.put("msg", "无跳转地址");
                jSONObject3.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                return jSONObject3.toString();
            }
        } catch (Exception e11) {
            e11.printStackTrace();
            try {
                JSONObject jSONObject4 = new JSONObject();
                jSONObject4.put("code", 10011);
                jSONObject4.put("msg", "https异常" + e11.getMessage());
                jSONObject4.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                return jSONObject4.toString();
            } catch (Exception unused) {
                return null;
            }
        }
    }

    public String b(String str, HashMap<String, String> hashMap, Network network) {
        String str2;
        HttpURLConnection httpURLConnection;
        HttpURLConnection httpURLConnection2;
        if (Build.VERSION.SDK_INT < 21) {
            try {
                if (i.a(UniAccountHelper.getInstance().getApplicationContext()) == 1) {
                    new d().a(UniAccountHelper.getInstance().getApplicationContext(), str);
                }
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }
        try {
            URL url = new URL(str);
            str2 = "http://" + url.getHost();
        } catch (MalformedURLException e11) {
            e11.printStackTrace();
            str2 = str;
        }
        g.c(str);
        f.a(str);
        HttpURLConnection httpURLConnection3 = null;
        try {
            URL url2 = new URL(str);
            httpURLConnection2 = (HttpURLConnection) ((network == null || Build.VERSION.SDK_INT < 21) ? url2.openConnection() : network.openConnection(url2));
        } catch (Exception e12) {
            e = e12;
            httpURLConnection = null;
        } catch (Throwable th) {
            th = th;
        }
        try {
            httpURLConnection2.setDoInput(true);
            httpURLConnection2.setDoOutput(false);
            httpURLConnection2.setUseCaches(false);
            httpURLConnection2.setInstanceFollowRedirects(false);
            httpURLConnection2.setReadTimeout(30000);
            httpURLConnection2.setConnectTimeout(30000);
            httpURLConnection2.setRequestMethod("GET");
            if (hashMap != null) {
                for (String str3 : hashMap.keySet()) {
                    httpURLConnection2.setRequestProperty(str3, hashMap.get(str3));
                }
            }
            httpURLConnection2.addRequestProperty("Connection", "close");
            httpURLConnection2.connect();
            if (httpURLConnection2.getResponseCode() == 200) {
                String a10 = a(httpURLConnection2.getInputStream());
                if (!TextUtils.isEmpty(a10)) {
                    httpURLConnection2.disconnect();
                    return a10;
                }
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("code", 10012);
                jSONObject.put("msg", "10012");
                jSONObject.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                String jSONObject2 = jSONObject.toString();
                httpURLConnection2.disconnect();
                return jSONObject2;
            } else if (httpURLConnection2.getResponseCode() != 302) {
                JSONObject jSONObject3 = new JSONObject();
                jSONObject3.put("code", 10010);
                jSONObject3.put("msg", "https状态码" + httpURLConnection2.getResponseCode());
                jSONObject3.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                String jSONObject4 = jSONObject3.toString();
                httpURLConnection2.disconnect();
                return jSONObject4;
            } else {
                String headerField = httpURLConnection2.getHeaderField(HttpHeaders.LOCATION);
                if (TextUtils.isEmpty(headerField)) {
                    JSONObject jSONObject5 = new JSONObject();
                    jSONObject5.put("code", 10013);
                    jSONObject5.put("msg", "无跳转地址");
                    jSONObject5.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                    String jSONObject6 = jSONObject5.toString();
                    httpURLConnection2.disconnect();
                    return jSONObject6;
                } else if (headerField.startsWith("https")) {
                    String a11 = a(headerField, null, network);
                    httpURLConnection2.disconnect();
                    return a11;
                } else {
                    String b10 = b(headerField, null, network);
                    httpURLConnection2.disconnect();
                    return b10;
                }
            }
        } catch (Exception e13) {
            httpURLConnection = httpURLConnection2;
            e = e13;
            try {
                e.printStackTrace();
                try {
                    JSONObject jSONObject7 = new JSONObject();
                    jSONObject7.put("code", 10024);
                    jSONObject7.put("msg", "http异常" + e.getMessage());
                    jSONObject7.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                    String jSONObject8 = jSONObject7.toString();
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                    return jSONObject8;
                } catch (Exception unused) {
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                    return null;
                }
            } catch (Throwable th2) {
                th = th2;
                httpURLConnection3 = httpURLConnection;
                if (httpURLConnection3 != null) {
                    httpURLConnection3.disconnect();
                }
                throw th;
            }
        } catch (Throwable th3) {
            httpURLConnection3 = httpURLConnection2;
            th = th3;
            if (httpURLConnection3 != null) {
            }
            throw th;
        }
    }

    public String c(String str, HashMap<String, String> hashMap, Network network) {
        String str2;
        f.a("url:" + str);
        if (Build.VERSION.SDK_INT < 21) {
            try {
                if (i.a(UniAccountHelper.getInstance().getApplicationContext()) == 1) {
                    new d().a(UniAccountHelper.getInstance().getApplicationContext(), str);
                }
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }
        try {
            URL url = new URL(str);
            str2 = "https://" + url.getHost();
        } catch (MalformedURLException e11) {
            e11.printStackTrace();
            str2 = "";
        }
        g.c(str);
        try {
            SSLContext sSLContext = SSLContext.getInstance("TLS");
            sSLContext.init(null, null, new SecureRandom());
            c cVar = new c(sSLContext.getSocketFactory());
            URL url2 = new URL(str);
            HttpsURLConnection httpsURLConnection = (HttpsURLConnection) ((network == null || Build.VERSION.SDK_INT < 21) ? url2.openConnection() : network.openConnection(url2));
            httpsURLConnection.setDoInput(true);
            httpsURLConnection.setDoOutput(false);
            httpsURLConnection.setUseCaches(false);
            httpsURLConnection.setInstanceFollowRedirects(false);
            httpsURLConnection.setReadTimeout(30000);
            httpsURLConnection.setConnectTimeout(30000);
            httpsURLConnection.setRequestMethod("GET");
            httpsURLConnection.setSSLSocketFactory(cVar);
            httpsURLConnection.setHostnameVerifier(new HostnameVerifier() {
                @Override
                public boolean verify(String str3, SSLSession sSLSession) {
                    f.a("HostnameVerifier:" + str3);
                    if (TextUtils.isEmpty(str3)) {
                        return false;
                    }
                    return str3.equals("opencloud.wostore.cn") || str3.contains("10010.com");
                }
            });
            if (hashMap != null) {
                for (String str3 : hashMap.keySet()) {
                    httpsURLConnection.setRequestProperty(str3, hashMap.get(str3));
                }
            }
            httpsURLConnection.addRequestProperty("Connection", str.startsWith("https://opencloud.wostore.cn/openapi/netauth/precheck/wp?") ? "Keep-Alive" : "close");
            httpsURLConnection.connect();
            if (httpsURLConnection.getResponseCode() == 200) {
                String a10 = a(httpsURLConnection.getInputStream());
                if (TextUtils.isEmpty(a10)) {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("code", 10012);
                    jSONObject.put("msg", "10012");
                    jSONObject.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                    return jSONObject.toString();
                }
                return a10;
            } else if (httpsURLConnection.getResponseCode() != 302) {
                JSONObject jSONObject2 = new JSONObject();
                jSONObject2.put("code", 10010);
                jSONObject2.put("msg", "https状态码" + httpsURLConnection.getResponseCode());
                jSONObject2.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                return jSONObject2.toString();
            } else {
                String headerField = httpsURLConnection.getHeaderField(HttpHeaders.LOCATION);
                if (!TextUtils.isEmpty(headerField)) {
                    return headerField.startsWith("https") ? a(headerField, null, network) : b(headerField, null, network);
                }
                JSONObject jSONObject3 = new JSONObject();
                jSONObject3.put("code", 10013);
                jSONObject3.put("msg", "无跳转地址");
                jSONObject3.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                return jSONObject3.toString();
            }
        } catch (Exception e12) {
            e12.printStackTrace();
            try {
                JSONObject jSONObject4 = new JSONObject();
                jSONObject4.put("code", 10011);
                jSONObject4.put("msg", "https异常" + e12.getMessage());
                jSONObject4.put(SupportBankCardActivity.BUNDLE_KEY_NAME, str2);
                return jSONObject4.toString();
            } catch (Exception unused) {
                return null;
            }
        }
    }
}