暗网解密 v2.0.4版本的 MD5 值为:d3a04548fef88e775cbe4c3c6e7d81ad
以下内容为反编译后的 g.java 源代码,内容仅作参考
package c.d.a;
import android.content.Context;
import android.net.Uri;
import com.danikula.videocache.ProxyCacheException;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.TrustManager;
import tv.danmaku.ijk.media.player.IjkMediaMeta;
public class g {
public final Object f1224a;
public final ExecutorService f1225b;
public final Map<String, h> f1226c;
public final ServerSocket f1227d;
public final int f1228e;
public final Thread f1229f;
public final c.d.a.c f1230g;
public final k f1231h;
public static final class b {
public File f1232a;
public final c.d.a.t.c f1235d;
public HostnameVerifier f1237f;
public TrustManager[] f1238g;
public c.d.a.r.a f1234c = new c.d.a.r.h(IjkMediaMeta.AV_CH_STEREO_LEFT);
public c.d.a.r.c f1233b = new c.d.a.r.f();
public c.d.a.s.b f1236e = new c.d.a.s.a();
public b(Context context) {
this.f1235d = c.d.a.t.d.b(context);
this.f1232a = q.c(context);
}
public g a() {
return new g(b());
}
public final c.d.a.c b() {
return new c.d.a.c(this.f1232a, this.f1233b, this.f1234c, this.f1235d, this.f1236e, this.f1237f, this.f1238g);
}
public b c(File file) {
this.f1232a = (File) l.d(file);
return this;
}
public b d(c.d.a.r.c cVar) {
this.f1233b = (c.d.a.r.c) l.d(cVar);
return this;
}
public b e(c.d.a.s.b bVar) {
this.f1236e = (c.d.a.s.b) l.d(bVar);
return this;
}
public b f(HostnameVerifier hostnameVerifier) {
this.f1237f = hostnameVerifier;
return this;
}
public b g(int i) {
this.f1234c = new c.d.a.r.g(i);
return this;
}
public b h(long j) {
this.f1234c = new c.d.a.r.h(j);
return this;
}
public b i(TrustManager[] trustManagerArr) {
this.f1238g = trustManagerArr;
return this;
}
}
public final class c implements Runnable {
public final Socket f1239a;
public c(Socket socket) {
this.f1239a = socket;
}
@Override
public void run() {
g.this.o(this.f1239a);
}
}
public final class d implements Runnable {
public final CountDownLatch f1241a;
public d(CountDownLatch countDownLatch) {
this.f1241a = countDownLatch;
}
@Override
public void run() {
this.f1241a.countDown();
g.this.v();
}
}
public final String c(String str) {
return String.format(Locale.US, "http://%s:%d/%s", "127.0.0.1", Integer.valueOf(this.f1228e), n.f(str));
}
public final void d(Socket socket) {
try {
if (socket.isClosed()) {
return;
}
socket.close();
} catch (IOException unused) {
}
}
public final void e(Socket socket) {
try {
if (socket.isInputShutdown()) {
return;
}
socket.shutdownInput();
} catch (SocketException | IOException unused) {
}
}
public final void f(Socket socket) {
try {
if (socket.isOutputShutdown()) {
return;
}
socket.shutdownOutput();
} catch (IOException e2) {
f.g("Failed to close socket on proxy side: {}. It seems client have already closed connection.", e2.getMessage());
}
}
public final File g(String str) {
c.d.a.c cVar = this.f1230g;
return new File(cVar.f1211a, cVar.f1212b.a(str));
}
public final h h(String str) {
h hVar;
synchronized (this.f1224a) {
hVar = this.f1226c.get(str);
if (hVar == null) {
hVar = new h(str, this.f1230g);
this.f1226c.put(str, hVar);
}
}
return hVar;
}
public final int i() {
int i;
synchronized (this.f1224a) {
i = 0;
for (h hVar : this.f1226c.values()) {
i += hVar.b();
}
}
return i;
}
public String j(String str) {
return k(str, true);
}
public String k(String str, boolean z) {
if (!z || !m(str)) {
return l() ? c(str) : str;
}
File g2 = g(str);
t(g2);
return Uri.fromFile(g2).toString();
}
public final boolean l() {
return this.f1231h.e(3, 70);
}
public boolean m(String str) {
l.e(str, "Url can't be null!");
return g(str).exists();
}
public final void n(Throwable th) {
f.c("HttpProxyCacheServer error", th.getMessage());
}
public final void o(Socket socket) {
StringBuilder sb;
try {
try {
c.d.a.d c2 = c.d.a.d.c(socket.getInputStream());
String e2 = n.e(c2.f1220c);
if (this.f1231h.d(e2)) {
this.f1231h.g(socket);
} else {
h(e2).d(c2, socket);
}
q(socket);
sb = new StringBuilder();
} catch (Throwable th) {
q(socket);
f.d("Opened connections: " + i());
throw th;
}
} catch (ProxyCacheException e3) {
e = e3;
n(new ProxyCacheException("Error processing request", e));
q(socket);
sb = new StringBuilder();
} catch (SocketException unused) {
q(socket);
sb = new StringBuilder();
} catch (IOException e4) {
e = e4;
n(new ProxyCacheException("Error processing request", e));
q(socket);
sb = new StringBuilder();
}
sb.append("Opened connections: ");
sb.append(i());
f.d(sb.toString());
}
public void p(c.d.a.b bVar, String str) {
l.a(bVar, str);
synchronized (this.f1224a) {
try {
h(str).e(bVar);
} catch (ProxyCacheException e2) {
f.g("Error registering cache listener", e2.getMessage());
}
}
}
public final void q(Socket socket) {
e(socket);
f(socket);
d(socket);
}
public void r() {
f.d("Shutdown proxy server");
s();
this.f1230g.f1214d.release();
this.f1229f.interrupt();
try {
if (this.f1227d.isClosed()) {
return;
}
this.f1227d.close();
} catch (IOException e2) {
n(new ProxyCacheException("Error shutting down proxy server", e2));
}
}
public final void s() {
synchronized (this.f1224a) {
for (h hVar : this.f1226c.values()) {
hVar.f();
}
this.f1226c.clear();
}
}
public final void t(File file) {
try {
this.f1230g.f1213c.a(file);
} catch (IOException e2) {
f.b("Error touching file " + file, e2);
}
}
public void u(c.d.a.b bVar) {
l.d(bVar);
synchronized (this.f1224a) {
for (h hVar : this.f1226c.values()) {
hVar.h(bVar);
}
}
}
public final void v() {
while (!Thread.currentThread().isInterrupted()) {
try {
this.f1225b.submit(new c(this.f1227d.accept()));
} catch (IOException e2) {
n(new ProxyCacheException("Error during waiting connection", e2));
return;
}
}
}
public g(c.d.a.c cVar) {
this.f1224a = new Object();
this.f1225b = Executors.newFixedThreadPool(8);
this.f1226c = new ConcurrentHashMap();
this.f1230g = (c.d.a.c) l.d(cVar);
try {
ServerSocket serverSocket = new ServerSocket(0, 8, InetAddress.getByName("127.0.0.1"));
this.f1227d = serverSocket;
int localPort = serverSocket.getLocalPort();
this.f1228e = localPort;
j.a("127.0.0.1", localPort);
CountDownLatch countDownLatch = new CountDownLatch(1);
Thread thread = new Thread(new d(countDownLatch));
this.f1229f = thread;
thread.start();
countDownLatch.await();
this.f1231h = new k("127.0.0.1", localPort);
f.d("Proxy cache server started. Is it alive? " + l());
} catch (IOException | InterruptedException e2) {
this.f1225b.shutdown();
throw new IllegalStateException("Error starting local proxy server", e2);
}
}
}