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

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

MD5 校验值:d47de9d0b292a5cbd7377502c33607ba

反编译源代码说明

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


package t4;

import j5.o;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.util.HashMap;
import java.util.Vector;

public final class c implements a5.d {

    public static final u1.a f8114h = new u1.a(c.class);

    public final a5.i f8116b;

    public final HashMap f8115a = new HashMap();

    public final Vector f8117c = new Vector();

    public int f8118d = 100;

    public final HashMap f8119e = new HashMap();

    public final Vector f8120f = new Vector();

    public boolean f8121g = true;

    public c(a5.i iVar) {
        this.f8116b = iVar;
        iVar.getClass();
        a5.h hVar = new a5.h();
        hVar.f95a = this;
        hVar.f96b = 80;
        hVar.f97c = 100;
        synchronized (iVar.f112m) {
            iVar.f112m.addElement(hVar);
        }
    }

    public static IOException g(String str, a aVar) {
        Throwable th;
        synchronized (aVar.f8109q) {
            th = aVar.f8110r;
        }
        return new IOException(str, th);
    }

    @Override
    public final void a(int i10, byte[] bArr) {
        byte b10 = bArr[0];
        switch (b10) {
            case 80:
                w1.b bVar = new w1.b(0, i10, 1, bArr);
                bVar.b();
                bVar.f();
                if (bVar.a()) {
                    this.f8116b.i(new byte[]{82});
                }
                f8114h.getClass();
                return;
            case 81:
                synchronized (this.f8117c) {
                    this.f8117c.notifyAll();
                }
                f8114h.getClass();
                return;
            case 82:
                r();
                return;
            default:
                switch (b10) {
                    case 90:
                        l(i10, bArr);
                        return;
                    case 91:
                        m(i10, bArr);
                        return;
                    case 92:
                        n(i10, bArr);
                        return;
                    case 93:
                        q(i10, bArr);
                        return;
                    case 94:
                        i(i10, bArr);
                        return;
                    case 95:
                        j(i10, bArr);
                        return;
                    case 96:
                        if (i10 == 5) {
                            int i11 = ((bArr[1] & 255) << 24) | ((bArr[2] & 255) << 16) | ((bArr[3] & 255) << 8) | (bArr[4] & 255);
                            a f10 = f(i11);
                            if (f10 != null) {
                                f10.a();
                                f8114h.getClass();
                                return;
                            }
                            throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_EOF message for non-existent channel ", i11));
                        }
                        throw new IOException(o.g("SSH_MSG_CHANNEL_EOF message has wrong size (", i10, ")"));
                    case 97:
                        h(i10, bArr);
                        return;
                    case 98:
                        o(i10, bArr);
                        return;
                    case 99:
                        p(i10, bArr);
                        return;
                    case 100:
                        k(i10, bArr);
                        return;
                    default:
                        throw new IOException("Cannot handle unknown channel message " + (bArr[0] & 255));
                }
        }
    }

    @Override
    public final void b(IOException iOException) {
        f8114h.getClass();
        synchronized (this.f8120f) {
            for (int i10 = 0; i10 < this.f8120f.size(); i10++) {
                f fVar = (f) ((i) this.f8120f.elementAt(i10));
                fVar.getClass();
                try {
                    fVar.f8132o.close();
                } catch (IOException unused) {
                }
            }
            this.f8121g = false;
        }
        synchronized (this.f8117c) {
            for (int i11 = 0; i11 < this.f8117c.size(); i11++) {
                a aVar = (a) this.f8117c.elementAt(i11);
                synchronized (aVar) {
                    aVar.a();
                    aVar.f8103k = 4;
                    aVar.c(new IOException("The connection is being shutdown", iOException));
                    aVar.notifyAll();
                }
            }
            this.f8117c.setSize(0);
            this.f8117c.trimToSize();
            this.f8117c.notifyAll();
        }
    }

    public final int c(a aVar) {
        int i10;
        synchronized (this.f8117c) {
            this.f8117c.addElement(aVar);
            i10 = this.f8118d;
            this.f8118d = i10 + 1;
        }
        return i10;
    }

    public final void d(String str) {
        synchronized (this.f8115a) {
            if (str != null) {
                a.a.r(this.f8115a.get(str));
            }
        }
    }

