Souza NET DTunnel v4.2.6版本的 MD5 值为:9c33be9da88136132d2ea8a79815d093
以下内容为反编译后的 r.java 源代码,内容仅作参考
package a9;
import a0.y0;
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 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;
public final class r implements Runnable, k {
public static final Vector H;
public boolean A;
public i B;
public j C;
public boolean D;
public final g8.a E;
public final d8.b F;
public final androidx.activity.b G;
public final z8.a f872s;
public final OpenVPNService f873t;
public final b9.a f874u;
public final p2.a f875v;
public final Handler f876w;
public final LinkedList f877x;
public LocalSocket f878y;
public LocalServerSocket f879z;
static {
new n8.c(9, 0);
H = new Vector();
}
public r(z8.a aVar, OpenVPNService openVPNService, b9.a aVar2, p2.a aVar3) {
q7.a.e("logger", aVar3);
this.f872s = aVar;
this.f873t = openVPNService;
this.f874u = aVar2;
this.f875v = aVar3;
this.f876w = new Handler(openVPNService.getMainLooper());
this.f877x = new LinkedList();
this.B = i.f856s;
this.E = new g8.a(Integer.parseInt(aVar.f11775f0[0].f837t));
d8.b b8 = aVar2.b();
this.F = b8;
b8.f3918j = new h0.r(12, this);
b8.f3917i = new k8.f(1, this);
this.G = new androidx.activity.b(16, this);
}
public final boolean a(String str) {
OutputStream outputStream;
OutputStream outputStream2;
try {
LocalSocket localSocket = this.f878y;
if (localSocket != null && (outputStream2 = localSocket.getOutputStream()) != null) {
byte[] bytes = str.getBytes(ia.a.f6508a);
q7.a.d("this as java.lang.String).getBytes(charset)", bytes);
outputStream2.write(bytes);
}
LocalSocket localSocket2 = this.f878y;
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;
StringBuilder sb2;
String[] strArr2;
String str2;
long j10;
int i10;
boolean z10;
p2.a aVar;
String str3;
String str4;
Integer num;
boolean z11;
ParcelFileDescriptor parcelFileDescriptor;
boolean z12;
c9.b bVar;
String format;
boolean z13;
boolean z14;
c9.c cVar;
c9.c cVar2;
String str5;
StringBuilder sb3;
char c10;
j jVar;
boolean z15;
Object obj;
char c11;
boolean z16;
String str6 = str;
while (ia.m.z(str6, "\n")) {
boolean z17 = false;
String[] strArr3 = (String[]) androidx.activity.d.t("\\r?\\n", 2, str6).toArray(new String[0]);
String str7 = strArr3[0];
boolean X = ia.m.X(str7, ">", false);
LinkedList linkedList = this.f877x;
if (X && ia.m.z(str7, ":")) {
String[] strArr4 = (String[]) androidx.activity.d.t(":", 2, str7).toArray(new String[0]);
String substring = strArr4[0].substring(1);
q7.a.d("this as java.lang.String).substring(startIndex)", substring);
String str8 = strArr4[1];
int hashCode = substring.hashCode();
Collection collection = q9.o.f9513s;
p2.a aVar2 = this.f875v;
OpenVPNService openVPNService = this.f873t;
switch (hashCode) {
case -1747950989:
if (substring.equals("NEED-OK")) {
int F = ia.m.F(str8, '\'', 0, false, 6) + 1;
String substring2 = str8.substring(F, ia.m.F(str8, '\'', F, false, 4));
q7.a.d("this as java.lang.String…ing(startIndex, endIndex)", substring2);
String str9 = ((String[]) androidx.activity.d.t(":", 2, str8).toArray(new String[0]))[1];
String str10 = "ok";
switch (substring2.hashCode()) {
case -2116912211:
strArr = strArr3;
str2 = "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]);
q7.a.c("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, str10}, 2));
q7.a.d(str2, format2);
a(format2);
break;
}
break;
case -1929611617:
strArr = strArr3;
str2 = "format(format, *args)";
if (substring2.equals("IFCONFIG")) {
List t10 = androidx.activity.d.t(" ", 0, str9);
if (!t10.isEmpty()) {
ListIterator listIterator = t10.listIterator(t10.size());
while (true) {
if (listIterator.hasPrevious()) {
if (((String) listIterator.previous()).length() == 0) {
z10 = true;
continue;
} else {
z10 = false;
continue;
}
if (!z10) {
collection = q9.m.c0(t10, listIterator.nextIndex() + 1);
}
}
}
}
String[] strArr5 = (String[]) collection.toArray(new String[0]);
int parseInt = Integer.parseInt(strArr5[2]);
String str11 = strArr5[0];
String str12 = strArr5[1];
String str13 = strArr5[3];
openVPNService.getClass();
q7.a.e("local", str11);
q7.a.e("netmask", str12);
q7.a.e("mode", str13);
openVPNService.A = new c9.a(str11, str12);
openVPNService.B = parseInt;
openVPNService.D = null;
n8.c cVar3 = c9.a.f2413c;
long d10 = cVar3.d(str12);
c9.a aVar3 = openVPNService.A;
q7.a.b(aVar3);
if (aVar3.f2415b == 32 && !q7.a.a(str12, "255.255.255.255")) {
if (q7.a.a("net30", str13)) {
i10 = 30;
j10 = -4;
} else {
j10 = -2;
i10 = 31;
}
int i11 = ((d10 & j10) > (cVar3.d(str11) & j10) ? 1 : ((d10 & j10) == (cVar3.d(str11) & j10) ? 0 : -1));
c9.a aVar4 = openVPNService.A;
q7.a.b(aVar4);
if (i11 == 0) {
aVar4.f2415b = i10;
} else {
aVar4.f2415b = 32;
}
}
c9.a aVar5 = openVPNService.A;
q7.a.b(aVar5);
if (aVar5.f2415b <= 31) {
c9.a aVar6 = openVPNService.A;
q7.a.b(aVar6);
String str14 = aVar6.f2414a;
c9.a aVar7 = openVPNService.A;
q7.a.b(aVar7);
c9.a aVar8 = new c9.a(str14, aVar7.f2415b);
aVar8.a();
openVPNService.f3945t.f2422a.add(new c9.b(aVar8, true));
}
openVPNService.D = str12;
String format22 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str10}, 2));
q7.a.d(str2, format22);
a(format22);
break;
}
break;
case -1056734836:
strArr = strArr3;
str2 = "format(format, *args)";
break;
case -545191069:
if (substring2.equals("OPENTUN")) {
if (!q7.a.a(str9, "tun")) {
strArr = strArr3;
str3 = "format(format, *args)";
} else {
openVPNService.getClass();
VpnService.Builder builder = new VpnService.Builder(openVPNService);
p2.a aVar9 = openVPNService.f3948w;
aVar9.c("LBL_OPENING_INTERFACE_TUN", new Object[0]);
c9.a aVar10 = openVPNService.A;
if (aVar10 == null) {
aVar9.c("No IP address set", new Object[0]);
parcelFileDescriptor = null;
strArr = strArr3;
str3 = "format(format, *args)";
aVar = aVar2;
} else {
try {
q7.a.b(builder.addAddress(aVar10.f2414a, aVar10.f2415b));
} catch (IllegalArgumentException e12) {
aVar9.c("Could not add IPv4 address " + aVar10 + ": " + e12.getLocalizedMessage(), new Object[0]);
}
Vector vector = openVPNService.f3944s;
vector.clear();
b9.a aVar11 = openVPNService.H;
if (aVar11 != null) {
if (!q7.a.a(aVar11.f2137e, "0.0.0.0")) {
b9.a aVar12 = openVPNService.H;
if (aVar12 != null) {
vector.add(aVar12.f2137e);
} else {
q7.a.v("config");
throw null;
}
}
b9.a aVar13 = openVPNService.H;
if (aVar13 != null) {
if (!q7.a.a(aVar13.f2138f, "0.0.0.0")) {
b9.a aVar14 = openVPNService.H;
if (aVar14 != null) {
vector.add(aVar14.f2138f);
} else {
q7.a.v("config");
throw null;
}
}
Iterator it = vector.iterator();
while (it.hasNext()) {
String str15 = (String) it.next();
try {
builder.addDnsServer(str15);
} catch (IllegalArgumentException unused) {
aVar9.c("LBL_COULD_NOT_ADD_DNS", str15);
}
}
builder.setMtu(openVPNService.B);
b9.a aVar15 = openVPNService.H;
if (aVar15 != null) {
InetAddress byName = InetAddress.getByName(aVar15.a());
boolean z18 = byName instanceof Inet6Address;
c9.c cVar4 = openVPNService.f3946u;
c9.c cVar5 = openVPNService.f3945t;
if (z18) {
Inet6Address inet6Address = (Inet6Address) byName;
cVar4.getClass();
q7.a.e("address", inet6Address);
cVar4.f2422a.add(new c9.b(inet6Address));
strArr = strArr3;
} else {
String hostAddress = byName.getHostAddress();
q7.a.b(hostAddress);
strArr = strArr3;
cVar5.f2422a.add(new c9.b(new c9.a(hostAddress, 32), false));
}
Vector b8 = cVar5.b();
Vector b10 = cVar4.b();
aVar = aVar2;
str3 = "format(format, *args)";
c9.b bVar2 = new c9.b(new c9.a("224.0.0.0", 3), true);
Iterator it2 = b8.iterator();
while (it2.hasNext()) {
c9.b bVar3 = (c9.b) it2.next();
try {
if (!bVar2.a(bVar3)) {
bVar = bVar2;
try {
builder.addRoute(bVar3.c(), bVar3.f2416s);
} catch (IllegalArgumentException e13) {
e = e13;
aVar9.c("LBL_ROUTE_REJECTED", bVar3 + ' ' + e.getLocalizedMessage());
bVar2 = bVar;
it2 = it2;
}
} else {
bVar = bVar2;
}
bVar2 = bVar;
} catch (IllegalArgumentException e14) {
e = e14;
bVar = bVar2;
}
}
Iterator it3 = b10.iterator();
while (it3.hasNext()) {
c9.b bVar4 = (c9.b) it3.next();
try {
builder.addRoute(bVar4.d(), bVar4.f2416s);
} catch (IllegalArgumentException e15) {
aVar9.c("LBL_ROUTE_REJECTED", bVar4 + ' ' + e15.getLocalizedMessage());
}
}
if ((!cVar5.a(false).isEmpty() || !cVar4.a(false).isEmpty()) && Build.VERSION.SDK_INT >= 29) {
openVPNService.isLockdownEnabled();
}
Object[] objArr = new Object[3];
c9.a aVar16 = openVPNService.A;
if (aVar16 != null) {
str4 = aVar16.f2414a;
} else {
str4 = null;
}
objArr[0] = str4;
if (aVar16 != null) {
num = Integer.valueOf(aVar16.f2415b);
} else {
num = null;
}
objArr[1] = num;
objArr[2] = Integer.valueOf(openVPNService.B);
aVar9.c("LBL_LOCAL_IP_INFO", objArr);
if (!vector.isEmpty()) {
aVar9.c("LBL_DNS_SERVER_INFO", q9.m.b0(vector, ", ", null, null, null, 62));
}
aVar9.c("LBL_ROUTES_INFO_INCL", q9.m.b0(cVar5.a(true), ", ", null, null, null, 62));
if (!cVar5.a(false).isEmpty()) {
z11 = false;
aVar9.c("LBL_ROUTES_INFO_EXCL", q9.m.b0(cVar5.a(false), ", ", null, null, null, 62));
} else {
z11 = false;
}
if (!cVar4.a(z11).isEmpty()) {
aVar9.c("LBL_ROUTES_INFO_EXCL", q9.m.b0(cVar4.a(z11), ", ", null, null, null, 62));
}
vector.clear();
cVar5.f2422a.clear();
cVar4.f2422a.clear();
try {
parcelFileDescriptor = builder.establish();
} catch (Exception e16) {
String localizedMessage = e16.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 {
if (parcelFileDescriptor != null) {
z12 = true;
} else {
z12 = false;
}
openVPNService.f3949x = z12;
}
} else {
q7.a.v("config");
throw null;
}
} else {
q7.a.v("config");
throw null;
}
} else {
q7.a.v("config");
throw null;
}
}
if (parcelFileDescriptor != null) {
try {
LocalSocket localSocket = this.f878y;
if (localSocket != null) {
localSocket.setFileDescriptorsForSend(new FileDescriptor[]{parcelFileDescriptor.getFileDescriptor()});
}
format = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, "ok"}, 2));
str2 = str3;
} catch (Exception e17) {
e = e17;
str2 = str3;
}
try {
q7.a.d(str2, format);
a(format);
LocalSocket localSocket2 = this.f878y;
if (localSocket2 != null) {
localSocket2.setFileDescriptorsForSend(null);
}
parcelFileDescriptor.close();
z13 = true;
} catch (Exception e18) {
e = e18;
e.printStackTrace();
String message = e.getMessage();
if (message != null) {
aVar.c(message, new Object[0]);
}
z13 = false;
if (!z13) {
}
strArr2 = strArr;
if (strArr2.length != 1) {
}
}
if (!z13) {
str10 = "cancel";
String format222 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str10}, 2));
q7.a.d(str2, format222);
a(format222);
}
}
}
str2 = str3;
z13 = false;
if (!z13) {
}
}
strArr = strArr3;
break;
case 78166569:
if (substring2.equals("ROUTE")) {
List t11 = androidx.activity.d.t(" ", 0, str9);
if (!t11.isEmpty()) {
ListIterator listIterator2 = t11.listIterator(t11.size());
while (true) {
if (listIterator2.hasPrevious()) {
if (((String) listIterator2.previous()).length() == 0) {
z14 = true;
continue;
} else {
z14 = false;
continue;
}
if (!z14) {
collection = q9.m.c0(t11, 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(str9));
}
strArr = strArr3;
str2 = "format(format, *args)";
String format2222 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str10}, 2));
q7.a.d(str2, format2222);
a(format2222);
break;
}
strArr = strArr3;
break;
case 801000499:
if (substring2.equals("PERSIST_TUN_ACTION")) {
String str16 = "TUNCFG UNQIUE STRING ips:";
if (openVPNService.A != null) {
str16 = "TUNCFG UNQIUE STRING ips:" + openVPNService.A;
}
StringBuilder sb4 = new StringBuilder();
sb4.append(str16);
sb4.append("routes: ");
sb4.append(TextUtils.join("|", openVPNService.f3945t.a(true)));
sb4.append(TextUtils.join("|", openVPNService.f3946u.a(true)));
if (q7.a.a(((sb4.toString() + "excl. routes:" + TextUtils.join("|", cVar.a(false)) + TextUtils.join("|", cVar2.a(false))) + "dns: " + TextUtils.join("|", openVPNService.f3944s)) + "mtu: " + openVPNService.B, null)) {
str5 = "NOACTION";
} else {
str5 = "OPEN_BEFORE_CLOSE";
}
str10 = str5;
strArr = strArr3;
str2 = "format(format, *args)";
String format22222 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str10}, 2));
q7.a.d(str2, format22222);
a(format22222);
break;
}
strArr = strArr3;
break;
case 2021854672:
break;
default:
strArr = strArr3;
break;
}
}
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
case -1631557645:
if (substring.equals("INFOMSG")) {
sb3 = new StringBuilder("INFOMSG: ");
sb3.append(str8);
Log.e("OpenVPN", sb3.toString());
strArr = strArr3;
break;
}
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
case 75556:
if (substring.equals("LOG")) {
sb3 = new StringBuilder("LOG: ");
sb3.append(str8);
Log.e("OpenVPN", sb3.toString());
strArr = strArr3;
break;
}
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
case 2223295:
if (substring.equals("HOLD")) {
this.A = true;
List t12 = androidx.activity.d.t(":", 0, str8);
if (!t12.isEmpty()) {
ListIterator listIterator3 = t12.listIterator(t12.size());
while (listIterator3.hasPrevious()) {
if (((String) listIterator3.previous()).length() == 0) {
z15 = true;
continue;
} else {
z15 = false;
continue;
}
if (!z15) {
c10 = 1;
collection = q9.m.c0(t12, listIterator3.nextIndex() + 1);
int parseInt2 = Integer.parseInt(((String[]) collection.toArray(new String[0]))[c10]);
jVar = this.C;
if (jVar != null && ((g) jVar).f851d == f.f844s) {
z17 = true;
}
if (!z17) {
this.f876w.postDelayed(this.G, parseInt2 * 1000);
} else if (this.B == i.f856s) {
o2.a.F.b(openVPNService);
}
strArr = strArr3;
break;
}
}
}
c10 = 1;
int parseInt22 = Integer.parseInt(((String[]) collection.toArray(new String[0]))[c10]);
jVar = this.C;
if (jVar != null) {
z17 = true;
}
if (!z17) {
}
strArr = strArr3;
}
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
case 2251950:
break;
case 76403278:
if (substring.equals("PROXY")) {
a("proxy NONE\n");
strArr = strArr3;
break;
}
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
case 79219825:
if (substring.equals("STATE")) {
if (!this.D) {
String str17 = ((String[]) androidx.activity.d.t(",", 3, str8).toArray(new String[0]))[1];
if (q7.a.a(str17, "CONNECTED")) {
openVPNService.g("CONECTADO", true);
o2.a.f8156y.b(openVPNService);
aVar2.c("LBL_VPN_ESTABLISHED", new Object[0]);
} else if (q7.a.a(str17, "RECONNECTING")) {
o2.a.f8155x.b(openVPNService);
aVar2.c("LBL_STATE_RECONNECTING", new Object[0]);
} else {
Iterator it4 = p.f870a.iterator();
while (true) {
y0 y0Var = (y0) it4;
if (y0Var.hasNext()) {
obj = y0Var.next();
if (q7.a.a(((o2.a) obj).name(), "MSG_STATE_" + str17)) {
}
} else {
obj = null;
}
}
o2.a aVar17 = (o2.a) obj;
if (aVar17 != null) {
aVar17.b(openVPNService);
}
openVPNService.g(str17, false);
aVar2.c("LBL_STATE_".concat(str17), new Object[0]);
}
}
strArr = strArr3;
break;
}
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
case 223316353:
if (substring.equals("PK_SIGN")) {
List t13 = androidx.activity.d.t(",", 0, str8);
try {
if (!t13.isEmpty()) {
ListIterator listIterator4 = t13.listIterator(t13.size());
while (listIterator4.hasPrevious()) {
if (((String) listIterator4.previous()).length() == 0) {
z16 = true;
continue;
} else {
z16 = false;
continue;
}
if (!z16) {
c11 = 1;
collection = q9.m.c0(t13, listIterator4.nextIndex() + 1);
String[] strArr7 = (String[]) collection.toArray(new String[0]);
q7.a.a(strArr7[c11], "RSA_PKCS1_PADDING");
String str18 = strArr7[0];
this.f872s.getClass();
q7.a.b(Base64.decode(str18, 0));
q7.a.b(null);
throw null;
}
}
}
q7.a.b(null);
throw null;
} catch (InvalidKeyException | NoSuchAlgorithmException | SignatureException | BadPaddingException | IllegalBlockSizeException | NoSuchPaddingException unused2) {
a("pk-sig\n");
a("\nEND\n");
n8.c.b();
break;
}
c11 = 1;
String[] strArr72 = (String[]) collection.toArray(new String[0]);
q7.a.a(strArr72[c11], "RSA_PKCS1_PADDING");
String str182 = strArr72[0];
this.f872s.getClass();
q7.a.b(Base64.decode(str182, 0));
}
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
case 1999612571:
if (substring.equals("PASSWORD")) {
try {
if (!ia.m.X(str8, "Auth-Token:", false)) {
int F2 = ia.m.F(str8, '\'', 0, false, 6) + 1;
String substring3 = str8.substring(F2, ia.m.F(str8, '\'', F2, false, 4));
q7.a.d("this as java.lang.String…ing(startIndex, endIndex)", substring3);
if (ia.m.X(str8, "Verification Failed", false)) {
o2.a.B.b(openVPNService);
aVar2.c("LBL_AUTHENTICATION_FAILED_TEXT", new Object[0]);
e();
} else {
b9.a aVar18 = this.f874u;
String format3 = String.format("username '%s' %s\n", Arrays.copyOf(new Object[]{substring3, n8.c.h(aVar18.f2134b)}, 2));
q7.a.d("format(format, *args)", format3);
a(format3);
String format4 = String.format("password '%s' %s\n", Arrays.copyOf(new Object[]{substring3, n8.c.h(aVar18.f2135c)}, 2));
q7.a.d("format(format, *args)", format4);
a(format4);
}
}
} catch (StringIndexOutOfBoundsException unused3) {
}
strArr = strArr3;
break;
}
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
default:
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
}
strArr2 = strArr;
if (strArr2.length != 1) {
}
} else {
strArr = strArr3;
if (!ia.m.X(str7, "SUCCESS:", false)) {
if (ia.m.X(str7, "PROTECTFD: ", false)) {
FileDescriptor fileDescriptor2 = (FileDescriptor) linkedList.pollFirst();
if (fileDescriptor2 != null) {
try {
Os.close(fileDescriptor2);
} catch (Exception e19) {
e19.printStackTrace();
}
}
} else {
sb2 = new StringBuilder("Got unrecognized line from managment");
}
}
strArr2 = strArr;
if (strArr2.length != 1) {
str6 = "";
} else {
str6 = strArr2[1];
}
}
sb2.append(str7);
Log.i("openvpn", sb2.toString());
strArr2 = strArr;
if (strArr2.length != 1) {
}
}
return str6;
}
public final void c() {
this.f876w.removeCallbacks(this.G);
this.F.a();
if (this.A) {
return;
}
a("signal SIGUSR1\n");
}
public final void d() {
g8.a aVar = this.E;
try {
aVar.getClass();
ServerSocket serverSocket = new ServerSocket();
aVar.f5371t = serverSocket;
serverSocket.bind(new InetSocketAddress("127.0.0.1", aVar.f5370s));
aVar.setName("LocalServer");
aVar.f5372u = new q(this);
aVar.start();
} catch (Exception e10) {
e10.printStackTrace();
}
}
public final boolean e() {
boolean z10;
ServerSocket serverSocket;
this.F.a();
g8.a aVar = this.E;
aVar.getClass();
try {
ServerSocket serverSocket2 = aVar.f5371t;
if (serverSocket2 != null && serverSocket2.isClosed()) {
z10 = true;
} else {
z10 = false;
}
if (!z10 && (serverSocket = aVar.f5371t) != null) {
serverSocket.close();
}
} catch (IOException e10) {
e10.printStackTrace();
}
boolean b8 = n8.c.b();
if (b8) {
this.D = true;
}
return b8;
}
@Override
public final void run() {
FileDescriptor[] fileDescriptorArr;
LocalSocket localSocket;
byte[] bArr = new byte[2048];
String str = "";
Vector vector = H;
synchronized (vector) {
vector.add(this);
}
try {
d();
LocalServerSocket localServerSocket = this.f879z;
q7.a.b(localServerSocket);
LocalSocket accept = localServerSocket.accept();
this.f878y = accept;
InputStream inputStream = accept != null ? accept.getInputStream() : null;
try {
LocalServerSocket localServerSocket2 = this.f879z;
q7.a.b(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.f878y;
} catch (IOException e11) {
e11.printStackTrace();
}
if (localSocket != null) {
fileDescriptorArr = localSocket.getAncillaryFileDescriptors();
if (fileDescriptorArr == null) {
Collections.addAll(q9.m.f0(this.f877x), Arrays.copyOf(fileDescriptorArr, fileDescriptorArr.length));
}
Charset charset = StandardCharsets.UTF_8;
q7.a.d("UTF_8", charset);
str = b(str + new String(bArr, 0, read, charset));
}
fileDescriptorArr = null;
if (fileDescriptorArr == null) {
}
Charset charset2 = StandardCharsets.UTF_8;
q7.a.d("UTF_8", charset2);
str = b(str + new String(bArr, 0, read, charset2));
}
} catch (IOException e12) {
if (!q7.a.a(e12.getMessage(), "socket closed") && !q7.a.a(e12.getMessage(), "Connection reset by peer")) {
e12.printStackTrace();
}
Vector vector2 = H;
synchronized (vector2) {
vector2.remove(this);
}
}
}
}