MD5 校验值:d47de9d0b292a5cbd7377502c33607ba
DtVpnService.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.sshlib.service; import a5.i; import android.app.NotificationManager; import android.content.Intent; import android.net.VpnService; import android.os.Build; import android.os.ParcelFileDescriptor; import android.os.StrictMode; import android.text.TextUtils; import java.lang.ref.SoftReference; import java.math.BigInteger; import java.net.Inet4Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.Locale; import java.util.Vector; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import n4.a; import p4.b; import p4.c; import p4.d; import p4.h; import p4.j; import p4.k; public class DtVpnService extends VpnService implements a { public static final int f1985v = 0; public d4.a f1988o; public h f1989p; public d f1990q; public m4.a f1991r; public ParcelFileDescriptor f1992s; public ExecutorService f1993t; public Vector f1986m = new Vector(); public c f1987n = new c(0); public Future f1994u = null; public final void a() { boolean z9; String str; String str2; boolean z10; boolean z11; boolean z12; String hostAddress; Locale.setDefault(new Locale("en")); VpnService.Builder builder = new VpnService.Builder(this); if (Build.VERSION.SDK_INT >= 29) { builder.setMetered(false); } int i10 = k.f7268a; HashMap hashMap = new HashMap(); hashMap.put("10", new j("10.0.0.1", 8, "10.0.0.0", "10.0.0.2")); hashMap.put("172", new j("172.16.0.1", 12, "172.16.0.0", "172.16.0.2")); hashMap.put("192", new j("192.168.0.1", 16, "192.168.0.0", "192.168.0.2")); try { Iterator it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator(); while (it.hasNext()) { Iterator it2 = Collections.list(((NetworkInterface) it.next()).getInetAddresses()).iterator(); while (it2.hasNext()) { InetAddress inetAddress = (InetAddress) it2.next(); if (!inetAddress.isLoopbackAddress() && (inetAddress instanceof Inet4Address) && (hostAddress = inetAddress.getHostAddress()) != null) { if (hostAddress.startsWith("10.")) { hashMap.remove("10"); } else if (hostAddress.length() >= 6 && hostAddress.substring(0, 6).compareTo("172.16") >= 0 && hostAddress.substring(0, 6).compareTo("172.31") <= 0) { hashMap.remove("172"); } else if (hostAddress.startsWith("192.168")) { hashMap.remove("192"); } } } } if (hashMap.size() > 0) { j jVar = (j) hashMap.values().iterator().next(); String str3 = jVar.f7264a; int i11 = jVar.f7266c; builder.addAddress(str3, i11); String hostAddress2 = i.c(this.f1991r.a()).getHostAddress(); String str4 = this.f1991r.f6193d; if (str4 != null && !str4.equals("0.0.0.0")) { z9 = true; } else { str4 = (String) k.b(this).get(0); z9 = false; } builder.addDnsServer(str4); this.f1986m.add(str4); String str5 = this.f1991r.f6194e; if (str5 == null || str5.equals("0.0.0.0")) { str5 = (String) k.b(this).get(1); z9 = false; } builder.addDnsServer(str5); this.f1986m.add(str5); this.f1987n.a(new p4.a(32, 0, str4), z9); this.f1987n.a(new p4.a(32, 0, str5), z9); this.f1987n.a(new p4.a(8, 0, "10.0.0.0"), false); this.f1987n.a(new p4.a(i11, 0, jVar.f7265b), false); this.f1987n.a(new p4.a(32, 0, hostAddress2), false); this.f1987n.a(new p4.a(0, 0, "0.0.0.0"), true); b bVar = new b(new p4.a(3, 0, "224.0.0.0"), true); Iterator it3 = this.f1987n.e().iterator(); while (it3.hasNext()) { b bVar2 = (b) it3.next(); try { BigInteger a10 = bVar.a(); BigInteger c4 = bVar.c(); BigInteger a11 = bVar2.a(); BigInteger c10 = bVar2.c(); if (a10.compareTo(a11) != 1) { z10 = true; } else { z10 = false; } if (c4.compareTo(c10) != -1) { z11 = true; } else { z11 = false; } if (z10 && z11) { z12 = true; } else { z12 = false; } if (!z12) { builder.addRoute(bVar2.b(), bVar2.f7233n); } } catch (IllegalArgumentException unused) { d4.a aVar = this.f1988o; Object[] objArr = {bVar2.b()}; aVar.getClass(); d4.a.a("LBL_ROUTES_INFO_EXCL", objArr); } } d4.a aVar2 = this.f1988o; if (z9) { str = "LBL_DNS_FORWARDING_ENABLED"; } else { str = "LBL_DNS_FORWARDING_DISABLED"; } aVar2.getClass(); d4.a.a(str, new Object[0]); d4.a aVar3 = this.f1988o; String str6 = jVar.f7264a; Object[] objArr2 = {str6, Integer.valueOf(i11), 1500}; aVar3.getClass(); d4.a.a("LBL_LOCAL_IP_INFO", objArr2); d4.a aVar4 = this.f1988o; Object[] objArr3 = {TextUtils.join(", ", this.f1986m)}; aVar4.getClass(); d4.a.a("LBL_DNS_SERVER_INFO", objArr3); d4.a aVar5 = this.f1988o; Object[] objArr4 = {TextUtils.join(", ", this.f1987n.d(true))}; aVar5.getClass(); d4.a.a("LBL_ROUTES_INFO_INCL", objArr4); String replace = TextUtils.join(", ", this.f1987n.d(false)).replace(hostAddress2, "***"); this.f1988o.getClass(); d4.a.a("LBL_ROUTES_INFO_EXCL", replace); builder.setMtu(1500); builder.setSession(this.f1991r.f6190a); ParcelFileDescriptor establish = builder.establish(); this.f1992s = establish; if (establish == null) { this.f1988o.getClass(); d4.a.a("LBL_ERROR_INTERFACE_TUN", new Object[0]); b(); return; } String str7 = jVar.f7267d; Boolean valueOf = Boolean.valueOf(z9); this.f1991r.getClass(); String str8 = "127.0.0.1:" + this.f1991r.f6197h; if (valueOf.booleanValue()) { str2 = str6 + ":5501"; d dVar = new d(this, (String[]) this.f1986m.toArray(new String[0]), str6); this.f1990q = dVar; dVar.start(); } else { str2 = null; } h hVar = new h(this, establish, str7, str8, str2); this.f1989p = hVar; hVar.f7263x = new b0.b(5, this); hVar.start(); return; } throw new Exception("no private address available"); } catch (SocketException e10) { e10.printStackTrace(); throw new Exception("selectPrivateAddress failed", e10); } } public final void b() { Future future = this.f1994u; if (future == null || future.isDone()) { this.f1994u = this.f1993t.submit(new androidx.activity.b(10, this)); } } public final void c() { h hVar = this.f1989p; if (hVar != null) { hVar.interrupt(); this.f1989p = null; } d dVar = this.f1990q; if (dVar != null) { dVar.interrupt(); this.f1990q = null; } } @Override public final void onCreate() { String str; super.onCreate(); this.f1988o = new d4.a(); Object[] objArr = new Object[1]; try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); loop0: while (true) { if (networkInterfaces.hasMoreElements()) { Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses(); while (inetAddresses.hasMoreElements()) { InetAddress nextElement = inetAddresses.nextElement(); if (!nextElement.isLoopbackAddress() && (nextElement instanceof Inet4Address)) { break loop0; } } } else { str = "No IP Available"; break; } } } catch (SocketException unused) { str = "ERROR Obtaining IP"; } objArr[0] = str; d4.a.a("LBL_LOCAL_IP", objArr); this.f1993t = Executors.newSingleThreadExecutor(); StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build()); VpnServiceManager.a().f2000e = new SoftReference(this); } @Override public final void onDestroy() { super.onDestroy(); this.f1988o = null; VpnServiceManager.a().getClass(); ((NotificationManager) getSystemService("notification")).cancel(1557); stopForeground(true); } @Override public final void onRevoke() { super.onRevoke(); VpnServiceManager.a().c(); } @Override public final int onStartCommand(Intent intent, int i10, int i11) { VpnServiceManager.a().b(); return 1; } }