    public final void e(a aVar, String str) {
        byte[] bArr = new byte[5];
        synchronized (aVar) {
            aVar.f8103k = 4;
            aVar.a();
            aVar.c(new IOException(str));
            bArr[0] = 97;
            int i10 = aVar.f8099g;
            bArr[1] = (byte) (i10 >> 24);
            bArr[2] = (byte) (i10 >> 16);
            bArr[3] = (byte) (i10 >> 8);
            bArr[4] = (byte) i10;
            aVar.notifyAll();
        }
        synchronized (aVar.f8100h) {
            if (aVar.f8101i) {
                return;
            }
            this.f8116b.k(bArr);
            aVar.f8101i = true;
            f8114h.getClass();
        }
    }

    public final a f(int i10) {
        synchronized (this.f8117c) {
            for (int i11 = 0; i11 < this.f8117c.size(); i11++) {
                a aVar = (a) this.f8117c.elementAt(i11);
                if (aVar.f8098f == i10) {
                    return aVar;
                }
            }
            return null;
        }
    }

    public final void h(int i10, byte[] bArr) {
        if (i10 == 5) {
            int i11 = ((bArr[1] & 255) << 24) | ((bArr[2] & 255) << 16) | ((bArr[3] & 255) << 8) | (bArr[4] & 255);
            a f10 = f(i11);
            if (f10 != null) {
                synchronized (f10) {
                    f10.a();
                    f10.f8103k = 4;
                    f10.c(new IOException("Close requested by remote"));
                    t(f10.f8098f);
                    f10.notifyAll();
                }
                f8114h.getClass();
                return;
            }
            throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_CLOSE message for non-existent channel ", i11));
        }
        throw new IOException(o.g("SSH_MSG_CHANNEL_CLOSE message has wrong size (", i10, ")"));
    }

    public final void i(int i10, byte[] bArr) {
        if (i10 > 9) {
            int i11 = ((bArr[1] & 255) << 24) | ((bArr[2] & 255) << 16) | ((bArr[3] & 255) << 8) | (bArr[4] & 255);
            int i12 = (bArr[8] & 255) | ((bArr[5] & 255) << 24) | ((bArr[6] & 255) << 16) | ((bArr[7] & 255) << 8);
            a f10 = f(i11);
            if (f10 != null) {
                int i13 = i10 - 9;
                if (i12 == i13) {
                    f8114h.getClass();
                    synchronized (f10) {
                        int i14 = f10.f8103k;
                        if (i14 == 4) {
                            return;
                        }
                        if (i14 == 2) {
                            int i15 = f10.f8104l;
                            if (i15 >= i12) {
                                f10.f8104l = i15 - i12;
                                f10.f8096d.t(bArr, 9, i12);
                                return;
                            }
                            throw new IOException("Remote sent too much data, does not fit into window.");
                        }
                        throw new IOException("Got SSH_MSG_CHANNEL_DATA, but channel is not in correct state (" + f10.f8103k + ")");
                    }
                }
                throw new IOException("SSH_MSG_CHANNEL_DATA message has wrong len (calculated " + i13 + ", got " + i12 + ")");
            }
            throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_DATA message for non-existent channel ", i11));
        }
        throw new IOException(o.g("SSH_MSG_CHANNEL_DATA message has wrong size (", i10, ")"));
    }

