CCIPTV PRO v3.0.9.1版本的 MD5 值为:e78d4d980447be4a9f823314f45bbf03
以下内容为反编译后的 c.java 源代码,内容仅作参考
package g.a.a.c;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import g.a.a.c.d;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Vector;
import org.simpleframework.xml.transform.ClassTransform;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
public class c {
public final String[] a = {"config", "tls-server"};
public final String[] b = {"tls-client", "allow-recursive-routing", "askpass", "auth-nocache", "up", "down", "route-up", "ipchange", "route-pre-down", "auth-user-pass-verify", "block-outside-dns", "client-cert-not-required", "dhcp-release", "dhcp-renew", "dh", "group", "ip-win32", "ifconfig-nowarn", "management-hold", "management", "management-client", "management-query-remote", "management-query-passwords", "management-query-proxy", "management-external-key", "management-forget-disconnect", "management-signal", "management-log-cache", "management-up-down", "management-client-user", "management-client-group", "pause-exit", "preresolve", "plugin", "machine-readable-output", "persist-key", "push", "register-dns", "route-delay", "route-gateway", "route-metric", "route-method", "status", "script-security", "show-net-up", "suppress-timestamps", "tap-sleep", "tmp-dir", "tun-ipv6", "topology", "user", "win-sys"};
public final String[][] c = {new String[]{"setenv", "IV_GUI_VER"}, new String[]{"setenv", "IV_SSO"}, new String[]{"setenv", "IV_PLAT_VER"}, new String[]{"setenv", "IV_OPENVPN_GUI_VERSION"}, new String[]{"engine", "dynamic"}, new String[]{"setenv", "CLIENT_CERT"}, new String[]{"resolv-retry", "60"}};
public final String[] f10589d = {"local", "remote", ClassTransform.FLOAT, IjkMediaPlayer.OnNativeInvokeListener.ARG_PORT, "connect-retry", "connect-timeout", "connect-retry-max", "link-mtu", "tun-mtu", "tun-mtu-extra", "fragment", "mtu-disc", "local-port", "remote-port", "bind", "nobind", "proto", "http-proxy", "http-proxy-retry", "http-proxy-timeout", "http-proxy-option", "socks-proxy", "socks-proxy-retry", "http-proxy-user-pass", "explicit-exit-notify"};
public HashSet<String> f10590e = new HashSet<>(Arrays.asList(this.f10589d));
public HashMap<String, Vector<Vector<String>>> f10591f = new HashMap<>();
public HashMap<String, Vector<String>> f10592g = new HashMap<>();
public static class a extends Exception {
public static final long serialVersionUID = -60;
public a(String str) {
super(str);
}
}
public enum b {
initial,
readin_single_quote,
reading_quoted,
reading_unquoted,
done
}
public static void u(d dVar, String str) {
String[] split = g.a.a.a.l(str).split("\n");
if (split.length >= 2) {
dVar.f10606m = split[0];
dVar.f10607n = split[1];
dVar.f10605l = true;
}
}
public static void v(g.a.a.a aVar, String str) {
String[] split = g.a.a.a.l(str).split("\n");
if (split.length >= 2) {
aVar.B = split[0];
aVar.A = split[1];
}
}
public final void a(String str, Vector<String> vector) {
String trim = vector.get(0).trim();
String trim2 = vector.get(1).trim();
File file = new File(str);
try {
if (file.exists()) {
trim.substring(1, trim.length() - 1);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String str2 = "";
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
str2 = (str2 + readLine) + "\n";
}
if (str2.endsWith("\n")) {
str2 = str2.substring(0, str2.length() - 1);
}
vector.clear();
vector.add("ca");
vector.add("[[NAME]]" + trim2 + "[[INLINE]]" + str2);
}
} catch (Exception e2) {
Log.d("", "" + e2);
}
}
public final void b(g.a.a.a aVar) {
String[] strArr;
Iterator<Vector<Vector<String>>> it;
boolean z = false;
for (String str : this.a) {
if (this.f10591f.containsKey(str)) {
throw new a(String.format("Unsupported Option %s encountered in config file. Aborting", str));
}
}
for (String str2 : this.b) {
this.f10591f.remove(str2);
}
for (Vector<Vector<String>> vector : this.f10591f.values()) {
Iterator<Vector<String>> it2 = vector.iterator();
while (it2.hasNext()) {
if (!k(it2.next())) {
z = true;
}
}
}
if (z) {
aVar.G = "# These options found in the config file do not map to config settings:\n" + aVar.G;
while (this.f10591f.values().iterator().hasNext()) {
aVar.G += j(it.next());
}
aVar.F = true;
}
}
public final void c(g.a.a.a aVar, Vector<Vector<String>> vector, boolean z) {
boolean z2 = false;
if (z) {
Iterator<Vector<String>> it = vector.iterator();
boolean z3 = false;
while (it.hasNext()) {
Vector<String> next = it.next();
for (int i2 = 1; i2 < next.size(); i2++) {
if (next.get(i2).equals("block-local")) {
aVar.U = false;
} else if (next.get(i2).equals("unblock-local")) {
aVar.U = true;
} else if (next.get(i2).equals("!ipv4")) {
z3 = true;
} else if (next.get(i2).equals("ipv6")) {
aVar.J = true;
}
}
}
z2 = z3;
}
if (!z || z2) {
return;
}
aVar.u = true;
}
public final void d(Vector<String> vector, BufferedReader bufferedReader) {
String trim = vector.get(0).trim();
if (!trim.startsWith("<") || !trim.endsWith(">")) {
return;
}
String substring = trim.substring(1, trim.length() - 1);
String format = String.format("</%s>", substring);
String str = "[[INLINE]]";
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
throw new a(String.format("No endtag </%s> for starttag <%s> found", substring, substring));
}
if (readLine.trim().equals(format)) {
if (str.endsWith("\n")) {
str = str.substring(0, str.length() - 1);
}
vector.clear();
vector.add(substring);
vector.add(str);
return;
}
str = (str + readLine) + "\n";
}
}
public final void e(Vector<String> vector, BufferedReader bufferedReader, String str, String str2) {
String trim = vector.get(0).trim();
if (!trim.startsWith("<") || !trim.endsWith(">")) {
if (trim.equals("ca")) {
String trim2 = vector.get(1).trim();
a(trim2 != null ? str.replaceAll(str2, trim2) : "", vector);
return;
}
return;
}
String substring = trim.substring(1, trim.length() - 1);
String format = String.format("</%s>", substring);
String str3 = "[[INLINE]]";
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
throw new a(String.format("No endtag </%s> for starttag <%s> found", substring, substring));
}
if (readLine.trim().equals(format)) {
if (str3.endsWith("\n")) {
str3 = str3.substring(0, str3.length() - 1);
}
vector.clear();
vector.add(substring);
vector.add(str3);
return;
}
str3 = (str3 + readLine) + "\n";
}
}
public g.a.a.a f() {
boolean z;
StringBuilder sb;
String str;
Vector<String> i2;
Vector<String> i3;
Vector<String> i4;
Vector<String> i5;
Vector<String> i6;
int i7;
Vector<String> i8;
int i9;
Vector<String> i10;
Vector<String> i11;
Vector<String> i12;
Vector<String> i13;
Vector<String> i14;
Vector<Vector<String>> h2;
Vector<String> i15;
Vector<String> i16;
int i17;
Vector<String> i18;
Vector<Vector<String>> h3;
Vector<String> i19;
Vector<String> vector;
boolean z2;
d[] dVarArr;
Iterator<Vector<String>> it;
g.a.a.a aVar = new g.a.a.a("converted Profile");
aVar.e();
if (this.f10591f.containsKey("client") || this.f10591f.containsKey("pull")) {
aVar.v = true;
this.f10591f.remove("pull");
this.f10591f.remove("client");
}
int i20 = 2;
Vector<String> i21 = i("secret", 1, 2);
int i22 = 4;
int i23 = 3;
if (i21 != null) {
aVar.c = 4;
aVar.f10584n = true;
aVar.f10578h = i21.get(1);
if (i21.size() == 3) {
aVar.f10577g = i21.get(2);
}
z = false;
} else {
z = true;
}
Vector<Vector<String>> h4 = h("route", 1, 4);
String str2 = "";
if (h4 != null) {
Iterator<Vector<String>> it2 = h4.iterator();
String str3 = "";
String str4 = str3;
while (it2.hasNext()) {
Vector<String> next = it2.next();
String str5 = next.size() >= i23 ? next.get(i20) : "255.255.255.255";
String str6 = next.size() >= 4 ? next.get(i23) : "vpn_gateway";
try {
g.a.a.c.b bVar = new g.a.a.c.b(next.get(1), str5);
if (str6.equals("net_gateway")) {
str4 = str4 + bVar.toString() + " ";
} else {
str3 = str3 + bVar.toString() + " ";
}
i20 = 2;
i23 = 3;
} catch (ArrayIndexOutOfBoundsException unused) {
throw new a("Could not parse netmask of route " + str5);
} catch (NumberFormatException unused2) {
throw new a("Could not parse netmask of route " + str5);
}
}
aVar.w = str3;
aVar.V = str4;
}
Vector<Vector<String>> h5 = h("route-ipv6", 1, 4);
if (h5 != null) {
while (h5.iterator().hasNext()) {
str2 = str2 + it.next().get(1) + " ";
}
aVar.K = str2;
}
if (i("route-nopull", 0, 0) != null) {
aVar.C = true;
}
Vector<Vector<String>> h6 = h("tls-auth", 1, 2);
if (h6 != null) {
Iterator<Vector<String>> it3 = h6.iterator();
while (it3.hasNext()) {
Vector<String> next2 = it3.next();
if (next2 != null) {
if (!next2.get(1).equals("[inline]")) {
aVar.f10578h = next2.get(1);
aVar.f10584n = true;
}
if (next2.size() == 3) {
aVar.f10577g = next2.get(2);
}
}
}
}
Vector<String> i24 = i("key-direction", 1, 1);
if (i24 != null) {
aVar.f10577g = i24.get(1);
}
String[] strArr = {"tls-crypt", "tls-crypt-v2"};
int i25 = 0;
for (int i26 = 2; i25 < i26; i26 = 2) {
String str7 = strArr[i25];
Vector<String> i27 = i(str7, 1, 1);
if (i27 != null) {
aVar.f10584n = true;
aVar.f10578h = i27.get(1);
aVar.f10577g = str7;
}
i25++;
}
Vector<Vector<String>> h7 = h("redirect-gateway", 0, 7);
if (h7 != null) {
c(aVar, h7, true);
}
Vector<Vector<String>> h8 = h("redirect-private", 0, 5);
if (h8 != null) {
c(aVar, h8, false);
}
Vector<String> i28 = i("dev", 1, 1);
Vector<String> i29 = i("dev-type", 1, 1);
if ((i29 == null || !i29.get(1).equals("tun")) && ((i28 == null || !i28.get(1).startsWith("tun")) && !(i29 == null && i28 == null))) {
throw new a("Sorry. Only tun mode is supported. See the FAQ for more detail");
}
Vector<String> i30 = i("mssfix", 0, 2);
if (i30 != null) {
if (i30.size() >= 2) {
try {
aVar.W = Integer.parseInt(i30.get(1));
} catch (NumberFormatException unused3) {
throw new a("Argument to --mssfix has to be an integer");
}
} else {
aVar.W = 1450;
}
if (i30.size() >= 3 && !i30.get(2).equals("mtu")) {
throw new a("Second argument to --mssfix unkonwn");
}
}
Vector<String> i31 = i("tun-mtu", 1, 1);
if (i31 != null) {
try {
aVar.g0 = Integer.parseInt(i31.get(1));
} catch (NumberFormatException unused4) {
throw new a("Argument to --tun-mtu has to be an integer");
}
}
Vector<String> i32 = i("mode", 1, 1);
if (i32 == null || i32.get(1).equals("p2p")) {
int i33 = 2;
Vector<Vector<String>> h9 = h("dhcp-option", 2, 2);
if (h9 != null) {
Iterator<Vector<String>> it4 = h9.iterator();
while (it4.hasNext()) {
Vector<String> next3 = it4.next();
String str8 = next3.get(1);
String str9 = next3.get(i33);
if (str8.equals("DOMAIN")) {
aVar.t = next3.get(i33);
} else if (str8.equals("DNS")) {
aVar.s = true;
if (aVar.f10585o.equals(g.a.a.a.t0)) {
aVar.f10585o = str9;
} else {
aVar.f10586p = str9;
}
}
i33 = 2;
}
}
Vector<String> i34 = i("ifconfig", 2, 2);
if (i34 != null) {
try {
aVar.f10587q = new g.a.a.c.b(i34.get(1), i34.get(2)).toString();
} catch (NumberFormatException e2) {
throw new a("Could not pase ifconfig IP address: " + e2.getLocalizedMessage());
}
}
if (i("remote-random-hostname", 0, 0) != null) {
aVar.D = true;
}
if (i(ClassTransform.FLOAT, 0, 0) != null) {
aVar.E = true;
}
if (i("comp-lzo", 0, 1) != null) {
aVar.f10581k = true;
}
Vector<String> i35 = i("ncp-ciphers", 1, 1);
Vector<String> i36 = i("data-ciphers", 1, 1);
Vector<String> i37 = i("cipher", 1, 1);
if (i37 != null) {
aVar.H = i37.get(1);
}
if (i36 != null) {
i35 = i36;
}
if (i35 == null) {
if (!TextUtils.isEmpty(aVar.H) && !aVar.H.equals("AES-128-GCM") && !aVar.H.equals("AES-256")) {
sb = new StringBuilder();
sb.append(aVar.r0);
str = "AES-256-GCM:AES-128-GCM:";
sb.append(str);
sb.append(aVar.H);
aVar.r0 = sb.toString();
}
i2 = i("auth", 1, 1);
if (i2 != null) {
}
i3 = i("ca", 1, 1);
if (i3 != null) {
}
i4 = i("cert", 1, 1);
if (i4 != null) {
}
i5 = i("key", 1, 1);
if (i5 != null) {
}
i6 = i("pkcs12", 1, 1);
if (i6 == null) {
}
if (i("cryptoapicert", 1, 1) != null) {
}
Vector<String> i38 = i("compat-names", 1, i7);
Vector<String> i39 = i("no-name-remapping", 1, 1);
i8 = i("tls-remote", 1, 1);
if (i8 == null) {
}
i10 = i("verify-x509-name", 1, i9);
if (i10 != null) {
}
i11 = i("x509-username-field", 1, 1);
if (i11 != null) {
}
i12 = i("verb", 1, 1);
if (i12 != null) {
}
if (i("nobind", 0, 0) != null) {
}
if (i("persist-tun", 0, 0) != null) {
}
if (i("push-peer-info", 0, 0) != null) {
}
i13 = i("connect-retry", 1, 2);
if (i13 != null) {
}
i14 = i("connect-retry-max", 1, 1);
if (i14 != null) {
}
h2 = h("remote-cert-tls", 1, 1);
if (h2 != null) {
}
i15 = i("auth-user-pass", 0, 1);
if (i15 != null) {
}
i16 = i("auth-retry", 1, 1);
if (i16 != null) {
}
i17 = 2;
i18 = i("crl-verify", 1, i17);
if (i18 != null) {
}
d.h.q.d<d, d[]> q2 = q(null);
aVar.X = q2.b;
h3 = h("connection", 1, 1);
if (aVar.X.length > 0) {
}
if (h3 != null) {
}
if (i("remote-random", 0, 0) != null) {
}
i19 = i("proto-force", 1, 1);
if (i19 != null) {
}
String[] strArr2 = {"PROFILE", "FRIENDLY_NAME"};
while (r8 < 2) {
}
vector = this.f10592g.get("USERNAME");
if (vector != null) {
}
b(aVar);
g(aVar);
return aVar;
}
aVar.r0 = i35.get(1);
if (!TextUtils.isEmpty(aVar.H) && !aVar.r0.contains(aVar.H)) {
sb = new StringBuilder();
sb.append(aVar.r0);
str = ":";
sb.append(str);
sb.append(aVar.H);
aVar.r0 = sb.toString();
}
i2 = i("auth", 1, 1);
if (i2 != null) {
aVar.R = i2.get(1);
}
i3 = i("ca", 1, 1);
if (i3 != null) {
aVar.f10580j = i3.get(1);
}
i4 = i("cert", 1, 1);
if (i4 != null) {
aVar.f10576f = i4.get(1);
aVar.c = 0;
z = false;
}
i5 = i("key", 1, 1);
if (i5 != null) {
aVar.f10579i = i5.get(1);
}
i6 = i("pkcs12", 1, 1);
if (i6 == null) {
aVar.f10582l = i6.get(1);
i7 = 2;
aVar.c = 2;
z = false;
} else {
i7 = 2;
}
if (i("cryptoapicert", 1, 1) != null) {
aVar.c = i7;
z = false;
}
Vector<String> i382 = i("compat-names", 1, i7);
Vector<String> i392 = i("no-name-remapping", 1, 1);
i8 = i("tls-remote", 1, 1);
if (i8 == null) {
aVar.z = i8.get(1);
aVar.x = true;
aVar.S = 0;
if (i382 != null) {
i9 = 2;
} else {
i9 = 2;
}
} else {
i9 = 2;
}
i10 = i("verify-x509-name", 1, i9);
if (i10 != null) {
aVar.z = i10.get(1);
aVar.x = true;
if (i10.size() <= i9) {
i22 = 2;
} else if (i10.get(i9).equals("name")) {
aVar.S = 3;
} else if (i10.get(i9).equals("subject")) {
aVar.S = i9;
} else if (!i10.get(i9).equals("name-prefix")) {
throw new a("Unknown parameter to verify-x509-name: " + i10.get(2));
}
aVar.S = i22;
}
i11 = i("x509-username-field", 1, 1);
if (i11 != null) {
aVar.T = i11.get(1);
}
i12 = i("verb", 1, 1);
if (i12 != null) {
i12.get(1);
}
if (i("nobind", 0, 0) != null) {
aVar.I = true;
}
if (i("persist-tun", 0, 0) != null) {
aVar.M = true;
}
if (i("push-peer-info", 0, 0) != null) {
aVar.h0 = true;
}
i13 = i("connect-retry", 1, 2);
if (i13 != null) {
aVar.O = i13.get(1);
if (i13.size() > 2) {
aVar.P = i13.get(2);
}
}
i14 = i("connect-retry-max", 1, 1);
if (i14 != null) {
aVar.N = i14.get(1);
}
h2 = h("remote-cert-tls", 1, 1);
if (h2 != null) {
if (h2.get(0).get(1).equals("server")) {
aVar.y = true;
} else {
this.f10591f.put("remotetls", h2);
}
}
i15 = i("auth-user-pass", 0, 1);
if (i15 != null) {
if (z) {
aVar.c = 3;
} else {
int i40 = aVar.c;
if (i40 == 0) {
aVar.c = 5;
} else if (i40 == 2) {
aVar.c = 7;
}
}
if (i15.size() > 1) {
if (!i15.get(1).startsWith("[[INLINE]]")) {
i15.get(1);
}
aVar.B = null;
v(aVar, i15.get(1));
}
}
i16 = i("auth-retry", 1, 1);
if (i16 != null) {
if (!i16.get(1).equals("none")) {
if (i16.get(1).equals("nointeract")) {
i17 = 2;
} else {
i17 = 2;
if (!i16.get(1).equals("interact")) {
throw new a("Unknown parameter to auth-retry: " + i16.get(2));
}
}
aVar.f0 = i17;
i18 = i("crl-verify", 1, i17);
if (i18 != null) {
if (i18.size() == 3 && i18.get(i17).equals("dir")) {
aVar.G += m(" ", i18) + "\n";
} else {
aVar.c0 = i18.get(1);
}
}
d.h.q.d<d, d[]> q22 = q(null);
aVar.X = q22.b;
h3 = h("connection", 1, 1);
if (aVar.X.length > 0 || h3 == null) {
if (h3 != null) {
aVar.X = new d[h3.size()];
Iterator<Vector<String>> it5 = h3.iterator();
int i41 = 0;
while (it5.hasNext()) {
d[] dVarArr2 = p(it5.next().get(1), q22.a).b;
if (dVarArr2.length != 1) {
throw new a("A <connection> block must have exactly one remote");
}
aVar.X[i41] = dVarArr2[0];
i41++;
}
}
if (i("remote-random", 0, 0) != null) {
aVar.Y = true;
}
i19 = i("proto-force", 1, 1);
if (i19 != null) {
String str10 = i19.get(1);
if (str10.equals("udp")) {
z2 = true;
} else if (!str10.equals("tcp")) {
throw new a(String.format("Unknown protocol %s in proto-force", str10));
} else {
z2 = false;
}
for (d dVar : aVar.X) {
if (dVar.f10597d == z2) {
dVar.f10600g = false;
}
}
}
String[] strArr22 = {"PROFILE", "FRIENDLY_NAME"};
for (int i42 = 0; i42 < 2; i42++) {
Vector<String> vector2 = this.f10592g.get(strArr22[i42]);
if (vector2 != null && vector2.size() > 1) {
aVar.f10574d = vector2.get(1);
}
}
vector = this.f10592g.get("USERNAME");
if (vector != null && vector.size() > 1) {
aVar.B = vector.get(1);
}
b(aVar);
g(aVar);
return aVar;
}
throw new a("Using a <connection> block and --remote is not allowed.");
}
aVar.f0 = 0;
}
i17 = 2;
i18 = i("crl-verify", 1, i17);
if (i18 != null) {
}
d.h.q.d<d, d[]> q222 = q(null);
aVar.X = q222.b;
h3 = h("connection", 1, 1);
if (aVar.X.length > 0) {
}
if (h3 != null) {
}
if (i("remote-random", 0, 0) != null) {
}
i19 = i("proto-force", 1, 1);
if (i19 != null) {
}
String[] strArr222 = {"PROFILE", "FRIENDLY_NAME"};
while (i42 < 2) {
}
vector = this.f10592g.get("USERNAME");
if (vector != null) {
aVar.B = vector.get(1);
}
b(aVar);
g(aVar);
return aVar;
}
throw new a("Invalid mode for --mode specified, need p2p");
}
public final void g(g.a.a.a aVar) {
if (aVar.z.equals(aVar.k0)) {
aVar.z = "";
}
}
public final Vector<Vector<String>> h(String str, int i2, int i3) {
Vector<Vector<String>> vector = this.f10591f.get(str);
if (vector == null) {
return null;
}
Iterator<Vector<String>> it = vector.iterator();
while (it.hasNext()) {
Vector<String> next = it.next();
if (next.size() < i2 + 1 || next.size() > i3 + 1) {
throw new a(String.format(Locale.getDefault(), "Option %s has %d parameters, expected between %d and %d", str, Integer.valueOf(next.size() - 1), Integer.valueOf(i2), Integer.valueOf(i3)));
}
while (it.hasNext()) {
}
}
this.f10591f.remove(str);
return vector;
}
public final Vector<String> i(String str, int i2, int i3) {
Vector<Vector<String>> h2 = h(str, i2, i3);
if (h2 == null) {
return null;
}
return h2.lastElement();
}
public final String j(Vector<Vector<String>> vector) {
Iterator<String> it;
Iterator<Vector<String>> it2 = vector.iterator();
String str = "";
while (it2.hasNext()) {
Vector<String> next = it2.next();
if (!k(next)) {
if (next.size() == 2 && "extra-certs".equals(next.get(0))) {
str = str + g.a.a.a.K(next.get(0), next.get(1));
} else {
while (next.iterator().hasNext()) {
str = str + g.a.a.a.Q(it.next()) + " ";
}
str = str + "\n";
}
}
}
return str;
}
public boolean k(Vector<String> vector) {
String[][] strArr;
for (String[] strArr2 : this.c) {
if (vector.size() >= strArr2.length) {
boolean z = true;
for (int i2 = 0; i2 < strArr2.length; i2++) {
if (!strArr2[i2].equals(vector.get(i2))) {
z = false;
}
}
if (z) {
return true;
}
}
}
return false;
}
public final boolean l(String str) {
if (str.equals("udp") || str.equals("udp4") || str.equals("udp6")) {
return true;
}
if (str.equals("tcp-client") || str.equals("tcp") || str.equals("tcp4") || str.endsWith("tcp4-client") || str.equals("tcp6") || str.endsWith("tcp6-client")) {
return false;
}
throw new a("Unsupported option to --proto " + str);
}
public final String m(String str, Vector<String> vector) {
return Build.VERSION.SDK_INT > 26 ? defpackage.c.a(str, vector) : TextUtils.join(str, vector);
}
public void n(Reader reader) {
HashMap hashMap = new HashMap();
hashMap.put("server-poll-timeout", "timeout-connect");
BufferedReader bufferedReader = new BufferedReader(reader);
int i2 = 0;
while (true) {
try {
String readLine = bufferedReader.readLine();
i2++;
if (readLine == null) {
return;
}
if (i2 == 1) {
if (readLine.startsWith("PK\u0003\u0004") || readLine.startsWith("PK\u0007\u00008")) {
break;
} else if (readLine.startsWith("\ufeff")) {
readLine = readLine.substring(1);
}
}
if (readLine.startsWith("# OVPN_ACCESS_SERVER_")) {
Vector<String> s = s(readLine);
this.f10592g.put(s.get(0), s);
} else {
Vector<String> r = r(readLine);
if (r.size() != 0) {
if (r.get(0).startsWith("--")) {
r.set(0, r.get(0).substring(2));
}
d(r, bufferedReader);
String str = r.get(0);
if (hashMap.get(str) != null) {
str = (String) hashMap.get(str);
}
if (!this.f10591f.containsKey(str)) {
this.f10591f.put(str, new Vector<>());
}
this.f10591f.get(str).add(r);
}
}
} catch (OutOfMemoryError e2) {
throw new a("File too large to parse: " + e2.getLocalizedMessage());
}
}
throw new a("Input looks like a ZIP Archive. Import is only possible for OpenVPN config files (.ovpn/.conf)");
}
public void o(Reader reader, String str, String str2, Context context) {
HashMap hashMap = new HashMap();
hashMap.put("server-poll-timeout", "timeout-connect");
BufferedReader bufferedReader = new BufferedReader(reader);
int i2 = 0;
while (true) {
try {
String readLine = bufferedReader.readLine();
i2++;
if (readLine == null) {
return;
}
if (i2 == 1) {
if (readLine.startsWith("PK\u0003\u0004") || readLine.startsWith("PK\u0007\u00008")) {
break;
} else if (readLine.startsWith("\ufeff")) {
readLine = readLine.substring(1);
}
}
if (readLine.startsWith("# OVPN_ACCESS_SERVER_")) {
Vector<String> s = s(readLine);
this.f10592g.put(s.get(0), s);
} else {
Vector<String> r = r(readLine);
if (r.size() != 0) {
if (r.get(0).startsWith("--")) {
r.set(0, r.get(0).substring(2));
}
e(r, bufferedReader, str, str2);
String str3 = r.get(0);
if (hashMap.get(str3) != null) {
str3 = (String) hashMap.get(str3);
}
if (!this.f10591f.containsKey(str3)) {
this.f10591f.put(str3, new Vector<>());
}
this.f10591f.get(str3).add(r);
}
}
} catch (OutOfMemoryError e2) {
throw new a("File too large to parse: " + e2.getLocalizedMessage());
}
}
throw new a("Input looks like a ZIP Archive. Import is only possible for OpenVPN config files (.ovpn/.conf)");
}
public final d.h.q.d<d, d[]> p(String str, d dVar) {
c cVar = new c();
cVar.n(new StringReader(str.substring(10)));
return cVar.q(dVar);
}
public final d.h.q.d<d, d[]> q(d dVar) {
d clone;
if (dVar != null) {
try {
clone = dVar.clone();
} catch (CloneNotSupportedException e2) {
e2.printStackTrace();
return null;
}
} else {
clone = new d();
}
Vector<String> i2 = i(IjkMediaPlayer.OnNativeInvokeListener.ARG_PORT, 1, 1);
if (i2 != null) {
clone.c = i2.get(1);
}
Vector<String> i3 = i("rport", 1, 1);
if (i3 != null) {
clone.c = i3.get(1);
}
Vector<String> i4 = i("proto", 1, 1);
if (i4 != null) {
clone.f10597d = l(i4.get(1));
}
Vector<String> i5 = i("connect-timeout", 1, 1);
int i6 = 0;
if (i5 != null) {
try {
clone.f10601h = Integer.parseInt(i5.get(1));
} catch (NumberFormatException e3) {
throw new a(String.format("Argument to connect-timeout (%s) must to be an integer: %s", i5.get(1), e3.getLocalizedMessage()));
}
}
Vector<String> i7 = i("socks-proxy", 1, 2);
if (i7 == null) {
i7 = i("http-proxy", 2, 2);
}
if (i7 != null) {
if (i7.get(0).equals("socks-proxy")) {
clone.f10602i = d.a.SOCKS5;
clone.f10604k = "1080";
} else {
clone.f10602i = d.a.HTTP;
}
clone.f10603j = i7.get(1);
if (i7.size() >= 3) {
clone.f10604k = i7.get(2);
}
}
Vector<String> i8 = i("http-proxy-user-pass", 1, 1);
if (i8 != null) {
u(clone, i8.get(1));
}
Vector<Vector<String>> h2 = h("remote", 1, 3);
Vector vector = new Vector();
for (Map.Entry<String, Vector<Vector<String>>> entry : this.f10591f.entrySet()) {
if (dVar != null || this.f10590e.contains(entry.getKey())) {
clone.f10598e += j(entry.getValue());
vector.add(entry.getKey());
}
}
Iterator it = vector.iterator();
while (it.hasNext()) {
this.f10591f.remove((String) it.next());
}
String str = clone.f10598e;
if (str != null && !"".equals(str.trim())) {
clone.f10599f = true;
}
if (h2 == null) {
h2 = new Vector<>();
}
d[] dVarArr = new d[h2.size()];
Iterator<Vector<String>> it2 = h2.iterator();
while (it2.hasNext()) {
Vector<String> next = it2.next();
try {
dVarArr[i6] = clone.clone();
} catch (CloneNotSupportedException e4) {
e4.printStackTrace();
}
int size = next.size();
if (size != 2) {
if (size != 3) {
if (size != 4) {
i6++;
} else {
dVarArr[i6].f10597d = l(next.get(3));
}
}
dVarArr[i6].c = next.get(2);
}
dVarArr[i6].b = next.get(1);
i6++;
}
return d.h.q.d.a(clone, dVarArr);
}
public final Vector<String> r(String str) {
Vector<String> vector = new Vector<>();
if (str.length() == 0) {
return vector;
}
b bVar = b.initial;
String str2 = "";
int i2 = 0;
boolean z = false;
char c = 0;
while (true) {
char charAt = i2 < str.length() ? str.charAt(i2) : (char) 0;
if (!z && charAt == '\\' && bVar != b.readin_single_quote) {
z = true;
} else if (bVar == b.initial) {
if (!t(charAt)) {
if (charAt == ';' || charAt == '#') {
break;
} else if (!z && charAt == '\"') {
bVar = b.reading_quoted;
} else if (z || charAt != '\'') {
bVar = b.reading_unquoted;
c = charAt;
} else {
bVar = b.readin_single_quote;
}
}
if (bVar == b.done) {
bVar = b.initial;
vector.add(str2);
str2 = "";
c = 0;
}
if (!z && c != 0 && c != '\\' && c != '\"' && !t(c)) {
throw new a("Options warning: Bad backslash ('\\') usage");
}
z = false;
} else {
if (bVar == b.reading_unquoted) {
if (!z) {
}
c = charAt;
} else if (bVar == b.reading_quoted) {
if (!z) {
}
c = charAt;
} else if (bVar == b.readin_single_quote) {
}
if (bVar == b.done) {
}
if (!z) {
}
z = false;
}
if (c != 0) {
str2 = str2 + c;
}
int i3 = i2 + 1;
if (i2 >= str.length()) {
break;
}
i2 = i3;
}
return vector;
}
public final Vector<String> s(String str) {
String[] split = str.split("#\\sOVPN_ACCESS_SERVER_", 2)[1].split("=", 2);
Vector<String> vector = new Vector<>();
Collections.addAll(vector, split);
return vector;
}
public final boolean t(char c) {
return Character.isWhitespace(c) || c == 0;
}
}