Ostrich VPN v1.19.0222版本的 MD5 值为:1b442e5f3dd93fd660d88d6f4b94ace3
以下内容为反编译后的 OpenVpnConfigHelper.java 源代码,内容仅作参考
package com.best.free.vpn.proxy.connect;
import com.best.free.vpn.proxy.base.GlobalKt;
import com.best.free.vpn.proxy.connect.bean.ServerBean;
import com.best.free.vpn.proxy.util.LogKt;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.io.CloseableKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
@Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u0000 \r2\u00020\u0001:\u0001\rB\u0005¢\u0006\u0002\u0010\u0002J\u0006\u0010\u0007\u001a\u00020\bJ\u000e\u0010\t\u001a\u00020\b2\u0006\u0010\n\u001a\u00020\u000bJ\u0010\u0010\f\u001a\u00020\b2\u0006\u0010\n\u001a\u00020\u000bH\u0002R\u0014\u0010\u0003\u001a\u00020\u0004X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u000e"}, d2 = {"Lcom/best/free/vpn/proxy/connect/OpenVpnConfigHelper;", "", "()V", "OVPN_CONF", "", "getOVPN_CONF", "()Ljava/lang/String;", "clearConfigFiles", "", "generateConfig", "server", "Lcom/best/free/vpn/proxy/connect/bean/ServerBean;", "generateUserpassFile", "Companion", "vpnkt-v1.19.0(222)_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class OpenVpnConfigHelper {
public static final Companion INSTANCE = new Companion(0 == true ? 1 : 0);
private static final String filePath_conf;
private static final String filePath_u_p;
private static final String path;
private final String OVPN_CONF = "\nmanagement-client\nmanagement-hold\nmanagement-query-passwords\nclient\nverb 3\nnobind\ndev tun\nredirect-gateway bypass-dhcp\ncipher AES-256-GCM\nauth SHA256\n;proto udp\n;comp-lzo\npersist-tun\nresolv-retry infinite\nconnect-timeout 15\nconnect-retry-max 1\nsuppress-timestamps\n;ob-key }psXoTK70dPOqWLg\n;ncp-disable\n\n;auth-user-pass\n;remote 127.0.0.1\n;remote-cert-tls server\n\n<ca>\n-----BEGIN CERTIFICATE-----\nMIIB/DCCAYKgAwIBAgIUOCoZLdWQO94kS6vSf5pSFAUQRukwCgYIKoZIzj0EAwQw\nFjEUMBIGA1UEAwwLT3N0cmljaCBWUE4wHhcNMjIwMzI4MTUxMzQwWhcNMzIwMzI1\nMTUxMzQwWjAWMRQwEgYDVQQDDAtPc3RyaWNoIFZQTjB2MBAGByqGSM49AgEGBSuB\nBAAiA2IABCeWl0ocXpyvzwvKeexKu3pgipPYhEEAiAq/W04pqFTZDHddpu5r7n0K\nI9b3/FUgV4NsMR9d3R+HV2UUQsoSwoXw6araaXTThiF8PsjFdi6HmpknqPtzoHni\nG21pI6t+nqOBkDCBjTAdBgNVHQ4EFgQUtzz8JjndIbah0cE+EU222VguVJAwUQYD\nVR0jBEowSIAUtzz8JjndIbah0cE+EU222VguVJChGqQYMBYxFDASBgNVBAMMC09z\ndHJpY2ggVlBOghQ4Khkt1ZA73iRLq9J/mlIUBRBG6TAMBgNVHRMEBTADAQH/MAsG\nA1UdDwQEAwIBBjAKBggqhkjOPQQDBANoADBlAjEA8MSzvrcTEa6NMkt25R/W6/6A\n3xmjdnrvDWNtK1Tf2pk874p5bPrnuPP1h0OVQ6KVAjBt1/vyPa2qwv8OqP9VNT7U\no3fhv0nhahhexYoZP2j6r+RxIwzowcmtHinat1cGJnQ=\n-----END CERTIFICATE-----\n</ca>\n<cert>\nCertificate:\n Data:\n Version: 3 (0x2)\n Serial Number:\n ab:8e:1a:b2:26:41:cf:63:b1:4a:b0:61:ab:74:43:8a\n Signature Algorithm: ecdsa-with-SHA512\n Issuer: CN=Ostrich VPN\n Validity\n Not Before: Mar 28 16:04:29 2022 GMT\n Not After : Mar 12 16:04:29 2025 GMT\n Subject: CN=Ostrich VPN\n Subject Public Key Info:\n Public Key Algorithm: id-ecPublicKey\n Public-Key: (384 bit)\n pub:\n 04:16:23:e9:fd:53:75:d7:2d:c4:8f:5b:22:30:ef:\n 2c:0c:af:12:f9:7a:99:9a:1f:2f:04:51:f8:88:b9:\n 3c:c3:49:09:0f:f7:37:1d:30:97:9c:e7:19:53:71:\n 2f:77:cb:54:b8:1d:ff:f0:99:0c:12:c1:15:a5:a4:\n df:ee:e0:fd:75:34:e5:ef:10:23:3d:7a:8f:e8:c6:\n 06:30:ea:45:40:95:37:8c:a8:37:39:39:54:b5:40:\n a8:11:bd:44:77:fb:bd\n ASN1 OID: secp384r1\n NIST CURVE: P-384\n X509v3 extensions:\n X509v3 Basic Constraints:\n CA:FALSE\n X509v3 Subject Key Identifier:\n FE:5A:96:4A:5F:08:BD:DE:B0:B7:36:D8:84:90:70:56:1A:F3:77:06\n X509v3 Authority Key Identifier:\n keyid:B7:3C:FC:26:39:DD:21:B6:A1:D1:C1:3E:11:4D:B6:D9:58:2E:54:90\n DirName:/CN=Ostrich VPN\n serial:38:2A:19:2D:D5:90:3B:DE:24:4B:AB:D2:7F:9A:52:14:05:10:46:E9\n\n X509v3 Extended Key Usage:\n TLS Web Client Authentication\n X509v3 Key Usage:\n Digital Signature\n Signature Algorithm: ecdsa-with-SHA512\n 30:66:02:31:00:a2:be:1b:28:9c:f5:58:81:e5:25:ff:56:c3:\n 4c:ec:32:58:60:cf:15:88:82:a7:0f:8b:a1:67:ce:54:0d:1c:\n a5:39:c3:a4:68:0c:8c:69:8c:bc:76:78:61:1a:aa:b5:5c:02:\n 31:00:bc:91:2a:ca:1d:23:08:ee:6c:ae:f6:56:70:3a:08:81:\n 33:c2:24:80:4c:ed:a6:13:bd:84:e4:73:8e:23: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o/oxgYw6kVAlTeMqDc5OVS1QKgRvUR3+70=\n-----END PRIVATE KEY-----\n</key>\n<tls-crypt>\n#\n# 2048 bit OpenVPN static key\n#\n-----BEGIN OpenVPN Static key V1-----\n723c38d215bf8eb566df3cb9bb40a21d\n2b20677c88b09d45be22f0cbb08dfb57\nab78420c29098552d9fedd73b4d4b722\ndc5e3fb8d8b2ad3a07e2cca6fab5f466\ned74acf8cb56600d90b3a3c9b7b540db\n48e071d585be460492de9bbb48d0f7f2\nc94681a2387dffe7ab82ce95082b7952\n4333842e30542092c43cf97aebef3440\n00f34fb13f0d9db9ab20a25fdc1a95b4\n4b596194cdfc0421c982cd2f0a756622\nf3cd45f5f5d7356b1a77d7cbe5c51300\nd53a489497775b5b12b1fd185f9f314c\n3dfacd0eb281c0aecc2bd8f0317ccc15\n8c4031ca5a871bcce07e1dbe8eb8985a\n405063bce2a26a03ab8edae68c244aea\n9893c74de282aa77748a059b1dc178d5\n-----END OpenVPN Static key V1-----\n</tls-crypt>\n \n ";
public final String getOVPN_CONF() {
return this.OVPN_CONF;
}
@Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0006\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006R\u0011\u0010\u0007\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u0006R\u0010\u0010\t\u001a\u0004\u0018\u00010\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\n"}, d2 = {"Lcom/best/free/vpn/proxy/connect/OpenVpnConfigHelper$Companion;", "", "()V", "filePath_conf", "", "getFilePath_conf", "()Ljava/lang/String;", "filePath_u_p", "getFilePath_u_p", "path", "vpnkt-v1.19.0(222)_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final String getFilePath_conf() {
return OpenVpnConfigHelper.filePath_conf;
}
public final String getFilePath_u_p() {
return OpenVpnConfigHelper.filePath_u_p;
}
}
static {
File cacheDir = GlobalKt.getApplication().getCacheDir();
String absolutePath = cacheDir != null ? cacheDir.getAbsolutePath() : null;
path = absolutePath;
filePath_conf = absolutePath + "/tmp_ov1000.conf";
filePath_u_p = absolutePath + "/tmp_u_p.conf";
}
public final void clearConfigFiles() {
try {
new File(filePath_conf).delete();
new File(filePath_u_p).delete();
} catch (Exception e) {
LogKt.logE(String.valueOf(e.getMessage()));
}
}
public final void generateConfig(ServerBean server) {
Intrinsics.checkNotNullParameter(server, "server");
generateUserpassFile(server);
try {
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath_conf)));
try {
BufferedWriter bufferedWriter2 = bufferedWriter;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, "management /data/data/%s/cache/mgmtsocket unix", Arrays.copyOf(new Object[]{GlobalKt.getApplication().getPackageName()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "format(locale, format, *args)");
bufferedWriter2.write(format);
bufferedWriter2.newLine();
bufferedWriter2.write(this.OVPN_CONF);
bufferedWriter2.newLine();
StringCompanionObject stringCompanionObject2 = StringCompanionObject.INSTANCE;
String format2 = String.format("remote %s %s udp", Arrays.copyOf(new Object[]{server.getIp(), server.getPortString()}, 2));
Intrinsics.checkNotNullExpressionValue(format2, "format(format, *args)");
bufferedWriter2.write(format2);
bufferedWriter2.newLine();
StringCompanionObject stringCompanionObject3 = StringCompanionObject.INSTANCE;
String format3 = String.format("auth-user-pass %s", Arrays.copyOf(new Object[]{filePath_u_p}, 1));
Intrinsics.checkNotNullExpressionValue(format3, "format(format, *args)");
bufferedWriter2.write(format3);
bufferedWriter2.newLine();
Unit unit = Unit.INSTANCE;
CloseableKt.closeFinally(bufferedWriter, null);
} finally {
}
} catch (Exception e) {
LogKt.logE(String.valueOf(e.getMessage()));
}
}
private final void generateUserpassFile(ServerBean server) {
try {
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath_u_p)));
try {
BufferedWriter bufferedWriter2 = bufferedWriter;
bufferedWriter2.write(server.getUserName());
bufferedWriter2.newLine();
bufferedWriter2.write(server.getPasswordOrPath());
bufferedWriter2.newLine();
bufferedWriter2.flush();
bufferedWriter2.close();
Unit unit = Unit.INSTANCE;
CloseableKt.closeFinally(bufferedWriter, null);
} finally {
}
} catch (Exception e) {
LogKt.logE(String.valueOf(e.getMessage()));
}
}
}