APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:SSH T PROJECT VPN
版本号:3.1.2
包名称:app.sshtproject

MD5 校验值:d47de9d0b292a5cbd7377502c33607ba

反编译源代码说明

h.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package p4;

import android.content.Context;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import com.sshlib.service.DtVpnService;
import java.io.File;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
import java.util.Vector;

public final class h extends Thread {

    public final ParcelFileDescriptor f7252m;

    public final String f7254o;

    public final String f7257r;

    public final String f7258s;

    public Context f7260u;

    public Process f7261v;

    public File f7262w;

    public b0.b f7263x;

    public final int f7253n = 1500;

    public final String f7255p = "255.255.255.0";

    public final String f7256q = "127.0.0.1:5521";

    public final boolean f7259t = true;

    public h(Context context, ParcelFileDescriptor parcelFileDescriptor, String str, String str2, String str3) {
        this.f7260u = context;
        this.f7252m = parcelFileDescriptor;
        this.f7254o = str;
        this.f7257r = str2;
        this.f7258s = str3;
    }

    public static boolean a(ParcelFileDescriptor parcelFileDescriptor, File file) {
        for (int i10 = 10; i10 >= 0; i10--) {
            try {
                LocalSocket localSocket = new LocalSocket();
                localSocket.connect(new LocalSocketAddress(file.getAbsolutePath(), LocalSocketAddress.Namespace.FILESYSTEM));
                localSocket.setFileDescriptorsForSend(new FileDescriptor[]{parcelFileDescriptor.getFileDescriptor()});
                localSocket.getOutputStream().write(42);
                localSocket.shutdownOutput();
                localSocket.close();
                return true;
            } catch (IOException unused) {
                Thread.sleep(500L);
            }
        }
        return false;
    }

    @Override
    public final void interrupt() {
        super.interrupt();
        Process process = this.f7261v;
        if (process != null) {
            process.destroy();
            this.f7261v = null;
        }
        try {
            this.f7252m.close();
        } catch (IOException unused) {
        }
        this.f7260u = null;
    }

    @Override
    public final void run() {
        File file;
        final int i10 = 0;
        try {
            Vector vector = new Vector();
            File G = com.bumptech.glide.f.G(this.f7260u, new File(this.f7260u.getFilesDir(), "libtun2socksv2"), "libtun2socksv2");
            this.f7262w = G;
            if (G != null) {
                ParcelFileDescriptor parcelFileDescriptor = this.f7252m;
                if (parcelFileDescriptor != null) {
                    Context context = this.f7260u;
                    Object obj = p.e.f6852a;
                    if (Build.VERSION.SDK_INT >= 24) {
                        file = q.e.b(context);
                    } else {
                        String str = context.getApplicationInfo().dataDir;
                        if (str != null) {
                            file = new File(str);
                        } else {
                            file = null;
                        }
                    }
                    File file2 = new File(file, "sock_path");
                    try {
                        if (file2.exists()) {
                            file2.delete();
                        }
                        if (file2.createNewFile()) {
                            vector.add(this.f7262w.getCanonicalPath());
                            vector.add("--netif-ipaddr");
                            vector.add(this.f7254o);
                            vector.add("--netif-netmask");
                            vector.add(this.f7255p);
                            vector.add("--socks-server-addr");
                            vector.add(this.f7256q);
                            vector.add("--tunmtu");
                            vector.add(String.valueOf(this.f7253n));
                            vector.add("--tunfd");
                            vector.add(String.valueOf(parcelFileDescriptor.getFd()));
                            vector.add("--sock");
                            vector.add(file2.getAbsolutePath());
                            vector.add("--loglevel");
                            vector.add("3");
                            if (this.f7259t) {
                                vector.add("--udpgw-transparent-dns");
                            }
                            String str2 = this.f7257r;
                            if (str2 != null) {
                                vector.add("--udpgw-remote-server-addr");
                                vector.add(str2);
                            }
                            String str3 = this.f7258s;
                            if (str3 != null) {
                                vector.add("--dnsgw");
                                vector.add(str3);
                            }
                            Process start = new ProcessBuilder(vector).start();
                            this.f7261v = start;
                            InputStream inputStream = start.getInputStream();
                            final b0.b bVar = this.f7263x;
                            Objects.requireNonNull(bVar);
                            f fVar = new f(inputStream, new e() {
                                @Override
                                public final void a(String str4) {
                                    int i11 = i10;
                                    b0.b bVar2 = bVar;
                                    switch (i11) {
                                        case 0:
                                            ((DtVpnService) bVar2.f1063n).f1988o.getClass();
                                            d4.a.a(str4, new Object[0]);
                                            return;
                                        default:
                                            ((DtVpnService) bVar2.f1063n).f1988o.getClass();
                                            d4.a.a(str4, new Object[0]);
                                            return;
                                    }
                                }
                            });
                            InputStream errorStream = this.f7261v.getErrorStream();
                            final b0.b bVar2 = this.f7263x;
                            Objects.requireNonNull(bVar2);
                            final int i11 = 1;
                            f fVar2 = new f(errorStream, new e() {
                                @Override
                                public final void a(String str4) {
                                    int i112 = i11;
                                    b0.b bVar22 = bVar2;
                                    switch (i112) {
                                        case 0:
                                            ((DtVpnService) bVar22.f1063n).f1988o.getClass();
                                            d4.a.a(str4, new Object[0]);
                                            return;
                                        default:
                                            ((DtVpnService) bVar22.f1063n).f1988o.getClass();
                                            d4.a.a(str4, new Object[0]);
                                            return;
                                    }
                                }
                            });
                            fVar.start();
                            fVar2.start();
                            if (a(parcelFileDescriptor, file2)) {
                                this.f7261v.waitFor();
                                return;
                            }
                            throw new IOException("Unable to send file descriptor");
                        }
                        throw new IOException("Unable to create socket file");
                    } catch (IOException unused) {
                        throw new IOException("Unable to create socket file: " + file2.getAbsolutePath());
                    }
                }
                return;
            }
            throw new IOException("Unable to load tun2socks binary");
        } catch (Exception e10) {
            b0.b bVar3 = this.f7263x;
            String message = e10.getMessage();
            ((DtVpnService) bVar3.f1063n).f1988o.getClass();
            d4.a.a(message, new Object[0]);
        }
    }
}