    public final void j(int i10, byte[] bArr) {
        if (i10 > 13) {
            int i11 = ((bArr[1] & 255) << 24) | ((bArr[2] & 255) << 16) | ((bArr[3] & 255) << 8) | (bArr[4] & 255);
            int i12 = (bArr[8] & 255) | ((bArr[5] & 255) << 24) | ((bArr[6] & 255) << 16) | ((bArr[7] & 255) << 8);
            int i13 = ((bArr[9] & 255) << 24) | ((bArr[10] & 255) << 16) | ((bArr[11] & 255) << 8) | (bArr[12] & 255);
            a f10 = f(i11);
            if (f10 != null) {
                if (i12 == 1) {
                    int i14 = i10 - 13;
                    if (i13 == i14) {
                        f8114h.getClass();
                        synchronized (f10) {
                            int i15 = f10.f8103k;
                            if (i15 == 4) {
                                return;
                            }
                            if (i15 == 2) {
                                int i16 = f10.f8104l;
                                if (i16 >= i13) {
                                    f10.f8104l = i16 - i13;
                                    f10.f8097e.t(bArr, 13, i13);
                                    return;
                                }
                                throw new IOException("Remote sent too much data, does not fit into window.");
                            }
                            throw new IOException("Got SSH_MSG_CHANNEL_EXTENDED_DATA, but channel is not in correct state (" + f10.f8103k + ")");
                        }
                    }
                    throw new IOException("SSH_MSG_CHANNEL_EXTENDED_DATA message has wrong len (calculated " + i14 + ", got " + i13 + ")");
                }
                throw new IOException(o.g("SSH_MSG_CHANNEL_EXTENDED_DATA message has unknown type (", i12, ")"));
            }
            throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_EXTENDED_DATA message for non-existent channel ", i11));
        }
        throw new IOException(o.g("SSH_MSG_CHANNEL_EXTENDED_DATA message has wrong size (", i10, ")"));
    }

    public final void k(int i10, byte[] bArr) {
        if (i10 == 5) {
            int i11 = ((bArr[1] & 255) << 24) | ((bArr[2] & 255) << 16) | ((bArr[3] & 255) << 8) | (bArr[4] & 255);
            a f10 = f(i11);
            if (f10 != null) {
                synchronized (f10) {
                    f10.notifyAll();
                }
                f8114h.getClass();
                return;
            }
            throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_FAILURE message for non-existent channel ", i11));
        }
        throw new IOException(o.g("SSH_MSG_CHANNEL_FAILURE message has wrong size (", i10, ")"));
    }

    public final void l(int i10, byte[] bArr) {
        w1.b bVar = new w1.b(0, i10, 1, bArr);
        bVar.b();
        String f10 = bVar.f();
        int h10 = bVar.h();
        int h11 = bVar.h();
        int h12 = bVar.h();
        if ("x11".equals(f10)) {
            synchronized (this.f8115a) {
                if (this.f8115a.size() == 0) {
                    a5.i iVar = this.f8116b;
                    y4.b bVar2 = new y4.b();
                    bVar2.c(92);
                    bVar2.h(h10);
                    bVar2.h(1);
                    bVar2.g("X11 forwarding not activated");
                    bVar2.g("");
                    iVar.i(bVar2.a());
                    f8114h.getClass();
                    return;
                }
                bVar.f();
                bVar.h();
                a aVar = new a(this);
                synchronized (aVar) {
                    aVar.f8099g = h10;
                    aVar.f8105m = h11 & 4294967295L;
                    aVar.f8107o = h12;
                    aVar.f8098f = c(aVar);
                }
                j jVar = new j(aVar);
                jVar.setDaemon(true);
                jVar.start();
                return;
            }
        }
        if ("forwarded-tcpip".equals(f10)) {
            bVar.f();
            int h13 = bVar.h();
            bVar.f();
            bVar.h();
            synchronized (this.f8119e) {
                a.a.r(this.f8119e.get(new Integer(h13)));
            }
            a5.i iVar2 = this.f8116b;
            y4.b bVar3 = new y4.b();
            bVar3.c(92);
            bVar3.h(h10);
            bVar3.h(1);
            bVar3.g("No thanks, unknown port in forwarded-tcpip request");
            bVar3.g("");
            iVar2.i(bVar3.a());
            f8114h.getClass();
            return;
        }
        a5.i iVar3 = this.f8116b;
        y4.b bVar4 = new y4.b();
        bVar4.c(92);
        bVar4.h(h10);
        bVar4.h(3);
        bVar4.g("Unknown channel type");
        bVar4.g("");
        iVar3.i(bVar4.a());
        f8114h.getClass();
    }

