GOUTY SSH V2 🌐 v4.2.5版本的 MD5 值为:635449b1ebcf1b9e08b24bdcbf1c404a
以下内容为反编译后的 n.java 源代码,内容仅作参考
package v8;
import android.net.LocalServerSocket;
import android.net.LocalSocket;
import android.net.VpnService;
import android.os.Build;
import android.os.Handler;
import android.os.ParcelFileDescriptor;
import android.system.Os;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import de.blinkt.openvpn.core.OpenVPNService;
import h0.r;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Vector;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import l9.o;
import l9.q;
public final class n implements Runnable, i {
public static final Vector L;
public final Handler A;
public final LinkedList B;
public LocalSocket C;
public LocalServerSocket D;
public boolean E;
public int F;
public h G;
public boolean H;
public final z7.a I;
public final w7.d J;
public final androidx.activity.b K;
public final u8.a f10175w;
public final OpenVPNService f10176x;
public final w8.a f10177y;
public final m2.a f10178z;
static {
new b(6, 0);
L = new Vector();
}
public n(u8.a aVar, OpenVPNService openVPNService, w8.a aVar2, m2.a aVar3) {
o9.f.l("logger", aVar3);
this.f10175w = aVar;
this.f10176x = openVPNService;
this.f10177y = aVar2;
this.f10178z = aVar3;
this.A = new Handler(openVPNService.getMainLooper());
this.B = new LinkedList();
this.F = 1;
this.I = new z7.a(Integer.parseInt(aVar.f9759j0[0].f10159x));
w7.d b10 = aVar2.b();
this.J = b10;
b10.f10652j = new r(12, this);
b10.f10651i = new d8.e(1, this);
this.K = new androidx.activity.b(15, this);
}
public final boolean a(String str) {
OutputStream outputStream;
OutputStream outputStream2;
try {
LocalSocket localSocket = this.C;
if (localSocket != null && (outputStream2 = localSocket.getOutputStream()) != null) {
byte[] bytes = str.getBytes(ic.a.f5842a);
o9.f.k("this as java.lang.String).getBytes(charset)", bytes);
outputStream2.write(bytes);
}
LocalSocket localSocket2 = this.C;
if (localSocket2 == null || (outputStream = localSocket2.getOutputStream()) == null) {
return true;
}
outputStream.flush();
return true;
} catch (IOException unused) {
return false;
}
}
public final String b(String str) {
String[] strArr;
String str2;
String str3;
long j10;
int i10;
m2.a aVar;
String str4;
boolean z10;
ParcelFileDescriptor parcelFileDescriptor;
x8.b bVar;
String format;
boolean z11;
StringBuilder sb2;
int i11;
h hVar;
char c10;
String str5 = str;
while (ic.n.U(str5, "\n")) {
String[] strArr2 = (String[]) h4.a.s("\\r?\\n", 2, str5).toArray(new String[0]);
String str6 = strArr2[0];
boolean y02 = ic.n.y0(str6, ">", false);
LinkedList linkedList = this.B;
if (y02 && ic.n.U(str6, ":")) {
String[] strArr3 = (String[]) h4.a.s(":", 2, str6).toArray(new String[0]);
String substring = strArr3[0].substring(1);
o9.f.k("this as java.lang.String).substring(startIndex)", substring);
String str7 = strArr3[1];
int hashCode = substring.hashCode();
Collection collection = q.f7430w;
m2.a aVar2 = this.f10178z;
OpenVPNService openVPNService = this.f10176x;
switch (hashCode) {
case -1747950989:
if (substring.equals("NEED-OK")) {
int c02 = ic.n.c0(str7, '\'', 0, false, 6) + 1;
String substring2 = str7.substring(c02, ic.n.c0(str7, '\'', c02, false, 4));
o9.f.k("this as java.lang.String…ing(startIndex, endIndex)", substring2);
String str8 = ((String[]) h4.a.s(":", 2, str7).toArray(new String[0]))[1];
String str9 = "ok";
switch (substring2.hashCode()) {
case -2116912211:
strArr = strArr2;
str3 = "format(format, *args)";
if (substring2.equals("PROTECTFD")) {
FileDescriptor fileDescriptor = (FileDescriptor) linkedList.pollFirst();
if (fileDescriptor != null) {
try {
Object invoke = FileDescriptor.class.getDeclaredMethod("getInt$", new Class[0]).invoke(fileDescriptor, new Object[0]);
o9.f.j("null cannot be cast to non-null type kotlin.Int", invoke);
int intValue = ((Integer) invoke).intValue();
if (!openVPNService.protect(intValue)) {
Log.e("openvpn", "Could not protect fd " + intValue);
}
try {
Os.close(fileDescriptor);
} catch (Exception e10) {
e10.printStackTrace();
}
} catch (Exception e11) {
e11.printStackTrace();
Log.d("Openvpn", "Failed to retrieve fd from socket: " + fileDescriptor);
}
}
String format2 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str9}, 2));
o9.f.k(str3, format2);
a(format2);
}
String[] strArr4 = strArr;
if (strArr4.length == 1) {
}
break;
case -1929611617:
strArr = strArr2;
str3 = "format(format, *args)";
if (substring2.equals("IFCONFIG")) {
List s10 = h4.a.s(" ", 0, str8);
if (!s10.isEmpty()) {
ListIterator listIterator = s10.listIterator(s10.size());
while (true) {
if (listIterator.hasPrevious()) {
if (!(((String) listIterator.previous()).length() == 0)) {
collection = o.b1(s10, listIterator.nextIndex() + 1);
}
}
}
}
String[] strArr5 = (String[]) collection.toArray(new String[0]);
int parseInt = Integer.parseInt(strArr5[2]);
String str10 = strArr5[0];
String str11 = strArr5[1];
String str12 = strArr5[3];
openVPNService.getClass();
o9.f.l("local", str10);
o9.f.l("netmask", str11);
o9.f.l("mode", str12);
openVPNService.E = new x8.a(str10, str11);
openVPNService.F = parseInt;
openVPNService.H = null;
b bVar2 = x8.a.f10986c;
long e12 = bVar2.e(str11);
x8.a aVar3 = openVPNService.E;
o9.f.i(aVar3);
if (aVar3.f10988b == 32 && !o9.f.d(str11, "255.255.255.255")) {
if (o9.f.d("net30", str12)) {
i10 = 30;
j10 = -4;
} else {
j10 = -2;
i10 = 31;
}
long j11 = e12 & j10;
long e13 = bVar2.e(str10) & j10;
x8.a aVar4 = openVPNService.E;
o9.f.i(aVar4);
if (j11 == e13) {
aVar4.f10988b = i10;
} else {
aVar4.f10988b = 32;
}
}
x8.a aVar5 = openVPNService.E;
o9.f.i(aVar5);
if (aVar5.f10988b <= 31) {
x8.a aVar6 = openVPNService.E;
o9.f.i(aVar6);
String str13 = aVar6.f10987a;
x8.a aVar7 = openVPNService.E;
o9.f.i(aVar7);
x8.a aVar8 = new x8.a(str13, aVar7.f10988b);
aVar8.a();
openVPNService.f3760x.f10993a.add(new x8.b(aVar8, true));
}
openVPNService.H = str11;
String format22 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str9}, 2));
o9.f.k(str3, format22);
a(format22);
}
String[] strArr42 = strArr;
if (strArr42.length == 1) {
}
break;
case -1056734836:
strArr = strArr2;
str3 = "format(format, *args)";
break;
case -545191069:
if (substring2.equals("OPENTUN")) {
if (o9.f.d(str8, "tun")) {
openVPNService.getClass();
VpnService.Builder builder = new VpnService.Builder(openVPNService);
m2.a aVar9 = openVPNService.A;
aVar9.c("LBL_OPENING_INTERFACE_TUN", new Object[0]);
x8.a aVar10 = openVPNService.E;
if (aVar10 == null) {
aVar9.c("No IP address set", new Object[0]);
parcelFileDescriptor = null;
strArr = strArr2;
str4 = "format(format, *args)";
aVar = aVar2;
} else {
try {
o9.f.k("{\n builde…ocalIP.len)\n }", builder.addAddress(aVar10.f10987a, aVar10.f10988b));
} catch (IllegalArgumentException e14) {
aVar9.c("Could not add IPv4 address " + aVar10 + ": " + e14.getLocalizedMessage(), new Object[0]);
}
Vector vector = openVPNService.f3759w;
vector.clear();
w8.a aVar11 = openVPNService.L;
if (aVar11 == null) {
o9.f.d0("config");
throw null;
}
if (!o9.f.d(aVar11.f10664e, "0.0.0.0")) {
w8.a aVar12 = openVPNService.L;
if (aVar12 == null) {
o9.f.d0("config");
throw null;
}
vector.add(aVar12.f10664e);
}
w8.a aVar13 = openVPNService.L;
if (aVar13 == null) {
o9.f.d0("config");
throw null;
}
if (!o9.f.d(aVar13.f10665f, "0.0.0.0")) {
w8.a aVar14 = openVPNService.L;
if (aVar14 == null) {
o9.f.d0("config");
throw null;
}
vector.add(aVar14.f10665f);
}
Iterator it = vector.iterator();
while (it.hasNext()) {
String str14 = (String) it.next();
try {
builder.addDnsServer(str14);
} catch (IllegalArgumentException unused) {
aVar9.c("LBL_COULD_NOT_ADD_DNS", str14);
}
}
builder.setMtu(openVPNService.F);
w8.a aVar15 = openVPNService.L;
if (aVar15 == null) {
o9.f.d0("config");
throw null;
}
InetAddress byName = InetAddress.getByName(aVar15.a());
boolean z12 = byName instanceof Inet6Address;
x8.c cVar = openVPNService.f3761y;
x8.c cVar2 = openVPNService.f3760x;
if (z12) {
Inet6Address inet6Address = (Inet6Address) byName;
cVar.getClass();
o9.f.l("address", inet6Address);
cVar.f10993a.add(new x8.b(inet6Address));
strArr = strArr2;
} else {
String hostAddress = byName.getHostAddress();
o9.f.i(hostAddress);
strArr = strArr2;
cVar2.f10993a.add(new x8.b(new x8.a(hostAddress, 32), false));
}
Vector b10 = cVar2.b();
Vector b11 = cVar.b();
aVar = aVar2;
str4 = "format(format, *args)";
x8.b bVar3 = new x8.b(new x8.a("224.0.0.0", 3), true);
Iterator it2 = b10.iterator();
while (it2.hasNext()) {
x8.b bVar4 = (x8.b) it2.next();
try {
if (bVar3.a(bVar4)) {
bVar = bVar3;
} else {
bVar = bVar3;
try {
builder.addRoute(bVar4.c(), bVar4.f10989w);
} catch (IllegalArgumentException e15) {
e = e15;
aVar9.c("LBL_ROUTE_REJECTED", bVar4 + ' ' + e.getLocalizedMessage());
bVar3 = bVar;
it2 = it2;
}
}
bVar3 = bVar;
} catch (IllegalArgumentException e16) {
e = e16;
bVar = bVar3;
}
}
Iterator it3 = b11.iterator();
while (it3.hasNext()) {
x8.b bVar5 = (x8.b) it3.next();
try {
builder.addRoute(bVar5.d(), bVar5.f10989w);
} catch (IllegalArgumentException e17) {
aVar9.c("LBL_ROUTE_REJECTED", bVar5 + ' ' + e17.getLocalizedMessage());
}
}
if ((!cVar2.a(false).isEmpty() || !cVar.a(false).isEmpty()) && Build.VERSION.SDK_INT >= 29) {
openVPNService.isLockdownEnabled();
}
Object[] objArr = new Object[3];
x8.a aVar16 = openVPNService.E;
objArr[0] = aVar16 != null ? aVar16.f10987a : null;
objArr[1] = aVar16 != null ? Integer.valueOf(aVar16.f10988b) : null;
objArr[2] = Integer.valueOf(openVPNService.F);
aVar9.c("LBL_LOCAL_IP_INFO", objArr);
if (!vector.isEmpty()) {
aVar9.c("LBL_DNS_SERVER_INFO", o.M0(vector, ", ", null, null, null, 62));
}
aVar9.c("LBL_ROUTES_INFO_INCL", o.M0(cVar2.a(true), ", ", null, null, null, 62));
if (cVar2.a(false).isEmpty()) {
z10 = false;
} else {
z10 = false;
aVar9.c("LBL_ROUTES_INFO_EXCL", o.M0(cVar2.a(false), ", ", null, null, null, 62));
}
if (!cVar.a(z10).isEmpty()) {
aVar9.c("LBL_ROUTES_INFO_EXCL", o.M0(cVar.a(z10), ", ", null, null, null, 62));
}
vector.clear();
cVar2.f10993a.clear();
cVar.f10993a.clear();
try {
parcelFileDescriptor = builder.establish();
} catch (Exception e18) {
String localizedMessage = e18.getLocalizedMessage();
if (localizedMessage != null) {
aVar9.c(localizedMessage, new Object[0]);
}
parcelFileDescriptor = null;
}
if (parcelFileDescriptor == null) {
throw new NullPointerException("Android establish() method returned null (Really broken network configuration?)");
break;
} else {
openVPNService.B = parcelFileDescriptor != null;
}
}
if (parcelFileDescriptor == null) {
str3 = str4;
} else {
try {
LocalSocket localSocket = this.C;
if (localSocket != null) {
localSocket.setFileDescriptorsForSend(new FileDescriptor[]{parcelFileDescriptor.getFileDescriptor()});
}
format = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, "ok"}, 2));
str3 = str4;
} catch (Exception e19) {
e = e19;
str3 = str4;
}
try {
o9.f.k(str3, format);
a(format);
LocalSocket localSocket2 = this.C;
if (localSocket2 != null) {
localSocket2.setFileDescriptorsForSend(null);
}
parcelFileDescriptor.close();
z11 = true;
} catch (Exception e20) {
e = e20;
e.printStackTrace();
String message = e.getMessage();
if (message != null) {
aVar.c(message, new Object[0]);
}
z11 = false;
if (!z11) {
}
String[] strArr422 = strArr;
if (strArr422.length == 1) {
}
}
if (!z11) {
str9 = "cancel";
String format222 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str9}, 2));
o9.f.k(str3, format222);
a(format222);
}
String[] strArr4222 = strArr;
if (strArr4222.length == 1) {
}
}
} else {
strArr = strArr2;
str3 = "format(format, *args)";
}
z11 = false;
if (!z11) {
}
String[] strArr42222 = strArr;
if (strArr42222.length == 1) {
}
}
strArr = strArr2;
String[] strArr422222 = strArr;
if (strArr422222.length == 1) {
}
break;
case 78166569:
if (substring2.equals("ROUTE")) {
List s11 = h4.a.s(" ", 0, str8);
if (!s11.isEmpty()) {
ListIterator listIterator2 = s11.listIterator(s11.size());
while (true) {
if (listIterator2.hasPrevious()) {
if (!(((String) listIterator2.previous()).length() == 0)) {
collection = o.b1(s11, listIterator2.nextIndex() + 1);
}
}
}
}
String[] strArr6 = (String[]) collection.toArray(new String[0]);
if (strArr6.length == 5) {
openVPNService.a(strArr6[0], strArr6[1], strArr6[2], strArr6[4]);
} else if (strArr6.length >= 3) {
openVPNService.a(strArr6[0], strArr6[1], strArr6[2], null);
} else {
Log.e("openvpn", "Got invalid route from server: ".concat(str8));
}
strArr = strArr2;
str3 = "format(format, *args)";
String format2222 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str9}, 2));
o9.f.k(str3, format2222);
a(format2222);
String[] strArr4222222 = strArr;
if (strArr4222222.length == 1) {
}
}
strArr = strArr2;
String[] strArr42222222 = strArr;
if (strArr42222222.length == 1) {
}
break;
case 801000499:
if (substring2.equals("PERSIST_TUN_ACTION")) {
String str15 = "TUNCFG UNQIUE STRING ips:";
if (openVPNService.E != null) {
str15 = "TUNCFG UNQIUE STRING ips:" + openVPNService.E;
}
StringBuilder sb3 = new StringBuilder();
sb3.append(str15);
sb3.append("routes: ");
x8.c cVar3 = openVPNService.f3760x;
sb3.append(TextUtils.join("|", cVar3.a(true)));
x8.c cVar4 = openVPNService.f3761y;
sb3.append(TextUtils.join("|", cVar4.a(true)));
String str16 = (sb3.toString() + "excl. routes:" + TextUtils.join("|", cVar3.a(false)) + TextUtils.join("|", cVar4.a(false))) + "dns: " + TextUtils.join("|", openVPNService.f3759w);
StringBuilder sb4 = new StringBuilder();
sb4.append(str16);
sb4.append("mtu: ");
sb4.append(openVPNService.F);
str9 = o9.f.d(sb4.toString(), null) ? "NOACTION" : "OPEN_BEFORE_CLOSE";
strArr = strArr2;
str3 = "format(format, *args)";
String format22222 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str9}, 2));
o9.f.k(str3, format22222);
a(format22222);
String[] strArr422222222 = strArr;
if (strArr422222222.length == 1) {
}
}
strArr = strArr2;
String[] strArr4222222222 = strArr;
if (strArr4222222222.length == 1) {
}
break;
case 2021854672:
break;
default:
strArr = strArr2;
String[] strArr42222222222 = strArr;
if (strArr42222222222.length == 1) {
}
break;
}
}
strArr = strArr2;
str2 = "Got unrecognized command";
break;
case -1631557645:
if (substring.equals("INFOMSG")) {
sb2 = new StringBuilder("INFOMSG: ");
sb2.append(str7);
Log.e("OpenVPN", sb2.toString());
strArr = strArr2;
String[] strArr422222222222 = strArr;
if (strArr422222222222.length == 1) {
}
}
strArr = strArr2;
str2 = "Got unrecognized command";
break;
case 75556:
if (substring.equals("LOG")) {
sb2 = new StringBuilder("LOG: ");
sb2.append(str7);
Log.e("OpenVPN", sb2.toString());
strArr = strArr2;
String[] strArr4222222222222 = strArr;
if (strArr4222222222222.length == 1) {
}
}
strArr = strArr2;
str2 = "Got unrecognized command";
break;
case 2223295:
if (substring.equals("HOLD")) {
this.E = true;
List s12 = h4.a.s(":", 0, str7);
if (!s12.isEmpty()) {
ListIterator listIterator3 = s12.listIterator(s12.size());
while (listIterator3.hasPrevious()) {
if (!(((String) listIterator3.previous()).length() == 0)) {
i11 = 1;
collection = o.b1(s12, listIterator3.nextIndex() + 1);
int parseInt2 = Integer.parseInt(((String[]) collection.toArray(new String[0]))[i11]);
hVar = this.G;
if (hVar != null && ((f) hVar).f10165d == i11) {
this.A.postDelayed(this.K, parseInt2 * 1000);
} else if (this.F == 1) {
l2.a.J.b(openVPNService);
}
strArr = strArr2;
String[] strArr42222222222222 = strArr;
if (strArr42222222222222.length == 1) {
}
}
}
}
i11 = 1;
int parseInt22 = Integer.parseInt(((String[]) collection.toArray(new String[0]))[i11]);
hVar = this.G;
if (hVar != null) {
if (hVar != null && ((f) hVar).f10165d == i11) {
}
strArr = strArr2;
String[] strArr422222222222222 = strArr;
if (strArr422222222222222.length == 1) {
}
}
if (hVar != null && ((f) hVar).f10165d == i11) {
}
strArr = strArr2;
String[] strArr4222222222222222 = strArr;
if (strArr4222222222222222.length == 1) {
}
}
strArr = strArr2;
str2 = "Got unrecognized command";
break;
case 2251950:
break;
case 76403278:
if (substring.equals("PROXY")) {
a("proxy NONE\n");
strArr = strArr2;
String[] strArr42222222222222222 = strArr;
if (strArr42222222222222222.length == 1) {
}
}
strArr = strArr2;
str2 = "Got unrecognized command";
break;
case 79219825:
if (substring.equals("STATE")) {
if (!this.H) {
String str17 = ((String[]) h4.a.s(",", 3, str7).toArray(new String[0]))[1];
if (o9.f.d(str17, "CONNECTED")) {
openVPNService.f(true);
l2.a.B.b(openVPNService);
aVar2.c("LBL_VPN_ESTABLISHED", new Object[0]);
} else if (o9.f.d(str17, "RECONNECTING")) {
l2.a.A.b(openVPNService);
aVar2.c("LBL_STATE_RECONNECTING", new Object[0]);
} else {
l2.a[] values = l2.a.values();
int length = values.length;
int i12 = 0;
while (true) {
if (i12 < length) {
l2.a aVar17 = values[i12];
if (o9.f.d(aVar17.name(), "MSG_STATE_" + str17)) {
aVar17.b(openVPNService);
} else {
i12++;
}
}
}
openVPNService.f(false);
aVar2.c("LBL_STATE_" + str17, new Object[0]);
}
}
strArr = strArr2;
String[] strArr422222222222222222 = strArr;
if (strArr422222222222222222.length == 1) {
}
}
strArr = strArr2;
str2 = "Got unrecognized command";
break;
case 223316353:
if (substring.equals("PK_SIGN")) {
List s13 = h4.a.s(",", 0, str7);
try {
if (!s13.isEmpty()) {
ListIterator listIterator4 = s13.listIterator(s13.size());
while (listIterator4.hasPrevious()) {
if (!(((String) listIterator4.previous()).length() == 0)) {
c10 = 1;
collection = o.b1(s13, listIterator4.nextIndex() + 1);
String[] strArr7 = (String[]) collection.toArray(new String[0]);
o9.f.d(strArr7[c10], "RSA_PKCS1_PADDING");
String str18 = strArr7[0];
this.f10175w.getClass();
o9.f.k("data", Base64.decode(str18, 0));
o9.f.i(null);
throw null;
}
}
}
o9.f.i(null);
throw null;
} catch (InvalidKeyException | NoSuchAlgorithmException | SignatureException | BadPaddingException | IllegalBlockSizeException | NoSuchPaddingException unused2) {
a("pk-sig\n");
a("\nEND\n");
b.b();
break;
}
c10 = 1;
String[] strArr72 = (String[]) collection.toArray(new String[0]);
o9.f.d(strArr72[c10], "RSA_PKCS1_PADDING");
String str182 = strArr72[0];
this.f10175w.getClass();
o9.f.k("data", Base64.decode(str182, 0));
}
strArr = strArr2;
str2 = "Got unrecognized command";
break;
case 1999612571:
if (substring.equals("PASSWORD")) {
try {
if (!ic.n.y0(str7, "Auth-Token:", false)) {
int c03 = ic.n.c0(str7, '\'', 0, false, 6) + 1;
String substring3 = str7.substring(c03, ic.n.c0(str7, '\'', c03, false, 4));
o9.f.k("this as java.lang.String…ing(startIndex, endIndex)", substring3);
if (ic.n.y0(str7, "Verification Failed", false)) {
l2.a.F.b(openVPNService);
aVar2.c("LBL_AUTHENTICATION_FAILED_TEXT", new Object[0]);
e();
} else {
w8.a aVar18 = this.f10177y;
String format3 = String.format("username '%s' %s\n", Arrays.copyOf(new Object[]{substring3, k7.g.r(aVar18.f10661b)}, 2));
o9.f.k("format(format, *args)", format3);
a(format3);
String format4 = String.format("password '%s' %s\n", Arrays.copyOf(new Object[]{substring3, k7.g.r(aVar18.f10662c)}, 2));
o9.f.k("format(format, *args)", format4);
a(format4);
}
}
} catch (StringIndexOutOfBoundsException unused3) {
}
strArr = strArr2;
String[] strArr4222222222222222222 = strArr;
if (strArr4222222222222222222.length == 1) {
}
}
strArr = strArr2;
str2 = "Got unrecognized command";
break;
default:
strArr = strArr2;
str2 = "Got unrecognized command";
break;
}
} else {
strArr = strArr2;
if (!ic.n.y0(str6, "SUCCESS:", false)) {
if (ic.n.y0(str6, "PROTECTFD: ", false)) {
FileDescriptor fileDescriptor2 = (FileDescriptor) linkedList.pollFirst();
if (fileDescriptor2 != null) {
try {
Os.close(fileDescriptor2);
} catch (Exception e21) {
e21.printStackTrace();
}
}
} else {
str2 = "Got unrecognized line from managment";
}
}
String[] strArr42222222222222222222 = strArr;
str5 = strArr42222222222222222222.length == 1 ? "" : strArr42222222222222222222[1];
}
Log.i("openvpn", str2.concat(str6));
String[] strArr422222222222222222222 = strArr;
if (strArr422222222222222222222.length == 1) {
}
}
return str5;
}
public final void c() {
this.A.removeCallbacks(this.K);
this.J.d();
if (this.E) {
return;
}
a("signal SIGUSR1\n");
}
public final void d() {
z7.a aVar = this.I;
try {
aVar.getClass();
ServerSocket serverSocket = new ServerSocket();
aVar.f11520x = serverSocket;
serverSocket.bind(new InetSocketAddress("127.0.0.1", aVar.f11519w));
aVar.setName("LocalServer");
aVar.f11521y = new m(this);
aVar.start();
} catch (Exception e10) {
e10.printStackTrace();
}
}
public final boolean e() {
ServerSocket serverSocket;
this.J.d();
z7.a aVar = this.I;
aVar.getClass();
try {
ServerSocket serverSocket2 = aVar.f11520x;
if (!(serverSocket2 != null && serverSocket2.isClosed()) && (serverSocket = aVar.f11520x) != null) {
serverSocket.close();
}
} catch (IOException e10) {
e10.printStackTrace();
}
boolean b10 = b.b();
if (b10) {
this.H = true;
}
return b10;
}
@Override
public final void run() {
FileDescriptor[] fileDescriptorArr;
LocalSocket localSocket;
byte[] bArr = new byte[2048];
String str = "";
Vector vector = L;
synchronized (vector) {
vector.add(this);
}
try {
d();
LocalServerSocket localServerSocket = this.D;
o9.f.i(localServerSocket);
LocalSocket accept = localServerSocket.accept();
this.C = accept;
InputStream inputStream = accept != null ? accept.getInputStream() : null;
try {
LocalServerSocket localServerSocket2 = this.D;
o9.f.i(localServerSocket2);
localServerSocket2.close();
} catch (IOException e10) {
e10.printStackTrace();
}
a("version 3\n");
while (inputStream != null) {
int read = inputStream.read(bArr);
if (read == -1) {
return;
}
try {
localSocket = this.C;
} catch (IOException e11) {
e11.printStackTrace();
}
if (localSocket != null) {
fileDescriptorArr = localSocket.getAncillaryFileDescriptors();
if (fileDescriptorArr == null) {
Collections.addAll(o.f1(this.B), Arrays.copyOf(fileDescriptorArr, fileDescriptorArr.length));
}
Charset charset = StandardCharsets.UTF_8;
o9.f.k("UTF_8", charset);
str = b(str + new String(bArr, 0, read, charset));
}
fileDescriptorArr = null;
if (fileDescriptorArr == null) {
}
Charset charset2 = StandardCharsets.UTF_8;
o9.f.k("UTF_8", charset2);
str = b(str + new String(bArr, 0, read, charset2));
}
} catch (IOException e12) {
if (!o9.f.d(e12.getMessage(), "socket closed") && !o9.f.d(e12.getMessage(), "Connection reset by peer")) {
e12.printStackTrace();
}
Vector vector2 = L;
synchronized (vector2) {
vector2.remove(this);
}
}
}
}