CONECTA PRO v4.2.8版本的 MD5 值为:ad88cf9e66d8cdaae8c40233e50eb389
以下内容为反编译后的 r.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 c0.x0;
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;
import z8.b1;
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 y7.a E;
public final v7.b F;
public final a.b G;
public final u8.a f10190r;
public final OpenVPNService f10191s;
public final w8.a f10192t;
public final p2.a f10193u;
public final q2.d f10194v;
public final Handler f10195w;
public final LinkedList f10196x;
public LocalSocket f10197y;
public LocalServerSocket f10198z;
static {
new u7.c(18, 0);
H = new Vector();
}
public r(u8.a aVar, OpenVPNService openVPNService, w8.a aVar2, p2.a aVar3, q2.d dVar) {
b1.o("logger", aVar3);
b1.o("networkMonitor", dVar);
this.f10190r = aVar;
this.f10191s = openVPNService;
this.f10192t = aVar2;
this.f10193u = aVar3;
this.f10194v = dVar;
this.f10195w = new Handler(openVPNService.getMainLooper());
this.f10196x = new LinkedList();
this.B = i.f10172r;
this.E = new y7.a(Integer.parseInt(aVar.f9875e0[0].f10152s));
v7.b b10 = aVar2.b();
this.F = b10;
b10.f10122k = new o(this, 0);
b10.f10121j = new c8.f(1, this);
this.G = new a.b(12, this);
}
public final boolean a(String str) {
OutputStream outputStream;
OutputStream outputStream2;
try {
LocalSocket localSocket = this.f10197y;
if (localSocket != null && (outputStream2 = localSocket.getOutputStream()) != null) {
byte[] bytes = str.getBytes(da.a.f3218a);
b1.n("this as java.lang.String).getBytes(charset)", bytes);
outputStream2.write(bytes);
}
LocalSocket localSocket2 = this.f10197y;
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;
x8.a aVar;
boolean z10;
p2.a aVar2;
String str3;
String str4;
Integer num;
boolean z11;
ParcelFileDescriptor parcelFileDescriptor;
boolean z12;
x8.b bVar;
String format;
boolean z13;
boolean z14;
x8.c cVar;
x8.c cVar2;
String str5;
StringBuilder sb3;
char c10;
j jVar;
boolean z15;
boolean z16;
Object obj;
char c11;
boolean z17;
String str6 = str;
while (da.m.l0(str6, "\n")) {
String[] strArr3 = (String[]) a.d.n("\\r?\\n", 2, str6).toArray(new String[0]);
String str7 = strArr3[0];
boolean M0 = da.m.M0(str7, ">", false);
LinkedList linkedList = this.f10196x;
if (M0 && da.m.l0(str7, ":")) {
String[] strArr4 = (String[]) a.d.n(":", 2, str7).toArray(new String[0]);
String substring = strArr4[0].substring(1);
b1.n("this as java.lang.String).substring(startIndex)", substring);
String str8 = strArr4[1];
int hashCode = substring.hashCode();
Collection collection = l9.n.f7179r;
w8.a aVar3 = this.f10192t;
p2.a aVar4 = this.f10193u;
OpenVPNService openVPNService = this.f10191s;
switch (hashCode) {
case -1747950989:
if (substring.equals("NEED-OK")) {
int s02 = da.m.s0(str8, '\'', 0, false, 6) + 1;
String substring2 = str8.substring(s02, da.m.s0(str8, '\'', s02, false, 4));
b1.n("this as java.lang.String…ing(startIndex, endIndex)", substring2);
String str9 = ((String[]) a.d.n(":", 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]);
b1.m("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));
b1.n(str2, format2);
a(format2);
break;
}
break;
case -1929611617:
strArr = strArr3;
str2 = "format(format, *args)";
if (substring2.equals("IFCONFIG")) {
List n8 = a.d.n(" ", 0, str9);
if (!n8.isEmpty()) {
ListIterator listIterator = n8.listIterator(n8.size());
while (true) {
if (listIterator.hasPrevious()) {
if (((String) listIterator.previous()).length() == 0) {
z10 = true;
continue;
} else {
z10 = false;
continue;
}
if (!z10) {
collection = l9.l.y(n8, 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();
b1.o("local", str11);
b1.o("netmask", str12);
b1.o("mode", str13);
openVPNService.A = new x8.a(str11, str12);
openVPNService.B = parseInt;
openVPNService.D = null;
u7.c cVar3 = x8.a.f10512c;
long d10 = cVar3.d(str12);
x8.a aVar5 = openVPNService.A;
b1.l(aVar5);
if (aVar5.f10514b == 32 && !b1.g(str12, "255.255.255.255")) {
if (b1.g("net30", str13)) {
i10 = 30;
j10 = -4;
} else {
j10 = -2;
i10 = 31;
}
if ((d10 & j10) == (cVar3.d(str11) & j10)) {
aVar = openVPNService.A;
b1.l(aVar);
} else {
aVar = openVPNService.A;
b1.l(aVar);
i10 = 32;
}
aVar.f10514b = i10;
}
x8.a aVar6 = openVPNService.A;
b1.l(aVar6);
if (aVar6.f10514b <= 31) {
x8.a aVar7 = openVPNService.A;
b1.l(aVar7);
String str14 = aVar7.f10513a;
x8.a aVar8 = openVPNService.A;
b1.l(aVar8);
x8.a aVar9 = new x8.a(str14, aVar8.f10514b);
aVar9.a();
openVPNService.f3247s.f10521a.add(new x8.b(aVar9, true));
}
openVPNService.D = str12;
String format22 = String.format("needok '%s' %s\n", Arrays.copyOf(new Object[]{substring2, str10}, 2));
b1.n(str2, format22);
a(format22);
break;
}
break;
case -1056734836:
strArr = strArr3;
str2 = "format(format, *args)";
break;
case -545191069:
if (substring2.equals("OPENTUN")) {
if (!b1.g(str9, "tun")) {
strArr = strArr3;
str2 = "format(format, *args)";
} else {
openVPNService.getClass();
VpnService.Builder builder = new VpnService.Builder(openVPNService);
p2.a aVar10 = openVPNService.f3250v;
aVar10.c("LBL_OPENING_INTERFACE_TUN", new Object[0]);
x8.a aVar11 = openVPNService.A;
if (aVar11 == null) {
aVar10.c("No IP address set", new Object[0]);
parcelFileDescriptor = null;
strArr = strArr3;
str3 = "format(format, *args)";
aVar2 = aVar4;
} else {
try {
b1.l(builder.addAddress(aVar11.f10513a, aVar11.f10514b));
} catch (IllegalArgumentException e12) {
aVar10.c("Could not add IPv4 address " + aVar11 + ": " + e12.getLocalizedMessage(), new Object[0]);
}
Vector vector = openVPNService.f3246r;
vector.clear();
w8.a aVar12 = openVPNService.H;
if (aVar12 != null) {
if (!b1.g(aVar12.f10429e, "0.0.0.0")) {
w8.a aVar13 = openVPNService.H;
if (aVar13 != null) {
vector.add(aVar13.f10429e);
} else {
b1.V("config");
throw null;
}
}
w8.a aVar14 = openVPNService.H;
if (aVar14 != null) {
if (!b1.g(aVar14.f10430f, "0.0.0.0")) {
w8.a aVar15 = openVPNService.H;
if (aVar15 != null) {
vector.add(aVar15.f10430f);
} else {
b1.V("config");
throw null;
}
}
Iterator it = vector.iterator();
while (it.hasNext()) {
String str15 = (String) it.next();
try {
builder.addDnsServer(str15);
} catch (IllegalArgumentException unused) {
aVar10.c("LBL_COULD_NOT_ADD_DNS", str15);
}
}
builder.setMtu(openVPNService.B);
w8.a aVar16 = openVPNService.H;
if (aVar16 != null) {
InetAddress byName = InetAddress.getByName(aVar16.a());
boolean z18 = byName instanceof Inet6Address;
x8.c cVar4 = openVPNService.f3248t;
x8.c cVar5 = openVPNService.f3247s;
if (z18) {
Inet6Address inet6Address = (Inet6Address) byName;
cVar4.getClass();
b1.o("address", inet6Address);
cVar4.f10521a.add(new x8.b(inet6Address));
strArr = strArr3;
} else {
String hostAddress = byName.getHostAddress();
b1.l(hostAddress);
strArr = strArr3;
cVar5.f10521a.add(new x8.b(new x8.a(hostAddress, 32), false));
}
Vector b10 = cVar5.b();
Vector b11 = cVar4.b();
aVar2 = aVar4;
str3 = "format(format, *args)";
x8.b bVar2 = new x8.b(new x8.a("224.0.0.0", 3), true);
Iterator it2 = b10.iterator();
while (it2.hasNext()) {
x8.b bVar3 = (x8.b) it2.next();
try {
if (!bVar2.a(bVar3)) {
bVar = bVar2;
try {
builder.addRoute(bVar3.c(), bVar3.f10515r);
} catch (IllegalArgumentException e13) {
e = e13;
aVar10.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 = b11.iterator();
while (it3.hasNext()) {
x8.b bVar4 = (x8.b) it3.next();
try {
builder.addRoute(bVar4.d(), bVar4.f10515r);
} catch (IllegalArgumentException e15) {
aVar10.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];
x8.a aVar17 = openVPNService.A;
if (aVar17 != null) {
str4 = aVar17.f10513a;
} else {
str4 = null;
}
objArr[0] = str4;
if (aVar17 != null) {
num = Integer.valueOf(aVar17.f10514b);
} else {
num = null;
}
objArr[1] = num;
objArr[2] = Integer.valueOf(openVPNService.B);
aVar10.c("LBL_LOCAL_IP_INFO", objArr);
if (!vector.isEmpty()) {
aVar10.c("LBL_DNS_SERVER_INFO", l9.l.x(vector, ", ", null, null, null, 62));
}
aVar10.c("LBL_ROUTES_INFO_INCL", l9.l.x(cVar5.a(true), ", ", null, null, null, 62));
if (!cVar5.a(false).isEmpty()) {
z11 = false;
aVar10.c("LBL_ROUTES_INFO_EXCL", l9.l.x(cVar5.a(false), ", ", null, null, null, 62));
} else {
z11 = false;
}
if (!cVar4.a(z11).isEmpty()) {
aVar10.c("LBL_ROUTES_INFO_EXCL", l9.l.x(cVar4.a(z11), ", ", null, null, null, 62));
}
vector.clear();
cVar5.f10521a.clear();
cVar4.f10521a.clear();
try {
parcelFileDescriptor = builder.establish();
} catch (Exception e16) {
String localizedMessage = e16.getLocalizedMessage();
if (localizedMessage != null) {
aVar10.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.f3252x = z12;
}
} else {
b1.V("config");
throw null;
}
} else {
b1.V("config");
throw null;
}
} else {
b1.V("config");
throw null;
}
}
if (parcelFileDescriptor == null) {
str2 = str3;
} else {
try {
LocalSocket localSocket = this.f10197y;
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 {
b1.n(str2, format);
a(format);
LocalSocket localSocket2 = this.f10197y;
if (localSocket2 != null) {
localSocket2.setFileDescriptorsForSend(null);
}
parcelFileDescriptor.close();
z13 = true;
} catch (Exception e18) {
e = e18;
e.printStackTrace();
String message = e.getMessage();
if (message != null) {
aVar2.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));
b1.n(str2, format222);
a(format222);
}
}
}
z13 = false;
if (!z13) {
}
}
strArr = strArr3;
break;
case 78166569:
if (substring2.equals("ROUTE")) {
List n10 = a.d.n(" ", 0, str9);
if (!n10.isEmpty()) {
ListIterator listIterator2 = n10.listIterator(n10.size());
while (true) {
if (listIterator2.hasPrevious()) {
if (((String) listIterator2.previous()).length() == 0) {
z14 = true;
continue;
} else {
z14 = false;
continue;
}
if (!z14) {
collection = l9.l.y(n10, 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));
b1.n(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.f3247s.a(true)));
sb4.append(TextUtils.join("|", openVPNService.f3248t.a(true)));
if (b1.g(((sb4.toString() + "excl. routes:" + TextUtils.join("|", cVar.a(false)) + TextUtils.join("|", cVar2.a(false))) + "dns: " + TextUtils.join("|", openVPNService.f3246r)) + "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));
b1.n(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 n11 = a.d.n(":", 0, str8);
if (!n11.isEmpty()) {
ListIterator listIterator3 = n11.listIterator(n11.size());
while (listIterator3.hasPrevious()) {
if (((String) listIterator3.previous()).length() == 0) {
z16 = true;
continue;
} else {
z16 = false;
continue;
}
if (!z16) {
c10 = 1;
collection = l9.l.y(n11, listIterator3.nextIndex() + 1);
int parseInt2 = Integer.parseInt(((String[]) collection.toArray(new String[0]))[c10]);
jVar = this.C;
if (jVar != null && ((g) jVar).f10167d == f.f10160r) {
z15 = true;
} else {
z15 = false;
}
if (z15) {
this.f10195w.postDelayed(this.G, parseInt2 * 1000);
} else if (this.B == i.f10172r) {
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) {
z15 = true;
if (z15) {
}
strArr = strArr3;
}
z15 = false;
if (z15) {
}
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[]) a.d.n(",", 3, str8).toArray(new String[0]))[1];
boolean g10 = b1.g(str17, "CONNECTED");
q2.d dVar = this.f10194v;
if (g10) {
if (aVar3.f10431g) {
aVar4.c("LBL_PING_STARTED", new Object[0]);
dVar.f8390h = new o(this, 1);
dVar.b();
}
openVPNService.g("CONECTADO", true);
o2.a.f7840x.b(openVPNService, "");
aVar4.c("LBL_VPN_ESTABLISHED", new Object[0]);
} else if (b1.g(str17, "RECONNECTING")) {
dVar.c();
o2.a.f7839w.b(openVPNService, "");
aVar4.c("LBL_STATE_RECONNECTING", new Object[0]);
} else {
Iterator it4 = p.f10188a.iterator();
while (true) {
x0 x0Var = (x0) it4;
if (x0Var.hasNext()) {
obj = x0Var.next();
if (b1.g(((o2.a) obj).name(), "MSG_STATE_" + str17)) {
}
} else {
obj = null;
}
}
o2.a aVar18 = (o2.a) obj;
if (aVar18 != null) {
aVar18.b(openVPNService, "");
}
openVPNService.g(str17, false);
aVar4.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 n12 = a.d.n(",", 0, str8);
try {
if (!n12.isEmpty()) {
ListIterator listIterator4 = n12.listIterator(n12.size());
while (listIterator4.hasPrevious()) {
if (((String) listIterator4.previous()).length() == 0) {
z17 = true;
continue;
} else {
z17 = false;
continue;
}
if (!z17) {
c11 = 1;
collection = l9.l.y(n12, listIterator4.nextIndex() + 1);
String[] strArr7 = (String[]) collection.toArray(new String[0]);
b1.g(strArr7[c11], "RSA_PKCS1_PADDING");
String str18 = strArr7[0];
this.f10190r.getClass();
b1.l(Base64.decode(str18, 0));
b1.l(null);
throw null;
}
}
}
b1.l(null);
throw null;
} catch (InvalidKeyException | NoSuchAlgorithmException | SignatureException | BadPaddingException | IllegalBlockSizeException | NoSuchPaddingException unused2) {
a("pk-sig\n");
a("\nEND\n");
u7.c.b();
break;
}
c11 = 1;
String[] strArr72 = (String[]) collection.toArray(new String[0]);
b1.g(strArr72[c11], "RSA_PKCS1_PADDING");
String str182 = strArr72[0];
this.f10190r.getClass();
b1.l(Base64.decode(str182, 0));
}
strArr = strArr3;
sb2 = new StringBuilder("Got unrecognized command");
break;
case 1999612571:
if (substring.equals("PASSWORD")) {
try {
if (!da.m.M0(str8, "Auth-Token:", false)) {
int s03 = da.m.s0(str8, '\'', 0, false, 6) + 1;
String substring3 = str8.substring(s03, da.m.s0(str8, '\'', s03, false, 4));
b1.n("this as java.lang.String…ing(startIndex, endIndex)", substring3);
if (da.m.M0(str8, "Verification Failed", false)) {
o2.a.B.b(openVPNService, "");
aVar4.c("LBL_AUTHENTICATION_FAILED_TEXT", new Object[0]);
e();
} else {
String format3 = String.format("username '%s' %s\n", Arrays.copyOf(new Object[]{substring3, u7.c.g(aVar3.f10426b)}, 2));
b1.n("format(format, *args)", format3);
a(format3);
String format4 = String.format("password '%s' %s\n", Arrays.copyOf(new Object[]{substring3, u7.c.g(aVar3.f10427c)}, 2));
b1.n("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 (!da.m.M0(str7, "SUCCESS:", false)) {
if (da.m.M0(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.f10195w.removeCallbacks(this.G);
this.F.a();
if (this.A) {
return;
}
a("signal SIGUSR1\n");
}
public final void d() {
y7.a aVar = this.E;
try {
aVar.getClass();
ServerSocket serverSocket = new ServerSocket();
aVar.f10709s = serverSocket;
serverSocket.bind(new InetSocketAddress("127.0.0.1", aVar.f10708r));
aVar.setName("LocalServer");
aVar.f10710t = new q(this);
aVar.start();
} catch (Exception e10) {
e10.printStackTrace();
}
}
public final boolean e() {
boolean z10;
ServerSocket serverSocket;
this.F.a();
y7.a aVar = this.E;
aVar.getClass();
try {
ServerSocket serverSocket2 = aVar.f10709s;
if (serverSocket2 != null && serverSocket2.isClosed()) {
z10 = true;
} else {
z10 = false;
}
if (!z10 && (serverSocket = aVar.f10709s) != null) {
serverSocket.close();
}
} catch (IOException e10) {
e10.printStackTrace();
}
if (this.f10192t.f10431g) {
this.f10193u.c("LBL_PING_STOPPED", new Object[0]);
this.f10194v.c();
}
boolean b10 = u7.c.b();
if (b10) {
this.D = true;
}
return b10;
}
@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.f10198z;
b1.l(localServerSocket);
LocalSocket accept = localServerSocket.accept();
this.f10197y = accept;
InputStream inputStream = accept != null ? accept.getInputStream() : null;
try {
LocalServerSocket localServerSocket2 = this.f10198z;
b1.l(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.f10197y;
} catch (IOException e11) {
e11.printStackTrace();
}
if (localSocket != null) {
fileDescriptorArr = localSocket.getAncillaryFileDescriptors();
if (fileDescriptorArr == null) {
Collections.addAll(l9.l.B(this.f10196x), Arrays.copyOf(fileDescriptorArr, fileDescriptorArr.length));
}
Charset charset = StandardCharsets.UTF_8;
b1.n("UTF_8", charset);
str = b(str + new String(bArr, 0, read, charset));
}
fileDescriptorArr = null;
if (fileDescriptorArr == null) {
}
Charset charset2 = StandardCharsets.UTF_8;
b1.n("UTF_8", charset2);
str = b(str + new String(bArr, 0, read, charset2));
}
} catch (IOException e12) {
if (!b1.g(e12.getMessage(), "socket closed") && !b1.g(e12.getMessage(), "Connection reset by peer")) {
e12.printStackTrace();
}
Vector vector2 = H;
synchronized (vector2) {
vector2.remove(this);
}
}
}
}