    public final void m(int i10, byte[] bArr) {
        System.arraycopy(bArr, 0, new byte[i10], 0, i10);
        w1.b bVar = new w1.b(0, i10, 1, bArr);
        int b10 = bVar.b();
        if (b10 == 91) {
            int h10 = bVar.h();
            int h11 = bVar.h();
            int h12 = bVar.h();
            int h13 = bVar.h();
            if (bVar.f8844c - bVar.f8843b == 0) {
                a f10 = f(h10);
                if (f10 != null) {
                    synchronized (f10) {
                        if (f10.f8103k == 1) {
                            f10.f8099g = h11;
                            f10.f8105m = h12 & 4294967295L;
                            f10.f8107o = h13;
                            f10.f8103k = 2;
                            f10.notifyAll();
                        } else {
                            throw new IOException("Unexpected SSH_MSG_CHANNEL_OPEN_CONFIRMATION message for channel " + h10);
                        }
                    }
                    f8114h.getClass();
                    return;
                }
                throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_OPEN_CONFIRMATION message for non-existent channel ", h10));
            }
            throw new IOException("Padding in SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet!");
        }
        throw new IOException(o.g("This is not a SSH_MSG_CHANNEL_OPEN_CONFIRMATION! (", b10, ")"));
    }

    public final void n(int i10, byte[] bArr) {
        String str;
        if (i10 >= 5) {
            w1.b bVar = new w1.b(0, i10, 1, bArr);
            bVar.b();
            int h10 = bVar.h();
            a f10 = f(h10);
            if (f10 != null) {
                int h11 = bVar.h();
                String g10 = bVar.g("UTF-8");
                if (h11 != 1) {
                    if (h11 != 2) {
                        if (h11 != 3) {
                            if (h11 != 4) {
                                str = o.g("UNKNOWN REASON CODE (", h11, ")");
                            } else {
                                str = "SSH_OPEN_RESOURCE_SHORTAGE";
                            }
                        } else {
                            str = "SSH_OPEN_UNKNOWN_CHANNEL_TYPE";
                        }
                    } else {
                        str = "SSH_OPEN_CONNECT_FAILED";
                    }
                } else {
                    str = "SSH_OPEN_ADMINISTRATIVELY_PROHIBITED";
                }
                StringBuffer stringBuffer = new StringBuffer();
                stringBuffer.append(g10);
                for (int i11 = 0; i11 < stringBuffer.length(); i11++) {
                    char charAt = stringBuffer.charAt(i11);
                    if (charAt < ' ' || charAt > '~') {
                        stringBuffer.setCharAt(i11, (char) 65533);
                    }
                }
                synchronized (f10) {
                    f10.a();
                    f10.f8103k = 4;
                    f10.c(new IOException("The server refused to open the channel (" + str + ", '" + ((Object) stringBuffer) + "')"));
                    f10.notifyAll();
                }
                f8114h.getClass();
                return;
            }
            throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_OPEN_FAILURE message for non-existent channel ", h10));
        }
        throw new IOException(o.g("SSH_MSG_CHANNEL_OPEN_FAILURE message has wrong size (", i10, ")"));
    }

    public final void o(int i10, byte[] bArr) {
        w1.b bVar = new w1.b(0, i10, 1, bArr);
        bVar.b();
        int h10 = bVar.h();
        a f10 = f(h10);
        if (f10 != null) {
            String g10 = bVar.g("US-ASCII");
            boolean a10 = bVar.a();
            f8114h.getClass();
            if (g10.equals("exit-status")) {
                if (!a10) {
                    int h11 = bVar.h();
                    if (bVar.f8844c - bVar.f8843b == 0) {
                        synchronized (f10) {
                            new Integer(h11);
                            f10.notifyAll();
                        }
                        return;
                    }
                    throw new IOException("Badly formatted SSH_MSG_CHANNEL_REQUEST message");
                }
                throw new IOException("Badly formatted SSH_MSG_CHANNEL_REQUEST message, 'want reply' is true");
            }
            if (g10.equals("exit-signal")) {
                if (!a10) {
                    bVar.g("US-ASCII");
                    bVar.a();
                    bVar.f();
                    bVar.f();
                    if (bVar.f8844c - bVar.f8843b == 0) {
                        synchronized (f10) {
                            f10.notifyAll();
                        }
                        return;
                    }
                    throw new IOException("Badly formatted SSH_MSG_CHANNEL_REQUEST message");
                }
                throw new IOException("Badly formatted SSH_MSG_CHANNEL_REQUEST message, 'want reply' is true");
            }
            if (a10) {
                int i11 = f10.f8099g;
                this.f8116b.i(new byte[]{100, (byte) (i11 >> 24), (byte) (i11 >> 16), (byte) (i11 >> 8), (byte) i11});
                return;
            }
            return;
        }
        throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_REQUEST message for non-existent channel ", h10));
    }

