Kate Mobile v109.1版本的 MD5 值为:fcd76ded5f363ecbfac46035a4ed2a23
以下内容为反编译后的 UkrBlockChecker.java 源代码,内容仅作参考
package com.perm.utils;
import android.util.Log;
import com.perm.kate.Helper;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public abstract class UkrBlockChecker {
static List results;
public static class MyThread extends Thread {
public int index;
private MyThread() {
}
@Override
public void run() {
try {
int i = this.index;
UkrBlockChecker.results.set(this.index, i != 0 ? i != 1 ? i != 2 ? i != 3 ? null : Boolean.FALSE : UkrBlockChecker.checkUrl("https://vk.com") : UkrBlockChecker.checkUrl("https://api.vk.com") : Boolean.valueOf(UkrBlockChecker.checkUrlWithProxyOkHttp("https://api.vk.com")));
} catch (Throwable th) {
th.printStackTrace();
Helper.reportError(th);
}
}
}
private static int arrayToResult() {
if (((Boolean) results.get(1)).booleanValue() && ((Boolean) results.get(2)).booleanValue()) {
return 0;
}
if (((Boolean) results.get(0)).booleanValue()) {
return 1;
}
return ((Boolean) results.get(3)).booleanValue() ? 3 : 2;
}
public static int check() {
try {
makeResultsArray();
ArrayList arrayList = new ArrayList();
startThreads(arrayList);
waitThreadsToFinish(arrayList);
Log.i("Kate.BlockChecker", results.toString());
return arrayToResult();
} catch (Throwable th) {
th.printStackTrace();
return 1;
}
}
public static Boolean checkUrl(String str) {
Throwable th;
HttpURLConnection httpURLConnection;
try {
httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
try {
httpURLConnection.setConnectTimeout(3000);
httpURLConnection.setReadTimeout(3000);
httpURLConnection.getResponseCode();
Boolean bool = Boolean.TRUE;
httpURLConnection.disconnect();
return bool;
} catch (Throwable th2) {
th = th2;
try {
th.printStackTrace();
return Boolean.FALSE;
} finally {
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
}
}
} catch (Throwable th3) {
th = th3;
httpURLConnection = null;
}
}
public static boolean checkUrlWithProxyOkHttp(String str) {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(ProxyManager.getServer(), ProxyManager.getPort())));
httpURLConnection.setConnectTimeout(30000);
httpURLConnection.setReadTimeout(30000);
httpURLConnection.setUseCaches(false);
httpURLConnection.setDoOutput(false);
httpURLConnection.setDoInput(true);
httpURLConnection.setRequestMethod("GET");
httpURLConnection.getResponseCode();
return true;
} catch (Throwable th) {
th.printStackTrace();
return false;
}
}
private static void makeResultsArray() {
ArrayList arrayList = new ArrayList(4);
for (int i = 0; i < 4; i++) {
arrayList.add(null);
}
results = Collections.synchronizedList(arrayList);
}
private static void startThreads(ArrayList arrayList) {
for (int i = 0; i < 4; i++) {
MyThread myThread = new MyThread();
myThread.index = i;
arrayList.add(myThread);
myThread.start();
}
}
private static void waitThreadsToFinish(ArrayList arrayList) {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
try {
((Thread) it.next()).join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}