Fast Orange v3.5.3版本的 MD5 值为:33b91aba50c566533dfd683a85f79158
以下内容为反编译后的 at2.java 源代码,内容仅作参考
package com.free.vpn.proxy.hotspot;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.LocalServerSocket;
import android.net.LocalSocket;
import android.net.Uri;
import android.net.VpnService;
import android.os.Build;
import android.os.Handler;
import android.os.ParcelFileDescriptor;
import android.security.KeyChainException;
import android.system.Os;
import android.system.OsConstants;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import androidx.core.google.shortcuts.utils.ShortcutUtils;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import androidx.exifinterface.media.ExifInterface;
import androidx.lifecycle.CoroutineLiveDataKt;
import de.blinkt.openvpn.activities.InternalWebView;
import de.blinkt.openvpn.core.DeviceStateReceiver;
import de.blinkt.openvpn.core.OpenVPNService;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.SocketAddress;
import java.net.URISyntaxException;
import java.net.URL;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.SignatureException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Locale;
import java.util.TreeSet;
import java.util.UUID;
import java.util.Vector;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import web.accelerator.p003new.util.R;
public final class at2 implements Runnable, ps2 {
public static final Vector B = new Vector();
public transient x50 A;
public final Handler a;
public LocalSocket b;
public final xx4 c;
public final OpenVPNService d;
public LocalServerSocket q;
public LocalSocket t;
public ns2 v;
public boolean w;
public final LinkedList e = new LinkedList();
public boolean r = false;
public long s = 0;
public os2 u = os2.noNetwork;
public final ok3 x = new ok3(this, 18);
public final a52 y = new a52(this, 7);
public final zs2 z = new zs2(this);
public at2(xx4 xx4Var, OpenVPNService openVPNService) {
this.c = xx4Var;
this.d = openVPNService;
this.a = new Handler(openVPNService.getMainLooper());
}
public static void a(FileDescriptor fileDescriptor) {
try {
Os.close(fileDescriptor);
} catch (Exception e) {
fy4.k("Failed to close fd (" + fileDescriptor + ")", e);
}
}
public static void f(String str) {
char c;
String[] split = str.split(",", 4);
Log.d("OpenVPN", str);
int i = 1;
String str2 = split[1];
str2.getClass();
int hashCode = str2.hashCode();
if (hashCode != 68) {
if (hashCode != 70) {
if (hashCode != 73) {
if (hashCode == 87 && str2.equals(ExifInterface.LONGITUDE_WEST)) {
c = 3;
}
c = 65535;
} else {
if (str2.equals("I")) {
c = 2;
}
c = 65535;
}
} else {
if (str2.equals("F")) {
c = 1;
}
c = 65535;
}
} else {
if (str2.equals("D")) {
c = 0;
}
c = 65535;
}
if (c != 0) {
if (c != 1) {
if (c == 3) {
i = 3;
}
} else {
i = 2;
}
} else {
i = 4;
}
int parseInt = Integer.parseInt(split[2]) & 15;
String str3 = split[3];
if (str3.startsWith("MANAGEMENT: CMD")) {
parseInt = Math.max(4, parseInt);
}
LinkedList linkedList = fy4.a;
fy4.s(new j72(i, parseInt, str3));
}
public static boolean l() {
boolean z;
Vector vector = B;
synchronized (vector) {
Iterator it = vector.iterator();
z = false;
while (it.hasNext()) {
at2 at2Var = (at2) it.next();
boolean b = at2Var.b("signal SIGINT\n");
try {
LocalSocket localSocket = at2Var.b;
if (localSocket != null) {
localSocket.close();
}
} catch (IOException unused) {
}
z = b;
}
}
return z;
}
public final boolean b(String str) {
try {
LocalSocket localSocket = this.b;
if (localSocket == null || localSocket.getOutputStream() == null) {
return false;
}
this.b.getOutputStream().write(str.getBytes());
this.b.getOutputStream().flush();
return true;
} catch (IOException unused) {
return false;
}
}
public final void c(os2 os2Var) {
this.u = os2Var;
this.a.removeCallbacks(this.x);
if (!this.r) {
b("signal SIGUSR1\n");
} else {
fy4.x(this.u);
}
}
public final void d(String str) {
char c;
String o;
String str2;
x50 x50Var;
char c2;
char c3;
String str3;
String str4;
long j;
int i;
String str5;
Object obj;
Iterator it;
Iterator it2;
String str6;
String str7;
wl wlVar;
int i2;
String str8;
String str9;
boolean z;
boolean z2;
Iterator it3;
xx4 xx4Var;
wl wlVar2;
int i3;
String string;
String str10;
ParcelFileDescriptor establish;
String str11;
int i4;
boolean z3;
String str12;
String str13;
boolean c4;
int i5;
boolean startsWith = str.startsWith(">");
LinkedList linkedList = this.e;
if (startsWith && str.contains(":")) {
char c5 = 2;
String[] split = str.split(":", 2);
char c6 = 1;
String substring = split[0].substring(1);
String str14 = split[1];
substring.getClass();
switch (substring.hashCode()) {
case -1747950989:
if (substring.equals("NEED-OK")) {
c = 0;
break;
}
c = 65535;
break;
case -1631557645:
if (substring.equals("INFOMSG")) {
c = 1;
break;
}
c = 65535;
break;
case 75556:
if (substring.equals("LOG")) {
c = 2;
break;
}
c = 65535;
break;
case 2223295:
if (substring.equals("HOLD")) {
c = 3;
break;
}
c = 65535;
break;
case 2251950:
if (substring.equals("INFO")) {
c = 4;
break;
}
c = 65535;
break;
case 76403278:
if (substring.equals("PROXY")) {
c = 5;
break;
}
c = 65535;
break;
case 79219825:
if (substring.equals("STATE")) {
c = 6;
break;
}
c = 65535;
break;
case 223316353:
if (substring.equals("PK_SIGN")) {
c = 7;
break;
}
c = 65535;
break;
case 739009767:
if (substring.equals("BYTECOUNT")) {
c = '\b';
break;
}
c = 65535;
break;
case 1999612571:
if (substring.equals("PASSWORD")) {
c = '\t';
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
z50 z50Var = z50.LEVEL_WAITING_FOR_USER_INPUT;
z50 z50Var2 = z50.LEVEL_CONNECTING_NO_SERVER_REPLY_YET;
String str15 = null;
OpenVPNService openVPNService = this.d;
String str16 = "";
switch (c) {
case 0:
int indexOf = str14.indexOf(39) + 1;
String substring2 = str14.substring(indexOf, str14.indexOf(39, indexOf));
String str17 = str14.split(":", 2)[1];
substring2.getClass();
switch (substring2.hashCode()) {
case -2116912211:
if (substring2.equals("PROTECTFD")) {
c3 = 0;
break;
}
c3 = 65535;
break;
case -1929611617:
if (substring2.equals("IFCONFIG")) {
c3 = 1;
break;
}
c3 = 65535;
break;
case -1871803603:
if (substring2.equals("ROUTE6")) {
c3 = 2;
break;
}
c3 = 65535;
break;
case -1477105907:
if (substring2.equals("DNSDOMAIN")) {
c3 = 3;
break;
}
c3 = 65535;
break;
case -1056734836:
if (substring2.equals("DNSSERVER")) {
c3 = 4;
break;
}
c3 = 65535;
break;
case -545191069:
if (substring2.equals("OPENTUN")) {
c3 = 5;
break;
}
c3 = 65535;
break;
case 78166569:
if (substring2.equals("ROUTE")) {
c3 = 6;
break;
}
c3 = 65535;
break;
case 311582071:
if (substring2.equals("IFCONFIG6")) {
c3 = 7;
break;
}
c3 = 65535;
break;
case 801000499:
if (substring2.equals("PERSIST_TUN_ACTION")) {
c3 = '\b';
break;
}
c3 = 65535;
break;
case 2021854672:
if (substring2.equals("DNS6SERVER")) {
c3 = '\t';
break;
}
c3 = 65535;
break;
default:
c3 = 65535;
break;
}
switch (c3) {
case 0:
str3 = "needok '%s' %s\n";
str4 = "ok";
i((FileDescriptor) linkedList.pollFirst());
str12 = str4;
str13 = str12;
b(String.format(str3, substring2, str13));
return;
case 1:
str3 = "needok '%s' %s\n";
str4 = "ok";
String[] split2 = str17.split(" ");
int parseInt = Integer.parseInt(split2[2]);
String str18 = split2[0];
String str19 = split2[1];
String str20 = split2[3];
openVPNService.getClass();
openVPNService.s = new wl(str18, str19);
openVPNService.t = parseInt;
openVPNService.B = null;
long k = wl.k(str19);
if (openVPNService.s.b == 32 && !str19.equals("255.255.255.255")) {
if ("net30".equals(str20)) {
j = -4;
i = 30;
} else {
j = -2;
i = 31;
}
if ((k & j) == (j & wl.k(openVPNService.s.c))) {
openVPNService.s.b = i;
} else {
openVPNService.s.b = 32;
if (!"p2p".equals(str20)) {
fy4.q(R.string.ip_not_cidr, str18, str19, str20);
}
}
}
if (("p2p".equals(str20) && openVPNService.s.b < 32) || ("net30".equals(str20) && openVPNService.s.b < 30)) {
fy4.q(R.string.ip_looks_like_subnet, str18, str19, str20);
}
wl wlVar3 = openVPNService.s;
int i6 = wlVar3.b;
if (i6 <= 31) {
wl wlVar4 = new wl(wlVar3.c, i6);
wlVar4.r();
((TreeSet) openVPNService.b.b).add(new rm2(wlVar4, true));
}
openVPNService.B = str19;
str12 = str4;
str13 = str12;
b(String.format(str3, substring2, str13));
return;
case 2:
str3 = "needok '%s' %s\n";
str4 = "ok";
String[] split3 = str17.split(" ");
String str21 = split3[0];
String str22 = split3[1];
openVPNService.getClass();
openVPNService.j(str21, OpenVPNService.n(str22));
str12 = str4;
str13 = str12;
b(String.format(str3, substring2, str13));
return;
case 3:
str3 = "needok '%s' %s\n";
str4 = "ok";
if (openVPNService.r == null) {
openVPNService.r = str17;
}
str12 = str4;
str13 = str12;
b(String.format(str3, substring2, str13));
return;
case 4:
case '\t':
str3 = "needok '%s' %s\n";
str4 = "ok";
openVPNService.a.add(str17);
str12 = str4;
str13 = str12;
b(String.format(str3, substring2, str13));
return;
case 5:
if (!str17.equals("tun")) {
fy4.i(String.format("Device type %s requested, but only tun is possible with the Android API, sorry!", str17));
z3 = false;
str3 = "needok '%s' %s\n";
} else {
openVPNService.getClass();
VpnService.Builder builder = new VpnService.Builder(openVPNService);
fy4.m(R.string.last_openvpn_tun_config, new Object[0]);
boolean z4 = !openVPNService.q.u0;
if (z4) {
builder.allowFamily(OsConstants.AF_INET);
builder.allowFamily(OsConstants.AF_INET6);
}
wl wlVar5 = openVPNService.s;
if (wlVar5 == null && openVPNService.u == null) {
str10 = openVPNService.getString(R.string.opentun_no_ipaddr);
str5 = "needok '%s' %s\n";
obj = "ok";
} else {
km2 km2Var = openVPNService.b;
if (wlVar5 != null) {
char c7 = 0;
u93.F(openVPNService).getBoolean("ovpn3", false);
Iterator it4 = zm2.S(openVPNService, false).iterator();
while (it4.hasNext()) {
String[] split4 = ((String) it4.next()).split(ShortcutUtils.CAPABILITY_PARAM_SEPARATOR);
String str23 = split4[c7];
int parseInt2 = Integer.parseInt(split4[c6]);
if (!str23.equals(openVPNService.s.c) && openVPNService.q.a0) {
((TreeSet) km2Var.b).add(new rm2(new wl(str23, parseInt2), false));
}
c6 = 1;
c7 = 0;
}
if (openVPNService.q.a0) {
Iterator it5 = zm2.S(openVPNService, true).iterator();
while (it5.hasNext()) {
openVPNService.j((String) it5.next(), false);
}
}
try {
wl wlVar6 = openVPNService.s;
builder.addAddress(wlVar6.c, wlVar6.b);
} catch (IllegalArgumentException e) {
fy4.h(R.string.dns_add_error, openVPNService.s, e.getLocalizedMessage());
str5 = "needok '%s' %s\n";
obj = "ok";
establish = null;
if (establish != null) {
}
z3 = false;
if (z3) {
}
}
}
String str24 = openVPNService.u;
if (str24 != null) {
String[] split5 = str24.split(ShortcutUtils.CAPABILITY_PARAM_SEPARATOR);
try {
builder.addAddress(split5[0], Integer.parseInt(split5[1]));
} catch (IllegalArgumentException e2) {
fy4.h(R.string.ip_add_error, openVPNService.u, e2.getLocalizedMessage());
str5 = "needok '%s' %s\n";
obj = "ok";
establish = null;
if (establish != null) {
}
z3 = false;
if (z3) {
}
}
}
Vector vector = openVPNService.a;
Iterator it6 = vector.iterator();
while (it6.hasNext()) {
String str25 = (String) it6.next();
try {
builder.addDnsServer(str25);
} catch (IllegalArgumentException e3) {
fy4.h(R.string.dns_add_error, str25, e3.getLocalizedMessage());
}
}
String str26 = Build.VERSION.RELEASE;
builder.setMtu(openVPNService.t);
Vector z5 = km2Var.z();
km2 km2Var2 = openVPNService.c;
Vector z6 = km2Var2.z();
if (!"samsung".equals(Build.BRAND) || vector.size() < 1) {
str5 = "needok '%s' %s\n";
obj = "ok";
} else {
try {
str5 = "needok '%s' %s\n";
try {
obj = "ok";
try {
rm2 rm2Var = new rm2(new wl((String) vector.get(0), 32), true);
Iterator it7 = z5.iterator();
boolean z7 = false;
while (it7.hasNext()) {
if (((rm2) it7.next()).a(rm2Var)) {
z7 = true;
}
}
if (!z7) {
Object[] objArr = new Object[1];
i4 = 0;
try {
objArr[0] = vector.get(0);
fy4.r(String.format("Warning Samsung Android 5.0+ devices ignore DNS servers outside the VPN range. To enable DNS resolution a route to your DNS Server (%s) has been added.", objArr));
z5.add(rm2Var);
} catch (Exception unused) {
if (!((String) vector.get(i4)).contains(":")) {
fy4.i("Error parsing DNS Server IP: " + ((String) vector.get(i4)));
}
rm2 rm2Var2 = new rm2(new wl("224.0.0.0", 3), true);
it = z5.iterator();
while (it.hasNext()) {
}
it2 = z6.iterator();
while (it2.hasNext()) {
}
str6 = openVPNService.r;
if (str6 != null) {
}
if (!z4) {
}
wlVar = openVPNService.s;
if (wlVar == null) {
}
str9 = openVPNService.u;
if (str9 != null) {
}
if (km2Var.y(false).isEmpty()) {
}
if (Build.VERSION.SDK_INT < 29) {
}
if (z) {
}
fy4.m(R.string.local_ip_info, str8, Integer.valueOf(i2), str7, Integer.valueOf(openVPNService.t));
fy4.m(R.string.dns_server_info, TextUtils.join(", ", vector), openVPNService.r);
fy4.m(R.string.routes_info_incl, TextUtils.join(", ", km2Var.y(true)), TextUtils.join(", ", km2Var2.y(true)));
fy4.m(R.string.routes_info_excl, TextUtils.join(", ", km2Var.y(false)), TextUtils.join(", ", km2Var2.y(false)));
fy4.e(R.string.routes_debug, TextUtils.join(", ", z5), TextUtils.join(", ", z6));
z2 = false;
while (r9 < r2) {
}
if (z2) {
}
if (openVPNService.q.g0) {
try {
builder.addDisallowedApplication("org.torproject.android");
} catch (PackageManager.NameNotFoundException unused2) {
fy4.f("Orbot not installed?");
}
}
it3 = openVPNService.q.f0.iterator();
boolean z8 = false;
while (it3.hasNext()) {
}
if (!openVPNService.q.g0) {
fy4.e(R.string.no_allowed_app, openVPNService.getPackageName());
try {
builder.addAllowedApplication(openVPNService.getPackageName());
} catch (PackageManager.NameNotFoundException e4) {
fy4.i("This should not happen: " + e4.getLocalizedMessage());
}
}
xx4Var = openVPNService.q;
if (!xx4Var.g0) {
}
openVPNService.q.getClass();
builder.setUnderlyingNetworks(null);
String str27 = openVPNService.q.b;
wlVar2 = openVPNService.s;
if (wlVar2 == null) {
}
i3 = 0;
if (wlVar2 == null) {
}
builder.setSession(string);
if (vector.size() == 0) {
}
openVPNService.A = openVPNService.l();
vector.clear();
((TreeSet) km2Var.b).clear();
((TreeSet) km2Var2.b).clear();
openVPNService.s = null;
openVPNService.u = null;
openVPNService.r = null;
Intent intent = new Intent();
intent.setComponent(new ComponentName(openVPNService, openVPNService.getPackageName() + ".activities.MainActivity"));
intent.putExtra("PAGE", "graph");
intent.addFlags(131072);
PendingIntent activity = PendingIntent.getActivity(openVPNService, 0, intent, AccessibilityEventCompat.TYPE_VIEW_TARGETED_BY_SCROLL);
intent.addFlags(131072);
builder.setConfigureIntent(activity);
establish = builder.establish();
if (establish != null) {
}
}
}
} catch (Exception unused3) {
i4 = 0;
if (!((String) vector.get(i4)).contains(":")) {
}
rm2 rm2Var22 = new rm2(new wl("224.0.0.0", 3), true);
it = z5.iterator();
while (it.hasNext()) {
}
it2 = z6.iterator();
while (it2.hasNext()) {
}
str6 = openVPNService.r;
if (str6 != null) {
}
if (!z4) {
}
wlVar = openVPNService.s;
if (wlVar == null) {
}
str9 = openVPNService.u;
if (str9 != null) {
}
if (km2Var.y(false).isEmpty()) {
}
if (Build.VERSION.SDK_INT < 29) {
}
if (z) {
}
fy4.m(R.string.local_ip_info, str8, Integer.valueOf(i2), str7, Integer.valueOf(openVPNService.t));
fy4.m(R.string.dns_server_info, TextUtils.join(", ", vector), openVPNService.r);
fy4.m(R.string.routes_info_incl, TextUtils.join(", ", km2Var.y(true)), TextUtils.join(", ", km2Var2.y(true)));
fy4.m(R.string.routes_info_excl, TextUtils.join(", ", km2Var.y(false)), TextUtils.join(", ", km2Var2.y(false)));
fy4.e(R.string.routes_debug, TextUtils.join(", ", z5), TextUtils.join(", ", z6));
z2 = false;
while (r9 < r2) {
}
if (z2) {
}
if (openVPNService.q.g0) {
}
it3 = openVPNService.q.f0.iterator();
boolean z82 = false;
while (it3.hasNext()) {
}
if (!openVPNService.q.g0) {
}
xx4Var = openVPNService.q;
if (!xx4Var.g0) {
}
openVPNService.q.getClass();
builder.setUnderlyingNetworks(null);
String str272 = openVPNService.q.b;
wlVar2 = openVPNService.s;
if (wlVar2 == null) {
}
i3 = 0;
if (wlVar2 == null) {
}
builder.setSession(string);
if (vector.size() == 0) {
}
openVPNService.A = openVPNService.l();
vector.clear();
((TreeSet) km2Var.b).clear();
((TreeSet) km2Var2.b).clear();
openVPNService.s = null;
openVPNService.u = null;
openVPNService.r = null;
Intent intent2 = new Intent();
intent2.setComponent(new ComponentName(openVPNService, openVPNService.getPackageName() + ".activities.MainActivity"));
intent2.putExtra("PAGE", "graph");
intent2.addFlags(131072);
PendingIntent activity2 = PendingIntent.getActivity(openVPNService, 0, intent2, AccessibilityEventCompat.TYPE_VIEW_TARGETED_BY_SCROLL);
intent2.addFlags(131072);
builder.setConfigureIntent(activity2);
establish = builder.establish();
if (establish != null) {
}
}
} catch (Exception unused4) {
obj = "ok";
i4 = 0;
if (!((String) vector.get(i4)).contains(":")) {
}
rm2 rm2Var222 = new rm2(new wl("224.0.0.0", 3), true);
it = z5.iterator();
while (it.hasNext()) {
}
it2 = z6.iterator();
while (it2.hasNext()) {
}
str6 = openVPNService.r;
if (str6 != null) {
}
if (!z4) {
}
wlVar = openVPNService.s;
if (wlVar == null) {
}
str9 = openVPNService.u;
if (str9 != null) {
}
if (km2Var.y(false).isEmpty()) {
}
if (Build.VERSION.SDK_INT < 29) {
}
if (z) {
}
fy4.m(R.string.local_ip_info, str8, Integer.valueOf(i2), str7, Integer.valueOf(openVPNService.t));
fy4.m(R.string.dns_server_info, TextUtils.join(", ", vector), openVPNService.r);
fy4.m(R.string.routes_info_incl, TextUtils.join(", ", km2Var.y(true)), TextUtils.join(", ", km2Var2.y(true)));
fy4.m(R.string.routes_info_excl, TextUtils.join(", ", km2Var.y(false)), TextUtils.join(", ", km2Var2.y(false)));
fy4.e(R.string.routes_debug, TextUtils.join(", ", z5), TextUtils.join(", ", z6));
z2 = false;
while (r9 < r2) {
}
if (z2) {
}
if (openVPNService.q.g0) {
}
it3 = openVPNService.q.f0.iterator();
boolean z822 = false;
while (it3.hasNext()) {
}
if (!openVPNService.q.g0) {
}
xx4Var = openVPNService.q;
if (!xx4Var.g0) {
}
openVPNService.q.getClass();
builder.setUnderlyingNetworks(null);
String str2722 = openVPNService.q.b;
wlVar2 = openVPNService.s;
if (wlVar2 == null) {
}
i3 = 0;
if (wlVar2 == null) {
}
builder.setSession(string);
if (vector.size() == 0) {
}
openVPNService.A = openVPNService.l();
vector.clear();
((TreeSet) km2Var.b).clear();
((TreeSet) km2Var2.b).clear();
openVPNService.s = null;
openVPNService.u = null;
openVPNService.r = null;
Intent intent22 = new Intent();
intent22.setComponent(new ComponentName(openVPNService, openVPNService.getPackageName() + ".activities.MainActivity"));
intent22.putExtra("PAGE", "graph");
intent22.addFlags(131072);
PendingIntent activity22 = PendingIntent.getActivity(openVPNService, 0, intent22, AccessibilityEventCompat.TYPE_VIEW_TARGETED_BY_SCROLL);
intent22.addFlags(131072);
builder.setConfigureIntent(activity22);
establish = builder.establish();
if (establish != null) {
}
}
} catch (Exception unused5) {
str5 = "needok '%s' %s\n";
}
}
rm2 rm2Var2222 = new rm2(new wl("224.0.0.0", 3), true);
it = z5.iterator();
while (it.hasNext()) {
rm2 rm2Var3 = (rm2) it.next();
try {
if (rm2Var2222.a(rm2Var3)) {
fy4.e(R.string.ignore_multicast_route, rm2Var3.toString());
} else {
builder.addRoute(rm2Var3.c(), rm2Var3.b);
}
} catch (IllegalArgumentException e5) {
fy4.i(openVPNService.getString(R.string.route_rejected) + rm2Var3 + " " + e5.getLocalizedMessage());
rm2Var2222 = rm2Var2222;
}
}
it2 = z6.iterator();
while (it2.hasNext()) {
rm2 rm2Var4 = (rm2) it2.next();
try {
builder.addRoute(rm2Var4.d(), rm2Var4.b);
} catch (IllegalArgumentException e6) {
fy4.i(openVPNService.getString(R.string.route_rejected) + rm2Var4 + " " + e6.getLocalizedMessage());
}
}
str6 = openVPNService.r;
if (str6 != null) {
builder.addSearchDomain(str6);
}
if (!z4) {
str7 = "(not set, allowed)";
} else {
str7 = "(not set)";
}
wlVar = openVPNService.s;
if (wlVar == null) {
i2 = wlVar.b;
str8 = wlVar.c;
} else {
i2 = -1;
str8 = str7;
}
str9 = openVPNService.u;
if (str9 != null) {
str7 = str9;
}
if (km2Var.y(false).isEmpty() || !km2Var2.y(false).isEmpty()) {
if (Build.VERSION.SDK_INT < 29) {
z = openVPNService.isLockdownEnabled();
} else {
z = false;
}
if (z) {
fy4.n("VPN lockdown enabled (do not allow apps to bypass VPN) enabled. Route exclusion will not allow apps to bypass VPN (e.g. bypass VPN for local networks)");
}
}
fy4.m(R.string.local_ip_info, str8, Integer.valueOf(i2), str7, Integer.valueOf(openVPNService.t));
fy4.m(R.string.dns_server_info, TextUtils.join(", ", vector), openVPNService.r);
fy4.m(R.string.routes_info_incl, TextUtils.join(", ", km2Var.y(true)), TextUtils.join(", ", km2Var2.y(true)));
fy4.m(R.string.routes_info_excl, TextUtils.join(", ", km2Var.y(false)), TextUtils.join(", ", km2Var2.y(false)));
fy4.e(R.string.routes_debug, TextUtils.join(", ", z5), TextUtils.join(", ", z6));
z2 = false;
for (x50 x50Var2 : openVPNService.q.d0) {
if (x50Var2.s == 4) {
z2 = true;
}
}
if (z2) {
fy4.f("VPN Profile uses at least one server entry with Orbot. Setting up VPN so that OrBot is not redirected over VPN.");
}
if (openVPNService.q.g0 && z2) {
builder.addDisallowedApplication("org.torproject.android");
}
it3 = openVPNService.q.f0.iterator();
boolean z8222 = false;
while (it3.hasNext()) {
String str28 = (String) it3.next();
try {
if (openVPNService.q.g0) {
builder.addDisallowedApplication(str28);
} else if (!z2 || !str28.equals("org.torproject.android")) {
builder.addAllowedApplication(str28);
z8222 = true;
}
} catch (PackageManager.NameNotFoundException unused6) {
openVPNService.q.f0.remove(str28);
fy4.m(R.string.app_no_longer_exists, str28);
}
}
if (!openVPNService.q.g0 && !z8222) {
fy4.e(R.string.no_allowed_app, openVPNService.getPackageName());
builder.addAllowedApplication(openVPNService.getPackageName());
}
xx4Var = openVPNService.q;
if (!xx4Var.g0) {
fy4.e(R.string.disallowed_vpn_apps_info, TextUtils.join(", ", xx4Var.f0));
} else {
fy4.e(R.string.allowed_vpn_apps_info, TextUtils.join(", ", xx4Var.f0));
}
openVPNService.q.getClass();
builder.setUnderlyingNetworks(null);
String str27222 = openVPNService.q.b;
wlVar2 = openVPNService.s;
if (wlVar2 == null && (str11 = openVPNService.u) != null) {
i3 = 0;
string = openVPNService.getString(R.string.session_ipv6string, str27222, wlVar2, str11);
} else {
i3 = 0;
if (wlVar2 == null) {
string = openVPNService.getString(R.string.session_ipv4string, str27222, wlVar2);
} else {
string = openVPNService.getString(R.string.session_ipv4string, str27222, openVPNService.u);
}
}
builder.setSession(string);
if (vector.size() == 0) {
fy4.m(R.string.warn_no_dns, new Object[i3]);
}
openVPNService.A = openVPNService.l();
vector.clear();
((TreeSet) km2Var.b).clear();
((TreeSet) km2Var2.b).clear();
openVPNService.s = null;
openVPNService.u = null;
openVPNService.r = null;
Intent intent222 = new Intent();
intent222.setComponent(new ComponentName(openVPNService, openVPNService.getPackageName() + ".activities.MainActivity"));
intent222.putExtra("PAGE", "graph");
intent222.addFlags(131072);
PendingIntent activity222 = PendingIntent.getActivity(openVPNService, 0, intent222, AccessibilityEventCompat.TYPE_VIEW_TARGETED_BY_SCROLL);
intent222.addFlags(131072);
builder.setConfigureIntent(activity222);
try {
establish = builder.establish();
} catch (Exception e7) {
fy4.g(R.string.tun_open_error);
str10 = openVPNService.getString(R.string.error) + e7.getLocalizedMessage();
}
if (establish != null) {
throw new NullPointerException("Android establish() method returned null (Really broken network configuration?)");
}
if (establish != null) {
str3 = str5;
} else {
int fd = establish.getFd();
try {
Method declaredMethod = FileDescriptor.class.getDeclaredMethod("setInt$", Integer.TYPE);
FileDescriptor fileDescriptor = new FileDescriptor();
declaredMethod.invoke(fileDescriptor, Integer.valueOf(fd));
this.b.setFileDescriptorsForSend(new FileDescriptor[]{fileDescriptor});
str3 = str5;
} catch (IOException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException | InvocationTargetException e8) {
e = e8;
str3 = str5;
}
try {
b(String.format(str3, substring2, obj));
this.b.setFileDescriptorsForSend(null);
establish.close();
z3 = true;
} catch (IOException e9) {
e = e9;
fy4.l("Could not send fd over socket", e);
z3 = false;
if (z3) {
}
} catch (IllegalAccessException e10) {
e = e10;
fy4.l("Could not send fd over socket", e);
z3 = false;
if (z3) {
}
} catch (IllegalArgumentException e11) {
e = e11;
fy4.l("Could not send fd over socket", e);
z3 = false;
if (z3) {
}
} catch (NoSuchMethodException e12) {
e = e12;
fy4.l("Could not send fd over socket", e);
z3 = false;
if (z3) {
}
} catch (InvocationTargetException e13) {
e = e13;
fy4.l("Could not send fd over socket", e);
z3 = false;
if (z3) {
}
}
}
z3 = false;
}
fy4.i(str10);
establish = null;
if (establish != null) {
}
z3 = false;
}
if (z3) {
str12 = "cancel";
str13 = str12;
b(String.format(str3, substring2, str13));
return;
}
return;
case 6:
String[] split6 = str17.split(" ");
if (split6.length == 5) {
openVPNService.i(split6[0], split6[1], split6[2], split6[4]);
} else if (split6.length >= 3) {
openVPNService.i(split6[0], split6[1], split6[2], null);
} else {
fy4.i("Unrecognized ROUTE cmd:" + Arrays.toString(split6) + " | " + str14);
}
str3 = "needok '%s' %s\n";
str4 = "ok";
str12 = str4;
str13 = str12;
b(String.format(str3, substring2, str13));
return;
case 7:
String[] split7 = str17.split(" ");
openVPNService.t = Integer.parseInt(split7[1]);
openVPNService.u = split7[0];
str3 = "needok '%s' %s\n";
str4 = "ok";
str12 = str4;
str13 = str12;
b(String.format(str3, substring2, str13));
return;
case '\b':
if (openVPNService.l().equals(openVPNService.A)) {
str13 = "NOACTION";
} else {
String str29 = Build.VERSION.RELEASE;
str13 = "OPEN_BEFORE_CLOSE";
}
str3 = "needok '%s' %s\n";
b(String.format(str3, substring2, str13));
return;
default:
Log.e("openvpn", "Unknown needok command ".concat(str14));
return;
}
case 1:
e(str14);
return;
case 2:
f(str14);
return;
case 3:
this.r = true;
int parseInt3 = Integer.parseInt(str14.split(":")[1]);
ns2 ns2Var = this.v;
if (ns2Var == null) {
c4 = false;
} else {
c4 = ((DeviceStateReceiver) ns2Var).c();
}
if (c4) {
if (parseInt3 > 1) {
fy4.y("CONNECTRETRY", String.valueOf(parseInt3), R.string.state_waitconnectretry, z50Var2);
}
this.a.postDelayed(this.x, parseInt3 * 1000);
Object[] objArr2 = new Object[1];
if (parseInt3 > 5) {
objArr2[0] = String.valueOf(parseInt3);
fy4.m(R.string.state_waitconnectretry, objArr2);
return;
} else {
objArr2[0] = String.valueOf(parseInt3);
fy4.e(R.string.state_waitconnectretry, objArr2);
return;
}
}
fy4.x(this.u);
return;
case 4:
return;
case 5:
g(str14);
return;
case 6:
if (!this.w) {
String[] split8 = str14.split(",", 3);
String str30 = split8[1];
if (!split8[2].equals(",,")) {
str16 = split8[2];
}
if (fy4.r != z50Var || !str30.equals("GET_CONFIG")) {
str30.getClass();
switch (str30.hashCode()) {
case -2087582999:
if (str30.equals("CONNECTED")) {
c5 = 0;
break;
}
c5 = 65535;
break;
case -2026270421:
if (str30.equals("RECONNECTING")) {
c5 = 1;
break;
}
c5 = 65535;
break;
case -837916192:
break;
case -597398044:
if (str30.equals("EXITING")) {
c5 = 3;
break;
}
c5 = 65535;
break;
case -453674901:
if (str30.equals("GET_CONFIG")) {
c5 = 4;
break;
}
c5 = 65535;
break;
case -290559304:
if (str30.equals("CONNECTING")) {
c5 = 5;
break;
}
c5 = 65535;
break;
case -89776521:
if (str30.equals("ASSIGN_IP")) {
c5 = 6;
break;
}
c5 = 65535;
break;
case 2020776:
if (str30.equals("AUTH")) {
c5 = 7;
break;
}
c5 = 65535;
break;
case 2656629:
if (str30.equals("WAIT")) {
c5 = '\b';
break;
}
c5 = 65535;
break;
case 263560780:
if (str30.equals("TCP_CONNECT")) {
c5 = '\t';
break;
}
c5 = 65535;
break;
case 847358152:
if (str30.equals("ADD_ROUTES")) {
c5 = '\n';
break;
}
c5 = 65535;
break;
case 935892539:
if (str30.equals("DISCONNECTED")) {
c5 = 11;
break;
}
c5 = 65535;
break;
case 1815350732:
if (str30.equals("RESOLVE")) {
c5 = '\f';
break;
}
c5 = 65535;
break;
default:
c5 = 65535;
break;
}
switch (c5) {
case 0:
i5 = R.string.state_connected;
break;
case 1:
i5 = R.string.state_reconnecting;
break;
case 2:
i5 = R.string.state_auth_pending;
break;
case 3:
i5 = R.string.state_exiting;
break;
case 4:
i5 = R.string.state_get_config;
break;
case 5:
i5 = R.string.state_connecting;
break;
case 6:
i5 = R.string.state_assign_ip;
break;
case 7:
i5 = R.string.state_auth;
break;
case '\b':
i5 = R.string.state_wait;
break;
case '\t':
i5 = R.string.state_tcp_connect;
break;
case '\n':
i5 = R.string.state_add_routes;
break;
case 11:
i5 = R.string.state_disconnected;
break;
case '\f':
i5 = R.string.state_resolve;
break;
default:
i5 = R.string.unknown_state;
break;
}
String[] strArr = {"CONNECTING", "WAIT", "RECONNECTING", "RESOLVE", "TCP_CONNECT"};
String[] strArr2 = {"AUTH", "GET_CONFIG", "ASSIGN_IP", "ADD_ROUTES", "AUTH_PENDING"};
String[] strArr3 = {"CONNECTED"};
String[] strArr4 = {"DISCONNECTED", "EXITING"};
int i7 = 0;
while (true) {
if (i7 < 5) {
if (!str30.equals(strArr[i7])) {
i7++;
}
} else {
int i8 = 0;
while (true) {
if (i8 < 5) {
if (str30.equals(strArr2[i8])) {
z50Var2 = z50.LEVEL_CONNECTING_SERVER_REPLIED;
} else {
i8++;
}
} else if (str30.equals(strArr3[0])) {
z50Var2 = z50.LEVEL_CONNECTED;
} else {
int i9 = 0;
while (true) {
if (i9 < 2) {
if (str30.equals(strArr4[i9])) {
z50Var2 = z50.LEVEL_NOTCONNECTED;
} else {
i9++;
}
} else {
z50Var2 = z50.UNKNOWN_LEVEL;
}
}
}
}
}
}
fy4.y(str30, str16, i5, z50Var2);
return;
}
return;
}
return;
case 7:
h(str14);
return;
case '\b':
int indexOf2 = str14.indexOf(44);
fy4.w(Long.parseLong(str14.substring(0, indexOf2)), Long.parseLong(str14.substring(indexOf2 + 1)));
return;
case '\t':
try {
} catch (StringIndexOutOfBoundsException unused7) {
o = jf2.o("Could not parse management Password command: ", str14);
}
if (!str14.startsWith("Auth-Token:")) {
int indexOf3 = str14.indexOf(39) + 1;
int indexOf4 = str14.indexOf(39, indexOf3);
String substring3 = str14.substring(indexOf3, indexOf4);
if (str14.startsWith("Verification Failed")) {
fy4.y("AUTH_FAILED", substring3 + str14.substring(indexOf4 + 1), R.string.state_auth_failed, z50.LEVEL_AUTH_FAILED);
return;
}
boolean equals = substring3.equals("Private Key");
xx4 xx4Var2 = this.c;
if (equals) {
UUID uuid = xx4Var2.s0;
String str31 = (String) zf2.t(uuid).b;
zf2.t(uuid).b = null;
if (str31 != null) {
str16 = str31;
} else {
int i10 = xx4Var2.a;
if (i10 != 0 && i10 != 5) {
str16 = null;
}
}
str2 = null;
str15 = str16;
} else if (substring3.equals("Auth")) {
UUID uuid2 = xx4Var2.s0;
String str32 = (String) zf2.t(uuid2).c;
zf2.t(uuid2).c = null;
if (str32 != null) {
str15 = str32;
} else {
str15 = xx4Var2.H;
}
str2 = xx4Var2.I;
} else if (substring3.equals("HTTP Proxy") && (x50Var = this.A) != null) {
str15 = x50Var.x;
str2 = x50Var.w;
} else {
str2 = null;
}
if (str15 != null) {
if (str2 != null) {
c2 = 0;
b(String.format("username '%s' %s\n", substring3, xx4.o(str2)));
} else {
c2 = 0;
}
Object[] objArr3 = new Object[2];
objArr3[c2] = substring3;
objArr3[1] = xx4.o(str15);
b(String.format("password '%s' %s\n", objArr3));
return;
}
openVPNService.getClass();
fy4.y("NEED", "need ".concat(substring3), R.string.password, z50Var);
o = String.format("Openvpn requires Authentication type '%s' but no password/key information available", substring3);
fy4.i(o);
return;
}
return;
default:
fy4.r("MGMT: Got unrecognized command".concat(str));
Log.i("openvpn", "Got unrecognized command".concat(str));
return;
}
}
if (str.startsWith("SUCCESS:")) {
return;
}
if (str.startsWith("PROTECTFD: ")) {
FileDescriptor fileDescriptor2 = (FileDescriptor) linkedList.pollFirst();
if (fileDescriptor2 != null) {
i(fileDescriptor2);
return;
}
return;
}
Log.i("openvpn", "Got unrecognized line from managment".concat(str));
fy4.r("MGMT: Got unrecognized line from management:".concat(str));
}
public final void e(String str) {
int i;
Intent intent;
if (!str.startsWith("OPEN_URL:") && !str.startsWith("CR_TEXT:")) {
fy4.f("Info message from server:".concat(str));
return;
}
OpenVPNService openVPNService = this.d;
openVPNService.getClass();
String str2 = str.split(":", 2)[0];
NotificationManager notificationManager = (NotificationManager) openVPNService.getSystemService("notification");
Notification.Builder builder = new Notification.Builder(openVPNService);
builder.setAutoCancel(true);
builder.setSmallIcon(android.R.drawable.ic_dialog_info);
if (str2.equals("OPEN_URL")) {
String str3 = str.split(":", 2)[1];
i = R.string.openurl_requested;
builder.setContentTitle(openVPNService.getString(R.string.openurl_requested));
builder.setContentText(str3);
intent = new Intent(openVPNService, (Class<?>) InternalWebView.class);
intent.setData(Uri.parse(str3));
intent.addFlags(268435456);
} else if (str2.equals("CR_TEXT")) {
String str4 = str.split(":", 2)[1];
i = R.string.crtext_requested;
builder.setContentTitle(openVPNService.getString(R.string.crtext_requested));
builder.setContentText(str4);
intent = new Intent();
intent.setComponent(new ComponentName(openVPNService, openVPNService.getPackageName() + ".activities.CredentialsPopup"));
intent.putExtra("de.blinkt.openvpn.core.CR_TEXT_CHALLENGE", str4);
} else {
fy4.i("Unknown SSO method found: ".concat(str2));
return;
}
PendingIntent activity = PendingIntent.getActivity(openVPNService, 0, intent, AccessibilityEventCompat.TYPE_VIEW_TARGETED_BY_SCROLL);
fy4.z("USER_INPUT", "waiting for user input", i, z50.LEVEL_WAITING_FOR_USER_INPUT, intent);
builder.setContentIntent(activity);
try {
builder.getClass().getMethod("setPriority", Integer.TYPE).invoke(builder, 2);
builder.getClass().getMethod("setUsesChronometer", Boolean.TYPE).invoke(builder, Boolean.TRUE);
} catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException | InvocationTargetException e) {
fy4.k(null, e);
}
int i2 = Build.VERSION.SDK_INT;
builder.setCategory(NotificationCompat.CATEGORY_STATUS);
builder.setLocalOnly(true);
if (i2 >= 26) {
builder.setChannelId("PandaVpn");
}
notificationManager.notify(-370124770, builder.getNotification());
}
public final void g(String str) {
boolean z;
int i;
String str2;
String str3;
SocketAddress socketAddress;
String[] split = str.split(",", 3);
boolean z2 = false;
int parseInt = Integer.parseInt(split[0]) - 1;
x50[] x50VarArr = this.c.d0;
String str4 = null;
if (x50VarArr.length > parseInt) {
x50 x50Var = x50VarArr[parseInt];
i = x50Var.s;
str2 = x50Var.t;
str3 = x50Var.u;
z = x50Var.v;
this.A = x50Var;
} else {
fy4.i(String.format(Locale.ENGLISH, "OpenVPN is asking for a proxy of an unknown connection entry (%d)", Integer.valueOf(parseInt)));
z = false;
i = 1;
str2 = null;
str3 = null;
}
if (i == 1) {
xx4 xx4Var = this.c;
try {
Proxy V = f13.V(new URL(String.format("https://%s:%s", xx4Var.o0, xx4Var.p0)));
if (V != null) {
socketAddress = V.address();
}
} catch (MalformedURLException e) {
fy4.h(R.string.getproxy_error, e.getLocalizedMessage());
} catch (URISyntaxException e2) {
fy4.h(R.string.getproxy_error, e2.getLocalizedMessage());
}
socketAddress = null;
if (socketAddress instanceof InetSocketAddress) {
InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
str2 = inetSocketAddress.getHostName();
str3 = String.valueOf(inetSocketAddress.getPort());
i = 2;
if (split.length < 2 && i == 2 && split[1].equals("UDP")) {
fy4.n("Not using an HTTP proxy since the connection uses UDP");
} else {
str4 = str2;
}
if (i != 4) {
fy4.y("WAIT_ORBOT", "Waiting for Orbot to start", R.string.state_waitorbot, z50.LEVEL_CONNECTING_NO_SERVER_REPLY_YET);
if (ut2.d == null) {
ut2.d = new ut2();
}
ut2 ut2Var = ut2.d;
if (!ut2.a(this.d)) {
fy4.i("Orbot does not seem to be installed!");
}
this.a.postDelayed(this.y, 20000L);
OpenVPNService openVPNService = this.d;
zs2 zs2Var = this.z;
synchronized (ut2Var) {
if (ut2Var.b.size() == 0) {
openVPNService.getApplicationContext().registerReceiver(ut2Var.c, new IntentFilter("org.torproject.android.intent.action.STATUS"));
ut2Var.a = openVPNService.getApplicationContext();
}
if (!ut2.a(openVPNService)) {
zs2Var.getClass();
fy4.f("Orbot not yet installed");
}
ut2Var.b.add(zs2Var);
}
Context context = ut2Var.a;
Intent intent = new Intent("org.torproject.android.intent.action.START");
intent.setPackage("org.torproject.android");
intent.putExtra("org.torproject.android.intent.extra.PACKAGE_NAME", context.getPackageName());
context.sendBroadcast(intent);
return;
}
k(i, str4, str3, z2);
return;
}
}
z2 = z;
if (split.length < 2) {
}
str4 = str2;
if (i != 4) {
}
}
public final void h(String str) {
String str2;
byte[] doFinal;
String[] split = str.split(",");
boolean equals = split[1].equals("RSA_PKCS1_PADDING");
OpenVPNService openVPNService = this.d;
String str3 = split[0];
xx4 xx4Var = this.c;
xx4Var.getClass();
byte[] decode = Base64.decode(str3, 0);
String str4 = null;
if (xx4Var.a == 8) {
if (!TextUtils.isEmpty(null)) {
try {
doFinal = zm2.o0(openVPNService, xx4Var.c, decode);
} catch (KeyChainException | InterruptedException e) {
fy4.h(R.string.error_extapp_sign, null, e.getClass().toString(), e.getLocalizedMessage());
}
}
doFinal = null;
} else {
PrivateKey privateKey = xx4Var.r0;
try {
if (privateKey.getAlgorithm().equals("EC")) {
Signature signature = Signature.getInstance("NONEwithECDSA");
signature.initSign(privateKey);
signature.update(decode);
doFinal = signature.sign();
} else {
if (equals) {
str2 = "RSA/ECB/PKCS1PADDING";
} else {
str2 = "RSA/ECB/NoPadding";
}
Cipher cipher = Cipher.getInstance(str2);
cipher.init(1, privateKey);
doFinal = cipher.doFinal(decode);
}
} catch (InvalidKeyException | NoSuchAlgorithmException | SignatureException | BadPaddingException | IllegalBlockSizeException | NoSuchPaddingException e2) {
fy4.h(R.string.error_rsa_sign, e2.getClass().toString(), e2.getLocalizedMessage());
}
}
if (doFinal != null) {
str4 = Base64.encodeToString(doFinal, 2);
}
b("pk-sig\n");
if (str4 == null) {
b("\nEND\n");
l();
} else {
b(str4);
b("\nEND\n");
}
}
public final void i(FileDescriptor fileDescriptor) {
try {
if (!this.d.protect(((Integer) FileDescriptor.class.getDeclaredMethod("getInt$", new Class[0]).invoke(fileDescriptor, new Object[0])).intValue())) {
fy4.r("Could not protect VPN socket");
}
a(fileDescriptor);
} catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException | NullPointerException | InvocationTargetException e) {
fy4.k("Failed to retrieve fd from socket (" + fileDescriptor + ")", e);
StringBuilder sb = new StringBuilder("Failed to retrieve fd from socket: ");
sb.append(fileDescriptor);
Log.d("Openvpn", sb.toString());
}
}
public final void j() {
this.a.removeCallbacks(this.x);
if (System.currentTimeMillis() - this.s < CoroutineLiveDataKt.DEFAULT_TIMEOUT) {
try {
Thread.sleep(3000L);
} catch (InterruptedException unused) {
}
}
this.r = false;
this.s = System.currentTimeMillis();
b("hold release\n");
b("bytecount 2\n");
b("state on\n");
}
public final void k(int i, String str, String str2, boolean z) {
String str3;
if (i == 1 || str == null) {
str3 = "proxy NONE\n";
} else {
fy4.m(R.string.using_proxy, str, str);
String str4 = z ? " auto" : "";
Locale locale = Locale.ENGLISH;
Object[] objArr = new Object[4];
objArr[0] = i == 2 ? "HTTP" : "SOCKS";
objArr[1] = str;
objArr[2] = str2;
objArr[3] = str4;
str3 = String.format(locale, "proxy %s %s %s%s\n", objArr);
}
b(str3);
}
@Override
public final void run() {
FileDescriptor[] fileDescriptorArr;
byte[] bArr = new byte[2048];
String str = "";
Vector vector = B;
synchronized (vector) {
vector.add(this);
}
try {
LocalSocket accept = this.q.accept();
this.b = accept;
InputStream inputStream = accept.getInputStream();
try {
this.q.close();
} catch (IOException e) {
fy4.k(null, e);
}
b("version 3\n");
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
return;
}
try {
fileDescriptorArr = this.b.getAncillaryFileDescriptors();
} catch (IOException e2) {
fy4.k("Error reading fds from socket", e2);
fileDescriptorArr = null;
}
if (fileDescriptorArr != null) {
Collections.addAll(this.e, fileDescriptorArr);
}
str = str + new String(bArr, 0, read, "UTF-8");
while (str.contains("\n")) {
String[] split = str.split("\\r?\\n", 2);
d(split[0]);
if (split.length == 1) {
str = "";
} else {
str = split[1];
}
}
}
} catch (IOException e3) {
if (!e3.getMessage().equals("socket closed") && !e3.getMessage().equals("Connection reset by peer")) {
fy4.k(null, e3);
}
Vector vector2 = B;
synchronized (vector2) {
vector2.remove(this);
}
}
}
}