    public final void p(int i10, byte[] bArr) {
        if (i10 == 5) {
            int i11 = ((bArr[1] & 255) << 24) | ((bArr[2] & 255) << 16) | ((bArr[3] & 255) << 8) | (bArr[4] & 255);
            a f10 = f(i11);
            if (f10 != null) {
                synchronized (f10) {
                    f10.notifyAll();
                }
                f8114h.getClass();
                return;
            }
            throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_SUCCESS message for non-existent channel ", i11));
        }
        throw new IOException(o.g("SSH_MSG_CHANNEL_SUCCESS message has wrong size (", i10, ")"));
    }

    public final void q(int i10, byte[] bArr) {
        if (i10 == 9) {
            int i11 = ((bArr[1] & 255) << 24) | ((bArr[2] & 255) << 16) | ((bArr[3] & 255) << 8) | (bArr[4] & 255);
            int i12 = (bArr[8] & 255) | ((bArr[5] & 255) << 24) | ((bArr[6] & 255) << 16) | ((bArr[7] & 255) << 8);
            a f10 = f(i11);
            if (f10 != null) {
                synchronized (f10) {
                    long j10 = f10.f8105m + (i12 & 4294967295L);
                    f10.f8105m = j10;
                    if (j10 > 4294967295L) {
                        f10.f8105m = 4294967295L;
                    }
                    f10.notifyAll();
                }
                f8114h.getClass();
                return;
            }
            throw new IOException(a.a.j("Unexpected SSH_MSG_CHANNEL_WINDOW_ADJUST message for non-existent channel ", i11));
        }
        throw new IOException(o.g("SSH_MSG_CHANNEL_WINDOW_ADJUST message has wrong size (", i10, ")"));
    }

    public final void r() {
        synchronized (this.f8117c) {
            this.f8117c.notifyAll();
        }
        f8114h.getClass();
    }

    public final a s(String str, int i10) {
        int c4;
        a aVar = new a(this);
        synchronized (aVar) {
            c4 = c(aVar);
            aVar.f8098f = c4;
        }
        int i11 = aVar.f8104l;
        int i12 = aVar.f8106n;
        a5.i iVar = this.f8116b;
        y4.b bVar = new y4.b();
        bVar.c(90);
        bVar.g("direct-tcpip");
        bVar.h(c4);
        bVar.h(i11);
        bVar.h(i12);
        bVar.g(str);
        bVar.h(i10);
        bVar.g("127.0.0.1");
        bVar.h(0);
        iVar.k(bVar.a());
        v(aVar);
        return aVar;
    }

    public final void t(int i10) {
        synchronized (this.f8117c) {
            int i11 = 0;
            while (true) {
                if (i11 >= this.f8117c.size()) {
                    break;
                }
                if (((a) this.f8117c.elementAt(i11)).f8098f == i10) {
                    this.f8117c.removeElementAt(i11);
                    break;
                }
                i11++;
            }
        }
    }

    public final void u(a aVar) {
        synchronized (aVar) {
            if (aVar.f8103k != 1) {
                return;
            }
            aVar.f8103k = 2;
            int i10 = aVar.f8099g;
            int i11 = aVar.f8098f;
            int i12 = aVar.f8104l;
            int i13 = aVar.f8106n;
            synchronized (aVar.f8100h) {
                if (aVar.f8101i) {
                    return;
                }
                a5.i iVar = this.f8116b;
                y4.b bVar = new y4.b();
                bVar.c(91);
                bVar.h(i10);
                bVar.h(i11);
                bVar.h(i12);
                bVar.h(i13);
                iVar.k(bVar.a());
            }
        }
    }

    public final void v(a aVar) {
        int i10;
        synchronized (aVar) {
            while (true) {
                i10 = aVar.f8103k;
                if (i10 != 1) {
                    break;
                }
                try {
                    aVar.wait();
                } catch (InterruptedException unused) {
                    throw new InterruptedIOException();
                }
            }
            if (i10 != 2) {
                t(aVar.f8098f);
                throw g("Could not open channel (state:" + aVar.f8103k + ")", aVar);
            }
        }
    }
}