正在查看: 万能钥匙 v1.1.23 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 万能钥匙 v1.1.23 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package zl;
import android.net.Network;
import android.net.SSLCertificateSocketFactory;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import com.google.android.inner_exoplayer2.C;
import com.google.android.inner_exoplayer2.extractor.ts.PsExtractor;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.Proxy;
import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import zl.c;
public class b {
public static ChangeQuickRedirect changeQuickRedirect;
public static SSLSocketFactory r;
public static HostnameVerifier s;
public static Map<String, List<String>> t;
public String b;
public Proxy c;
public Boolean j;
public SSLSocketFactory l;
public HostnameVerifier m;
public Network p;
public String a = "BLHttp";
public Map<String, String> d = new HashMap();
public int e = 15000;
public int f = 30000;
public int g = 1;
public int i = -1;
public boolean n = true;
public boolean o = true;
public HashMap<String, String> q = new HashMap<>();
public c k = new c();
public long h = System.currentTimeMillis();
public class a implements HostnameVerifier {
public static ChangeQuickRedirect changeQuickRedirect;
public final String a;
public a(String str) {
this.a = str;
}
@Override
public boolean verify(String str, SSLSession sSLSession) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, sSLSession}, this, changeQuickRedirect, false, 201, new Class[]{String.class, SSLSession.class}, Boolean.TYPE);
if (proxy.isSupported) {
return ((Boolean) proxy.result).booleanValue();
}
if (b.s == null) {
HostnameVerifier unused = b.s = HttpsURLConnection.getDefaultHostnameVerifier();
}
return b.s.verify(this.a, sSLSession);
}
}
public class C0299b implements HostnameVerifier {
public static ChangeQuickRedirect changeQuickRedirect;
public C0299b() {
}
@Override
public boolean verify(String str, SSLSession sSLSession) {
return true;
}
}
public class c {
public long a = 0;
public String b = "";
public String c = "";
public String d = "";
public String e = "";
public String f = "";
public String g = "";
public String h = "";
public c() {
}
}
public static class d implements X509TrustManager {
public static ChangeQuickRedirect changeQuickRedirect;
public d() {
}
public d(a aVar) {
this();
}
@Override
public void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
}
public class e extends SSLSocketFactory {
public static ChangeQuickRedirect changeQuickRedirect;
public String a;
public e(String str) {
this.a = str;
}
@Override
public Socket createSocket() throws IOException {
return null;
}
@Override
public Socket createSocket(String str, int i) throws IOException, UnknownHostException {
return null;
}
@Override
public Socket createSocket(String str, int i, InetAddress inetAddress, int i2) throws IOException, UnknownHostException {
return null;
}
@Override
public Socket createSocket(InetAddress inetAddress, int i) throws IOException {
return null;
}
@Override
public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress2, int i2) throws IOException {
return null;
}
@Override
public Socket createSocket(Socket socket, String str, int i, boolean z) throws IOException {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{socket, str, new Integer(i), new Byte(z ? (byte) 1 : (byte) 0)}, this, changeQuickRedirect, false, 203, new Class[]{Socket.class, String.class, Integer.TYPE, Boolean.TYPE}, Socket.class);
if (proxy.isSupported) {
return (Socket) proxy.result;
}
String str2 = this.a;
if (str2 != null) {
str = str2;
}
vs.a.a("customized createSocket. host: " + str);
InetAddress inetAddress = socket.getInetAddress();
if (z) {
socket.close();
}
SSLCertificateSocketFactory sSLCertificateSocketFactory = (SSLCertificateSocketFactory) SSLCertificateSocketFactory.getDefault(0);
SSLSocket sSLSocket = (SSLSocket) sSLCertificateSocketFactory.createSocket(inetAddress, i);
vs.a.a("92241>sl.getSupportedProtocols()>" + TextUtils.join(",", sSLSocket.getSupportedProtocols()));
sSLSocket.setEnabledProtocols(sSLSocket.getSupportedProtocols());
vs.a.a("Setting SNI hostname:" + str);
sSLCertificateSocketFactory.setHostname(sSLSocket, str);
SSLSession session = sSLSocket.getSession();
vs.a.a("Established " + session.getProtocol() + " connection with " + session.getPeerHost() + " using " + session.getCipherSuite());
return sSLSocket;
}
@Override
public String[] getDefaultCipherSuites() {
return new String[0];
}
@Override
public String[] getSupportedCipherSuites() {
return new String[0];
}
}
public b(String str) {
this.b = str;
}
public static SSLSocketFactory c(SSLSocketFactory sSLSocketFactory) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{sSLSocketFactory}, null, changeQuickRedirect, true, 196, new Class[]{SSLSocketFactory.class}, SSLSocketFactory.class);
return proxy.isSupported ? (SSLSocketFactory) proxy.result : sSLSocketFactory;
}
public static void d(InputStream inputStream, OutputStream outputStream) throws Exception {
if (PatchProxy.proxy(new Object[]{inputStream, outputStream}, null, changeQuickRedirect, true, 193, new Class[]{InputStream.class, OutputStream.class}, Void.TYPE).isSupported) {
return;
}
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream);
byte[] bArr = new byte[1024];
while (true) {
int read = inputStream.read(bArr, 0, 1024);
if (read == -1) {
gZIPOutputStream.finish();
gZIPOutputStream.close();
return;
}
gZIPOutputStream.write(bArr, 0, read);
}
}
public static byte[] e(byte[] bArr) throws Exception {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{bArr}, null, changeQuickRedirect, true, PsExtractor.AUDIO_STREAM, new Class[]{byte[].class}, byte[].class);
if (proxy.isSupported) {
return (byte[]) proxy.result;
}
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
d(byteArrayInputStream, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.flush();
byteArrayOutputStream.close();
byteArrayInputStream.close();
return byteArray;
}
public static String f(Map<String, String> map) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{map}, null, changeQuickRedirect, true, 185, new Class[]{Map.class}, String.class);
if (proxy.isSupported) {
return (String) proxy.result;
}
if (map == null) {
return "";
}
StringBuffer stringBuffer = new StringBuffer();
int i = 0;
for (String str : map.keySet()) {
if (i > 0) {
stringBuffer.append("&");
}
String str2 = map.get(str);
try {
String encode = URLEncoder.encode(str, C.UTF8_NAME);
if (str2 == null) {
str2 = "";
}
String encode2 = URLEncoder.encode(str2, C.UTF8_NAME);
stringBuffer.append(encode);
stringBuffer.append("=");
stringBuffer.append(encode2);
} catch (UnsupportedEncodingException e2) {
vs.a.c(e2);
}
i++;
}
return stringBuffer.toString();
}
public static String p(String str, Map<String, String> map) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, map}, null, changeQuickRedirect, true, PsExtractor.PRIVATE_STREAM_1, new Class[]{String.class, Map.class}, String.class);
return proxy.isSupported ? (String) proxy.result : q(str, map, 1);
}
public static String q(String str, Map<String, String> map, int i) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, map, new Integer(i)}, null, changeQuickRedirect, true, 190, new Class[]{String.class, Map.class, Integer.TYPE}, String.class);
return proxy.isSupported ? (String) proxy.result : s(str, f(map), i);
}
public static String s(String str, String str2, int i) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, str2, new Integer(i)}, null, changeQuickRedirect, true, 184, new Class[]{String.class, String.class, Integer.TYPE}, String.class);
return proxy.isSupported ? (String) proxy.result : new b(str).r(str2);
}
public final byte[] g(byte[] bArr, String str, String str2, InputStream inputStream) {
List<String> list;
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{bArr, str, str2, inputStream}, this, changeQuickRedirect, false, 167, new Class[]{byte[].class, String.class, String.class, InputStream.class}, byte[].class);
if (proxy.isSupported) {
return (byte[]) proxy.result;
}
vs.a.a(this.a + "doIPRetry");
if (t == null) {
return bArr;
}
String host = Uri.parse(str).getHost();
if (TextUtils.isEmpty(host) || (list = t.get(host)) == null) {
return bArr;
}
byte[] bArr2 = null;
for (String str3 : list) {
vs.a.a("#61939,读取到重试域名/IP,域名/IP=" + str3);
if (inputStream != null) {
try {
inputStream.reset();
} catch (IOException e2) {
e2.printStackTrace();
}
}
String replaceFirst = str.replaceFirst(host, str3);
try {
vs.a.a("#61939,域名/IP=" + str3 + "开始重试!");
bArr2 = i(replaceFirst, str2, inputStream);
vs.a.a("#61939,域名/IP=" + str3 + "重试成功!");
return bArr2;
} catch (IOException e3) {
vs.a.c(e3);
vs.a.a("#61939,重试失败!继续重试下一个域名/IP!");
} catch (Exception e4) {
vs.a.c(e4);
vs.a.a("#61939,重试失败!继续重试下一个域名/IP!");
}
}
return bArr2;
}
public final byte[] h(InputStream inputStream, int i) throws IOException {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{inputStream, new Integer(i)}, this, changeQuickRedirect, false, 149, new Class[]{InputStream.class, Integer.TYPE}, byte[].class);
if (proxy.isSupported) {
return (byte[]) proxy.result;
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[4096];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
byte[] byteArray = byteArrayOutputStream.toByteArray();
inputStream.close();
byteArrayOutputStream.close();
return byteArray;
}
byteArrayOutputStream.write(bArr, 0, read);
}
}
public final byte[] i(String str, String str2, InputStream inputStream) throws IOException {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, str2, inputStream}, this, changeQuickRedirect, false, 158, new Class[]{String.class, String.class, InputStream.class}, byte[].class);
if (proxy.isSupported) {
return (byte[]) proxy.result;
}
vs.a.a("url:" + str);
c.a h = zl.c.h(str);
if (h != null) {
str = h.c;
}
new URL(str);
HttpURLConnection k = k(str, str2);
zl.c.i(k, h);
if ("POST".equals(str2)) {
k.setDoOutput(true);
if (inputStream != null) {
n(k.getOutputStream(), inputStream);
inputStream.close();
}
}
k.connect();
vs.a.e("responseCode:" + k.getResponseCode() + ", responseMessage:" + k.getResponseMessage());
InputStream inputStream2 = k.getInputStream();
if (inputStream2 == null) {
inputStream2 = k.getErrorStream();
}
byte[] h2 = h(inputStream2, k.getContentLength());
k.disconnect();
return h2;
}
public final boolean j() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 147, new Class[0], Boolean.TYPE);
if (proxy.isSupported) {
return ((Boolean) proxy.result).booleanValue();
}
if (this.d.containsKey("Content-Encoding")) {
return "gzip".equals(this.d.get("Content-Encoding"));
}
return false;
}
public final HttpURLConnection k(String str, String str2) throws IOException {
HttpURLConnection httpURLConnection;
HttpsURLConnection httpsURLConnection;
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, str2}, this, changeQuickRedirect, false, 155, new Class[]{String.class, String.class}, HttpURLConnection.class);
if (proxy.isSupported) {
return (HttpURLConnection) proxy.result;
}
vs.a.a("oponConnection-->" + str);
URL url = new URL(str);
String protocol = url.getProtocol();
if (protocol == null || protocol.length() == 0) {
throw new IOException("protocol is null");
}
if (protocol.equals("http")) {
vs.a.a("92241>http");
Proxy proxy2 = this.c;
if (proxy2 != null) {
httpURLConnection = (HttpURLConnection) url.openConnection(proxy2);
} else {
String host = url.getHost();
String str3 = this.q.get(host);
vs.a.a("host:" + host + " ip:" + str3);
if (str3 != null) {
httpURLConnection = (HttpURLConnection) l(new URL(str.replace(host, str3)));
httpURLConnection.setRequestProperty("Host", host);
} else {
httpURLConnection = (HttpURLConnection) l(url);
}
}
} else {
a aVar = null;
if (protocol.equals("https")) {
vs.a.a("92241>https");
if (this.c != null) {
vs.a.a("92241>mProxy!= null");
httpsURLConnection = (HttpsURLConnection) url.openConnection(this.c);
} else {
vs.a.a("92241>mProxy== null");
String host2 = url.getHost();
String str4 = this.q.get(host2);
vs.a.a("host:" + host2 + " ip:" + str4);
if (str4 != null) {
vs.a.a("92241>ip != null " + str4);
httpsURLConnection = (HttpsURLConnection) l(new URL(str.replace(host2, str4)));
httpsURLConnection.setRequestProperty("Host", host2);
this.l = new e(host2);
this.m = new a(host2);
} else {
vs.a.a("92241>ip== null");
httpsURLConnection = (HttpsURLConnection) l(url);
}
}
HttpsURLConnection httpsURLConnection2 = httpsURLConnection;
if (this.l != null) {
vs.a.a("92241>mSSLSocketFactory != null");
httpsURLConnection2.setSSLSocketFactory(c(this.l));
HostnameVerifier hostnameVerifier = this.m;
if (hostnameVerifier != null) {
httpsURLConnection2.setHostnameVerifier(hostnameVerifier);
}
} else if (r != null) {
vs.a.a("92241>sDefaultSSLSocketFactory != null");
httpsURLConnection2.setSSLSocketFactory(c(r));
HostnameVerifier hostnameVerifier2 = s;
if (hostnameVerifier2 != null) {
httpsURLConnection2.setHostnameVerifier(hostnameVerifier2);
}
} else if (this.n) {
vs.a.a("92241>mAllowAny true");
try {
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(new KeyManager[0], new TrustManager[]{new d(aVar)}, new SecureRandom());
SSLContext.setDefault(sSLContext);
vs.a.a("92241>setSSLSocketFactory()--> url-->" + str);
httpsURLConnection2.setSSLSocketFactory(c(sSLContext.getSocketFactory()));
httpsURLConnection2.setHostnameVerifier(new C0299b());
} catch (KeyManagementException e2) {
vs.a.c(e2);
} catch (NoSuchAlgorithmException e3) {
vs.a.c(e3);
}
}
httpURLConnection = httpsURLConnection2;
} else {
httpURLConnection = null;
}
}
if (httpURLConnection == null) {
throw new IOException("connection is null");
}
httpURLConnection.setConnectTimeout(this.e);
httpURLConnection.setReadTimeout(this.f);
httpURLConnection.setRequestMethod(str2);
int i = this.i;
if (i != -1) {
httpURLConnection.setUseCaches(i == 1);
}
Boolean bool = this.j;
if (bool != null) {
httpURLConnection.setInstanceFollowRedirects(bool.booleanValue());
}
httpURLConnection.setDoInput(true);
for (String str5 : this.d.keySet()) {
httpURLConnection.setRequestProperty(str5, this.d.get(str5));
}
return httpURLConnection;
}
public final URLConnection l(URL url) throws IOException {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{url}, this, changeQuickRedirect, false, 156, new Class[]{URL.class}, URLConnection.class);
return proxy.isSupported ? (URLConnection) proxy.result : m(url, null);
}
public final URLConnection m(URL url, Proxy proxy) throws IOException {
Network network;
PatchProxyResult proxy2 = PatchProxy.proxy(new Object[]{url, proxy}, this, changeQuickRedirect, false, 157, new Class[]{URL.class, Proxy.class}, URLConnection.class);
return proxy2.isSupported ? (URLConnection) proxy2.result : (Build.VERSION.SDK_INT < 23 || (network = this.p) == null) ? proxy == null ? url.openConnection() : url.openConnection(proxy) : proxy == null ? network.openConnection(url) : network.openConnection(url, proxy);
}
public final void n(OutputStream outputStream, InputStream inputStream) throws IOException {
if (PatchProxy.proxy(new Object[]{outputStream, inputStream}, this, changeQuickRedirect, false, 148, new Class[]{OutputStream.class, InputStream.class}, Void.TYPE).isSupported) {
return;
}
inputStream.available();
byte[] bArr = new byte[4096];
while (true) {
int read = inputStream.read(bArr, 0, 4096);
if (read == -1) {
outputStream.flush();
outputStream.close();
return;
}
outputStream.write(bArr, 0, read);
}
}
public byte[] o(byte[] bArr) {
char c2;
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{bArr}, this, changeQuickRedirect, false, 166, new Class[]{byte[].class}, byte[].class);
if (proxy.isSupported) {
return (byte[]) proxy.result;
}
byte[] bArr2 = null;
if (bArr == null) {
return null;
}
if (j()) {
try {
bArr = e(bArr);
} catch (Exception e2) {
vs.a.c(e2);
this.d.remove("Content-Encoding");
c2 = 4;
}
}
c2 = 0;
for (int i = 0; i < this.g; i++) {
try {
bArr2 = i(this.b, "POST", new ByteArrayInputStream(bArr));
} catch (IOException e3) {
vs.a.c(e3);
c2 = 1;
} catch (Exception e4) {
vs.a.c(e4);
c2 = 3;
}
if (c2 == 0) {
break;
}
}
if (c2 == 0 || !this.o) {
return bArr2;
}
vs.a.a("#61939,请求失败,开始IP/域名重试,url=" + this.b + "; 是否需要IP重试:" + this.o);
return g(bArr2, this.b, "POST", new ByteArrayInputStream(bArr));
}
public String r(String str) {
byte[] bArr;
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 186, new Class[]{String.class}, String.class);
if (proxy.isSupported) {
return (String) proxy.result;
}
try {
bArr = o(str.getBytes(C.UTF8_NAME));
} catch (UnsupportedEncodingException e2) {
vs.a.c(e2);
bArr = null;
}
if (bArr != null && bArr.length != 0) {
try {
return new String(bArr, C.UTF8_NAME);
} catch (UnsupportedEncodingException e3) {
vs.a.c(e3);
}
}
return "";
}
}