导航菜单

页面标题

页面副标题

КЛ£ v1.0.0 - pro5136.java 源代码

正在查看: КЛ£ v1.0.0 应用的 pro5136.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package a.a.a;

import com.app.protect.AppProtectManager;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.king.zxing.util.LogUtils;
import com.zhy.http.okhttp.OkHttpUtils;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java9.util.concurrent.CompletableFuture;
import java9.util.function.Supplier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import tlschannel.ClientTlsChannel;
import tlschannel.NeedsReadException;
import tlschannel.NeedsWriteException;
import tlschannel.TlsChannel;

public class pro5136 {
    public String pro5109;
    public int pro5130;
    public String pro5131;
    public int pro5132;
    public int pro5133;
    public int pro5134;
    public int pro5136;
    public int pro5137;
    public int pro5138;
    public int pro5140;
    public int pro5141;
    public int pro5142;
    public Selector pro5144;
    public ServerSocketChannel pro5145;
    public String pro5135 = "";
    public String pro5139 = "";
    public final Map<SocketChannel, pro5130> pro5143 = new ConcurrentHashMap();
    public final AtomicInteger pro5146 = new AtomicInteger(0);
    public final AtomicLong pro5147 = new AtomicLong(0);
    public final AtomicInteger pro5148 = new AtomicInteger(0);
    public final AtomicLong pro5149 = new AtomicLong(0);
    public final AtomicInteger pro5150 = new AtomicInteger(0);
    public final Map<SocketChannel, ByteBuffer> pro5151 = new ConcurrentHashMap();
    public boolean pro5152 = true;
    public int pro5153 = -1;
    public boolean pro5154 = false;
    public int pro5155 = 0;
    public String pro5156 = "";
    public int pro5157 = 0;

    public Object pro5109(int i, pro5130 pro5130Var) {
        try {
            TimeUnit.MILLISECONDS.sleep(500L);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
        int i2 = (i + 1) % 3;
        pro5109(pro5130Var, pro5109(i2), pro5130(i2));
        return null;
    }

    public static byte[] pro5109(byte[] bArr, byte[] bArr2) {
        int length = bArr.length;
        byte[] bArr3 = new byte[256];
        for (int i = 0; i < 256; i++) {
            bArr3[i] = (byte) i;
        }
        int i2 = 0;
        for (int i3 = 0; i3 < 256; i3++) {
            i2 = (i2 + bArr3[i3] + bArr[i3 % length]) & 255;
            byte b = bArr3[i3];
            bArr3[i3] = bArr3[i2];
            bArr3[i2] = b;
        }
        byte[] bArr4 = (byte[]) bArr2.clone();
        int i4 = 0;
        int i5 = 0;
        for (int i6 = 0; i6 < bArr4.length; i6++) {
            i5 = (i5 + 1) & 255;
            i4 = (i4 + bArr3[i5]) & 255;
            byte b2 = bArr3[i5];
            bArr3[i5] = bArr3[i4];
            bArr3[i4] = b2;
            bArr4[i6] = (byte) (bArr4[i6] ^ bArr3[(bArr3[i5] + bArr3[i4]) & 255]);
        }
        return bArr4;
    }

    public void pro5130(int i, pro5130 pro5130Var) {
        int i2 = (i + 2) % 3;
        pro5109(pro5130Var, pro5109(i2), pro5130(i2));
    }

    public static boolean pro5130(String str) {
        return str == null || str.isEmpty();
    }

    public static void pro5132() {
        try {
            TimeUnit.MILLISECONDS.sleep(500L);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }

    public int pro5109() {
        int i = 0;
        for (pro5130 pro5130Var : this.pro5143.values()) {
            SocketChannel socketChannel = pro5130Var.pro5109;
            SocketChannel socketChannel2 = pro5130Var.pro5130;
            if (socketChannel != null && socketChannel.isConnected() && socketChannel2 != null && socketChannel2.isConnected()) {
                i++;
            }
        }
        return i;
    }

    public final String pro5109(int i) {
        return i == 1 ? this.pro5135 : i == 2 ? this.pro5139 : this.pro5131;
    }

    public final void pro5109(SocketChannel socketChannel) {
        if (socketChannel == null) {
            return;
        }
        try {
            socketChannel.close();
        } catch (IOException e) {
        }
        synchronized (this) {
            SelectionKey keyFor = socketChannel.keyFor(this.pro5144);
            if (keyFor != null) {
                keyFor.cancel();
            }
        }
        Selector selector = this.pro5144;
        if (selector != null) {
            selector.wakeup();
        }
    }

    public final void pro5109(SocketChannel socketChannel, int i, pro5130 pro5130Var) {
        if (socketChannel != null) {
            try {
                SelectionKey keyFor = socketChannel.keyFor(this.pro5144);
                if (keyFor != null) {
                    keyFor.interestOps(keyFor.interestOps() | i);
                } else {
                    socketChannel.register(this.pro5144, i, pro5130Var);
                }
            } catch (Exception e) {
            }
        }
    }

    public final void pro5109(SocketChannel socketChannel, ByteBuffer byteBuffer, pro5130 pro5130Var) {
        ByteBuffer allocate = ByteBuffer.allocate(byteBuffer.remaining());
        allocate.put(byteBuffer);
        allocate.flip();
        this.pro5151.put(socketChannel, allocate);
        pro5109(socketChannel, 4, pro5130Var);
    }

    public final void pro5109(TlsChannel tlsChannel) {
        if (tlsChannel != null) {
            synchronized (this) {
                try {
                    tlsChannel.close();
                } catch (Exception e) {
                }
            }
        }
    }

    public final int pro5130() {
        if (pro5130(this.pro5139)) {
            if (!pro5130(this.pro5135)) {
                int pro5132 = AppProtectManager.pro5132(this.pro5131);
                int pro51322 = AppProtectManager.pro5132(this.pro5135);
                if (pro5132 < 50 && pro51322 < 50) {
                    int i = this.pro5157 + 1;
                    this.pro5157 = i;
                    return i % 2 == 1 ? 1 : 0;
                }
                if (pro5132 > pro51322) {
                    return 1;
                }
            }
            return 0;
        }
        int pro51323 = AppProtectManager.pro5132(this.pro5131);
        int pro51324 = AppProtectManager.pro5132(this.pro5135);
        int pro51325 = AppProtectManager.pro5132(this.pro5139);
        if (pro51323 < 50 && pro51324 < 50 && pro51325 < 50) {
            int i2 = this.pro5157 + 1;
            this.pro5157 = i2;
            int i3 = i2 % 3;
            if (i3 == 1) {
                return 1;
            }
            return i3 == 2 ? 2 : 0;
        }
        if (pro51323 < 50 && pro51324 < 50) {
            int i4 = this.pro5157 + 1;
            this.pro5157 = i4;
            return i4 % 2 == 1 ? 1 : 0;
        }
        if (pro51323 < 50 && pro51325 < 50) {
            int i5 = this.pro5157 + 1;
            this.pro5157 = i5;
            return i5 % 2 == 1 ? 2 : 0;
        }
        if (pro51324 >= 50 || pro51325 >= 50) {
            return pro51323 > pro51324 ? pro51324 > pro51325 ? 2 : 1 : pro51324 > pro51325 ? 2 : 0;
        }
        int i6 = this.pro5157 + 1;
        this.pro5157 = i6;
        return i6 % 2 == 1 ? 2 : 1;
    }

    public final int pro5130(int i) {
        return i == 1 ? this.pro5136 : i == 2 ? this.pro5140 : this.pro5132;
    }

    public final String pro5130(SocketChannel socketChannel) {
        Socket socket;
        InetAddress inetAddress;
        if (socketChannel == null || !socketChannel.isConnected() || (socket = socketChannel.socket()) == null || (inetAddress = socket.getInetAddress()) == null) {
            return null;
        }
        return inetAddress.getHostAddress();
    }

    public void pro5130(SelectionKey selectionKey) {
        try {
            if (selectionKey.isValid()) {
                if (selectionKey.isAcceptable()) {
                    AppProtectManager.pro5109(true);
                    pro5109((ServerSocketChannel) selectionKey.channel());
                } else if (selectionKey.isConnectable()) {
                    pro5109((pro5130) selectionKey.attachment());
                } else if (selectionKey.isReadable()) {
                    pro5109(selectionKey);
                } else if (selectionKey.isWritable()) {
                    pro5130(selectionKey, (SocketChannel) selectionKey.channel());
                }
            }
        } catch (Exception e) {
            pro5131(100);
        }
    }

    public final void pro5130(SelectionKey selectionKey, SocketChannel socketChannel) {
        try {
            ByteBuffer byteBuffer = this.pro5151.get(socketChannel);
            if (byteBuffer != null) {
                pro5130 pro5130Var = (pro5130) selectionKey.attachment();
                TlsChannel tlsChannel = pro5130Var.pro5131;
                boolean equals = socketChannel.equals(pro5130Var.pro5109);
                pro5131(0);
                if (!equals || tlsChannel == null) {
                    while (byteBuffer.hasRemaining() && socketChannel.write(byteBuffer) != 0) {
                    }
                } else {
                    while (byteBuffer.hasRemaining() && tlsChannel.write(byteBuffer) != 0) {
                    }
                }
                if (byteBuffer.hasRemaining()) {
                    return;
                }
                this.pro5151.remove(socketChannel);
            }
        } catch (Exception e) {
            pro5131(105);
            pro5109(selectionKey, socketChannel);
        }
    }

    public void pro5131() {
        try {
            pro5131(0);
            if (this.pro5145 != null) {
                this.pro5145.close();
                this.pro5145 = null;
            }
            for (pro5130 pro5130Var : this.pro5143.values()) {
                if (pro5130Var != null) {
                    pro5109(pro5130Var.pro5109);
                    pro5109(pro5130Var.pro5130);
                    pro5109(pro5130Var.pro5131);
                }
            }
            this.pro5143.clear();
            this.pro5157 = 0;
        } catch (Exception e) {
            pro5131(106);
        }
    }

    public void pro5131(int i) {
        this.pro5146.set(i);
        this.pro5147.set(System.currentTimeMillis());
    }

    public void pro5109(String str, int i, int i2, int i3, boolean z, String str2, String str3, int i4, String str4, int i5, int i6, int i7, int i8, boolean z2) {
        this.pro5131 = str;
        this.pro5133 = i;
        this.pro5134 = i6;
        this.pro5135 = str3;
        this.pro5137 = i4;
        this.pro5138 = i7;
        this.pro5139 = str4;
        this.pro5141 = i5;
        this.pro5142 = i8;
        this.pro5136 = i4;
        this.pro5140 = i5;
        this.pro5132 = i;
        this.pro5153 = i2;
        this.pro5155 = i3;
        this.pro5154 = z;
        this.pro5156 = str2;
    }

    public final void pro5109(pro5130 pro5130Var, String str, int i) {
        if (pro5130Var != null) {
            if (pro5130(pro5130Var.pro5133) || !pro5130Var.pro5130.isConnected()) {
                SocketChannel socketChannel = pro5130Var.pro5109;
                try {
                    if (!pro5130(str) && i != 0) {
                        SocketChannel open = SocketChannel.open();
                        open.configureBlocking(false);
                        pro5130 pro5130Var2 = new pro5130(null, open, this);
                        pro5130Var2.pro5135 = socketChannel;
                        if (open.connect(new InetSocketAddress(str, i))) {
                            pro5109(pro5130Var2);
                        } else {
                            pro5109(open, 8, pro5130Var2);
                        }
                    }
                } catch (IOException e) {
                }
            }
        }
    }

    public final void pro5109(pro5130 pro5130Var) {
        SSLContext pro5109;
        ClientTlsChannel.Builder newBuilder;
        Socket socket;
        int i = 0;
        pro5131(0);
        SocketChannel socketChannel = pro5130Var.pro5109;
        SocketChannel socketChannel2 = pro5130Var.pro5130;
        try {
            if (socketChannel2.finishConnect()) {
                SelectionKey keyFor = socketChannel2.keyFor(this.pro5144);
                if (keyFor != null) {
                    keyFor.interestOps(keyFor.interestOps() & (-9));
                }
                pro5130Var.pro5131 = null;
                pro5130Var.pro5133 = "";
                if (this.pro5154 && (pro5109 = pro5135.pro5109()) != null) {
                    if (AppProtectManager.pro5216) {
                        String pro5130 = pro5130(socketChannel2);
                        if (socketChannel2.isConnected() && (socket = socketChannel2.socket()) != null) {
                            i = socket.getPort();
                        }
                        SSLEngine createSSLEngine = pro5109.createSSLEngine(pro5130, i);
                        createSSLEngine.setUseClientMode(true);
                        pro5135.pro5109(createSSLEngine, pro5130);
                        newBuilder = ClientTlsChannel.newBuilder(socketChannel2, createSSLEngine);
                    } else {
                        newBuilder = ClientTlsChannel.newBuilder(socketChannel2, pro5109);
                    }
                    pro5130Var.pro5131 = newBuilder.build();
                }
                pro5109(socketChannel2, 5, pro5130Var);
                ByteBuffer wrap = ByteBuffer.wrap(pro5109(AppProtectManager.pro5161.getBytes(pro5133.pro5109), (pro5109.pro5109() + LogUtils.VERTICAL + pro5109.pro5109(new Random().nextInt(10) + 11)).getBytes(pro5133.pro5109)));
                while (true) {
                    if (!wrap.hasRemaining()) {
                        break;
                    } else if (socketChannel2.write(wrap) == 0) {
                        pro5109(socketChannel2, wrap, pro5130Var);
                        break;
                    }
                }
                AppProtectManager.pro5243.addAndGet(120L);
                return;
            }
            pro5109(pro5130(socketChannel2));
            pro5109(socketChannel);
            pro5109(socketChannel2);
            pro5109(pro5130Var.pro5131);
        } catch (Exception e) {
            pro5131(101);
            pro5109(pro5130(socketChannel2));
            pro5109(socketChannel);
            pro5109(socketChannel2);
            pro5109(pro5130Var.pro5131);
        }
    }

    public final void pro5109(SelectionKey selectionKey) {
        int read;
        ByteBuffer byteBuffer;
        int i;
        ByteBuffer byteBuffer2;
        SocketChannel socketChannel = (SocketChannel) selectionKey.channel();
        pro5130 pro5130Var = (pro5130) selectionKey.attachment();
        SocketChannel socketChannel2 = pro5130Var.pro5109;
        boolean equals = socketChannel != null ? socketChannel.equals(socketChannel2) : socketChannel == socketChannel2;
        SocketChannel socketChannel3 = equals ? pro5130Var.pro5109 : pro5130Var.pro5130;
        SocketChannel socketChannel4 = equals ? pro5130Var.pro5130 : pro5130Var.pro5109;
        TlsChannel tlsChannel = pro5130Var.pro5131;
        pro5131(0);
        ByteBuffer allocate = ByteBuffer.allocate(16384);
        if (!equals && tlsChannel != null) {
            try {
                if (!pro5130Var.pro5133.isEmpty()) {
                    read = tlsChannel.read(allocate);
                    if (read > 0) {
                        if (read == -1) {
                            pro5109(selectionKey, socketChannel3);
                            return;
                        }
                        return;
                    }
                    allocate.flip();
                    if (!equals && pro5130Var.pro5133.isEmpty()) {
                        byte[] bArr = new byte[allocate.remaining()];
                        allocate.get(bArr);
                        byte[] bytes = AppProtectManager.pro5161.getBytes(pro5133.pro5109);
                        pro5130Var.pro5133 = new String(pro5109(bytes, bArr), pro5133.pro5109).replace("\u0000", "");
                        AppProtectManager.pro5215 = true;
                        int nextInt = new Random().nextInt(10) + 11;
                        StringBuilder sb = new StringBuilder();
                        sb.append(this.pro5155);
                        sb.append(LogUtils.VERTICAL);
                        StringBuilder sb2 = new StringBuilder();
                        sb2.append(this.pro5155);
                        sb2.append(pro5130Var.pro5133);
                        sb2.append("-pZERyQYmz5mIYHWOxifKerOLYpR9tm0i");
                        sb.append(AppProtectManager.pro5134(sb2.toString()));
                        sb.append(LogUtils.VERTICAL);
                        sb.append(pro5109.pro5109(nextInt));
                        ByteBuffer wrap = ByteBuffer.wrap(pro5109(bytes, sb.toString().getBytes(pro5133.pro5109)));
                        pro5131(0);
                        while (true) {
                            if (!wrap.hasRemaining() || socketChannel3 == null) {
                                break;
                            } else if (socketChannel3.write(wrap) == 0) {
                                pro5109(socketChannel3, wrap, pro5130Var);
                                break;
                            }
                        }
                        if (tlsChannel != null) {
                            Thread.sleep(3L);
                            long currentTimeMillis = System.currentTimeMillis() + AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS;
                            while (!r6) {
                                if (System.currentTimeMillis() >= currentTimeMillis) {
                                    throw new SocketTimeoutException("TLS Handshake Timed Out");
                                }
                                try {
                                    tlsChannel.handshake();
                                    r6 = true;
                                } catch (NeedsReadException e) {
                                    pro5131(102);
                                    pro5109(socketChannel3, 1, pro5130Var);
                                } catch (NeedsWriteException e2) {
                                    pro5131(103);
                                    pro5109(socketChannel3, 4, pro5130Var);
                                }
                            }
                        }
                        Thread.sleep(3L);
                        if (pro5130Var.pro5135 != null) {
                            pro5130 pro5130Var2 = this.pro5143.containsKey(pro5130Var.pro5135) ? this.pro5143.get(pro5130Var.pro5135) : null;
                            if (pro5130Var2 == null || pro5130Var2.pro5134 == null) {
                                pro5109(pro5130Var.pro5130);
                                pro5109(pro5130Var.pro5131);
                            } else {
                                pro5130Var2.pro5134.cancel(true);
                                pro5130Var2.pro5134 = null;
                                SocketChannel socketChannel5 = pro5130Var2.pro5130;
                                TlsChannel tlsChannel2 = pro5130Var2.pro5131;
                                String str = pro5130Var2.pro5133;
                                pro5130Var2.pro5130 = pro5130Var.pro5130;
                                pro5130Var2.pro5131 = pro5130Var.pro5131;
                                pro5130Var2.pro5133 = pro5130Var.pro5133;
                                pro5130Var.pro5109 = null;
                                pro5130Var.pro5130 = socketChannel5;
                                pro5130Var.pro5131 = tlsChannel2;
                                pro5130Var.pro5133 = str;
                                pro5130Var2.pro5130.register(this.pro5144, 5, pro5130Var2);
                                pro5130Var2.pro5109.register(this.pro5144, 5, pro5130Var2);
                                pro5109(socketChannel5);
                                pro5109(tlsChannel2);
                            }
                        } else {
                            socketChannel4.register(this.pro5144, 5, pro5130Var);
                        }
                        byteBuffer2 = allocate;
                    } else {
                        pro5131(0);
                        if (!equals || read >= 16384) {
                            byteBuffer = allocate;
                            i = read;
                        } else {
                            int i2 = AppProtectManager.pro5203;
                            if (i2 <= 0) {
                                byteBuffer = allocate;
                                i = read;
                            } else {
                                if (i2 == 11) {
                                    byteBuffer = allocate;
                                    i = read;
                                } else if (i2 == 12) {
                                    byteBuffer = allocate;
                                    i = read;
                                } else {
                                    if (i2 != 1 && i2 != 2) {
                                        byteBuffer = allocate;
                                        i = read;
                                    }
                                    int i3 = AppProtectManager.pro5204;
                                    i = read;
                                    long currentTimeMillis2 = System.currentTimeMillis();
                                    byteBuffer = allocate;
                                    if (currentTimeMillis2 - pro5130Var.pro5137 > 1000) {
                                        pro5130Var.pro5137 = currentTimeMillis2;
                                        pro5130Var.pro5136.set(0);
                                    }
                                    if (!(pro5130Var.pro5136.incrementAndGet() <= i3)) {
                                        byteBuffer.compact();
                                        if (i2 == 2) {
                                            pro5109(selectionKey, socketChannel3);
                                            return;
                                        }
                                        return;
                                    }
                                }
                                if (AppProtectManager.pro5203 > 0) {
                                    long currentTimeMillis3 = System.currentTimeMillis();
                                    if (currentTimeMillis3 - AppProtectManager.pro5230 > 1000) {
                                        AppProtectManager.pro5230 = currentTimeMillis3;
                                        AppProtectManager.pro5229.set(0);
                                    }
                                    if (AppProtectManager.pro5229.incrementAndGet() <= AppProtectManager.pro5204) {
                                    }
                                    if (!r6) {
                                        byteBuffer.compact();
                                        if (i2 == 12) {
                                            pro5109(selectionKey, socketChannel3);
                                            return;
                                        }
                                        return;
                                    }
                                }
                                r6 = true;
                                if (!r6) {
                                }
                            }
                        }
                        if (!equals || tlsChannel == null) {
                            byteBuffer2 = byteBuffer;
                            while (byteBuffer2.hasRemaining() && socketChannel4 != null) {
                                if (socketChannel4.write(byteBuffer2) == 0) {
                                    pro5109(socketChannel4, byteBuffer2, pro5130Var);
                                    break;
                                }
                            }
                            AppProtectManager.pro5243.addAndGet(i + 40);
                        } else {
                            while (byteBuffer.hasRemaining()) {
                                byteBuffer2 = byteBuffer;
                                if (tlsChannel.write(byteBuffer2) == 0) {
                                    pro5109(socketChannel4, byteBuffer2, pro5130Var);
                                    break;
                                }
                                byteBuffer = byteBuffer2;
                            }
                            byteBuffer2 = byteBuffer;
                            AppProtectManager.pro5243.addAndGet(i + 40);
                        }
                    }
                    byteBuffer2.compact();
                    return;
                }
            } catch (Exception e3) {
                pro5131(104);
                if (e3 instanceof NeedsReadException) {
                    pro5109(socketChannel3, 1, pro5130Var);
                    return;
                } else if (e3 instanceof NeedsWriteException) {
                    pro5109(socketChannel4, 4, pro5130Var);
                    return;
                } else {
                    pro5109(selectionKey, socketChannel3);
                    return;
                }
            }
        }
        read = socketChannel3.read(allocate);
        if (read > 0) {
        }
    }

    public final synchronized void pro5109(ServerSocketChannel serverSocketChannel) throws Exception {
        boolean z;
        boolean z2;
        SocketChannel socketChannel;
        String str;
        StringBuilder sb;
        String str2;
        StringBuilder sb2;
        StringBuilder sb3;
        StringBuilder sb4;
        pro5131(0);
        SocketChannel accept = serverSocketChannel.accept();
        if (accept != null) {
            if (!AppProtectManager.pro5130(this.pro5156, pro5109())) {
                pro5109(accept);
                String str3 = this.pro5156;
                int i = this.pro5130;
                if (System.currentTimeMillis() - AppProtectManager.pro5166 > OkHttpUtils.DEFAULT_MILLISECONDS) {
                    AppProtectManager.pro5166 = System.currentTimeMillis();
                    int pro5133 = AppProtectManager.pro5200 == 4 ? AppProtectManager.pro5133(str3) : AppProtectManager.pro5201;
                    int i2 = AppProtectManager.pro5200;
                    if (i2 == 2) {
                        str2 = "连接限制为【局部模式-" + pro5133 + "】,【" + str3 + "】连接数上限,请稍后重试。";
                        int i3 = AppProtectManager.pro5206;
                        if (i3 == 2) {
                            sb3 = new StringBuilder();
                            sb3.append("連接限製為【局部模式-");
                            sb3.append(pro5133);
                            sb3.append("】,【");
                            sb3.append(str3);
                            sb3.append("】連接數上限,請稍後重試。");
                        } else {
                            if (i3 == 3) {
                                sb3 = new StringBuilder();
                                sb3.append("The current instance connection limit is [Partial Mode-");
                                sb3.append(pro5133);
                                sb3.append("]. Your current number of [");
                                sb3.append(str3);
                                sb3.append("] connections has reached the upper limit. Please try again later.");
                            }
                            AppProtectManager.pro5109("", str2, false, 0);
                        }
                        str2 = sb3.toString();
                        AppProtectManager.pro5109("", str2, false, 0);
                    } else {
                        if (i2 == 3) {
                            String str4 = "连接限制为【规则模式-" + pro5133 + "】,【" + str3 + LogUtils.COLON + i + "】连接数上限,请稍后重试。";
                            int i4 = AppProtectManager.pro5206;
                            if (i4 == 2) {
                                sb4 = new StringBuilder();
                                sb4.append("連接限製為【規則模式-");
                                sb4.append(pro5133);
                                sb4.append("】,【");
                                sb4.append(str3);
                                sb4.append(LogUtils.COLON);
                                sb4.append(i);
                                sb4.append("】連接數上限,請稍後重試。");
                            } else if (i4 == 3) {
                                sb4 = new StringBuilder();
                                sb4.append("The current instance connection limit is [Rule Mode-");
                                sb4.append(pro5133);
                                sb4.append("]. Your current number of [");
                                sb4.append(str3);
                                sb4.append(LogUtils.COLON);
                                sb4.append(i);
                                sb4.append("] connections has reached the upper limit. Please try again later.");
                            } else {
                                str2 = str4;
                            }
                            str2 = sb4.toString();
                        } else if (i2 == 4) {
                            str2 = "连接限制为【独立模式-" + pro5133 + "】,【" + str3 + "】连接数上限,请稍后重试。";
                            int i5 = AppProtectManager.pro5206;
                            if (i5 == 2) {
                                sb3 = new StringBuilder();
                                sb3.append("連接限製為【獨立模式-");
                                sb3.append(pro5133);
                                sb3.append("】,【");
                                sb3.append(str3);
                                sb3.append("】連接數上限,請稍後重試。");
                            } else if (i5 == 3) {
                                sb3 = new StringBuilder();
                                sb3.append("The current instance connection limit is [Independent Mode-");
                                sb3.append(pro5133);
                                sb3.append("]. Your current number of [");
                                sb3.append(str3);
                                sb3.append("] connections has reached the upper limit. Please try again later.");
                            }
                            str2 = sb3.toString();
                        } else {
                            str2 = "连接限制为【全局模式-" + pro5133 + "】,连接数上限,请稍后重试。";
                            int i6 = AppProtectManager.pro5206;
                            if (i6 == 2) {
                                sb2 = new StringBuilder();
                                sb2.append("連接限製為【全局模式-");
                                sb2.append(pro5133);
                                sb2.append("】,連接數上限,請稍後重試。");
                            } else if (i6 == 3) {
                                sb2 = new StringBuilder();
                                sb2.append("The current instance connection limit is [Global Mode-");
                                sb2.append(pro5133);
                                sb2.append("]. Your current number of connections has reached the upper limit. Please try again later.");
                            }
                            str2 = sb2.toString();
                        }
                        AppProtectManager.pro5109("", str2, false, 0);
                    }
                }
                return;
            }
            int i7 = AppProtectManager.pro5223;
            if ((i7 == 208 || i7 == 209) && !AppProtectManager.pro5136(AppProtectManager.pro5224)) {
                String[] pro5109 = AppProtectManager.pro5109(AppProtectManager.pro5224, '|');
                if (pro5109.length >= 2 && Integer.parseInt(pro5109[0]) > Integer.parseInt(pro5109[1])) {
                    z = true;
                    if (!z) {
                        pro5109(accept);
                        int i8 = AppProtectManager.pro5223;
                        if ((i8 == 208 || i8 == 209) && !AppProtectManager.pro5136(AppProtectManager.pro5224)) {
                            String[] pro51092 = AppProtectManager.pro5109(AppProtectManager.pro5224, '|');
                            if (pro51092.length >= 2) {
                                int parseInt = Integer.parseInt(pro51092[0]);
                                int parseInt2 = Integer.parseInt(pro51092[1]);
                                if (System.currentTimeMillis() - AppProtectManager.pro5166 > OkHttpUtils.DEFAULT_MILLISECONDS) {
                                    AppProtectManager.pro5166 = System.currentTimeMillis();
                                    int i9 = AppProtectManager.pro5223;
                                    if (i9 == 208) {
                                        str = "设备数上限[" + parseInt + "/" + parseInt2 + "],错误码:2007";
                                        int i10 = AppProtectManager.pro5206;
                                        if (i10 == 2) {
                                            sb = new StringBuilder();
                                            sb.append("設備數上限[");
                                            sb.append(parseInt);
                                            sb.append("/");
                                            sb.append(parseInt2);
                                            sb.append("],錯誤碼:2007");
                                        } else {
                                            if (i10 == 3) {
                                                sb = new StringBuilder();
                                                sb.append("The current number of protection instance devices has reached the upper limit [");
                                                sb.append(parseInt);
                                                sb.append("/");
                                                sb.append(parseInt2);
                                                sb.append("]. Please contact the administrator. Error code 2007");
                                            }
                                            AppProtectManager.pro5109("", str, false, 0);
                                        }
                                        str = sb.toString();
                                        AppProtectManager.pro5109("", str, false, 0);
                                    } else if (i9 == 209) {
                                        str = "连接数上限[" + parseInt + "/" + parseInt2 + "],错误码:2006";
                                        int i11 = AppProtectManager.pro5206;
                                        if (i11 == 2) {
                                            sb = new StringBuilder();
                                            sb.append("連接數上限[");
                                            sb.append(parseInt);
                                            sb.append("/");
                                            sb.append(parseInt2);
                                            sb.append("],錯誤碼:2006");
                                        } else {
                                            if (i11 == 3) {
                                                sb = new StringBuilder();
                                                sb.append("The current number of protection instance connections has reached the upper limit [");
                                                sb.append(parseInt);
                                                sb.append("/");
                                                sb.append(parseInt2);
                                                sb.append("]. Please contact the administrator. Error code 2006");
                                            }
                                            AppProtectManager.pro5109("", str, false, 0);
                                        }
                                        str = sb.toString();
                                        AppProtectManager.pro5109("", str, false, 0);
                                    }
                                    return;
                                }
                            }
                        }
                        return;
                    }
                    if (AppProtectManager.pro5205 > 0) {
                        long currentTimeMillis = System.currentTimeMillis();
                        if (currentTimeMillis - AppProtectManager.pro5232 > 1000) {
                            AppProtectManager.pro5232 = currentTimeMillis;
                            AppProtectManager.pro5231.set(0);
                        }
                        if (AppProtectManager.pro5231.incrementAndGet() > AppProtectManager.pro5205) {
                            z2 = false;
                            if (z2) {
                                pro5109(accept);
                            } else {
                                accept.configureBlocking(false);
                                final pro5130 pro5130Var = this.pro5143.containsKey(accept) ? this.pro5143.get(accept) : null;
                                if (pro5130Var == null) {
                                    SocketChannel open = SocketChannel.open();
                                    open.configureBlocking(false);
                                    pro5130 pro5130Var2 = new pro5130(accept, open, this);
                                    this.pro5143.put(accept, pro5130Var2);
                                    socketChannel = open;
                                    pro5130Var = pro5130Var2;
                                } else {
                                    socketChannel = pro5130Var.pro5130;
                                }
                                pro5130Var.pro5135 = null;
                                final int pro5130 = pro5130();
                                if (pro5130 >= 2 && new Random().nextInt(5) < 3) {
                                    pro5130 = pro5130();
                                }
                                if (socketChannel.connect(new InetSocketAddress(pro5109(pro5130), pro5130(pro5130)))) {
                                    pro5109(pro5130Var);
                                } else {
                                    pro5109(socketChannel, 8, pro5130Var);
                                }
                                if (!pro5130(this.pro5135) || !pro5130(this.pro5139)) {
                                    CompletableFuture<Void> completableFuture = pro5130Var.pro5134;
                                    if (completableFuture != null) {
                                        completableFuture.cancel(true);
                                    }
                                    pro5130Var.pro5134 = CompletableFuture.supplyAsync(new Supplier() {
                                        @Override
                                        public final Object get() {
                                            Object pro51093;
                                            pro51093 = pro5136.this.pro5109(pro5130, pro5130Var);
                                            return pro51093;
                                        }
                                    }).thenRun((Runnable) new Runnable() {
                                        @Override
                                        public final void run() {
                                            pro5136.pro5132();
                                        }
                                    }).thenRun(new Runnable() {
                                        @Override
                                        public final void run() {
                                            pro5136.this.pro5130(pro5130, pro5130Var);
                                        }
                                    });
                                }
                            }
                        }
                    }
                    z2 = true;
                    if (z2) {
                    }
                }
            }
            z = false;
            if (!z) {
            }
        }
    }

    public final void pro5109(SelectionKey selectionKey, SocketChannel socketChannel) {
        selectionKey.cancel();
        pro5130 pro5130Var = (pro5130) selectionKey.attachment();
        if (pro5130Var == null) {
            pro5109(socketChannel);
            return;
        }
        SocketChannel socketChannel2 = pro5130Var.pro5109;
        SocketChannel socketChannel3 = pro5130Var.pro5130;
        if (socketChannel2 == null || socketChannel3 == null) {
            pro5109(socketChannel);
            return;
        }
        TlsChannel tlsChannel = pro5130Var.pro5131;
        pro5109(socketChannel2);
        pro5109(socketChannel3);
        pro5109(tlsChannel);
        if (this.pro5143.containsKey(socketChannel2)) {
            AppProtectManager.pro5243.addAndGet(160L);
        }
        this.pro5143.remove(socketChannel2);
        if (pro5109() == 0) {
            if (AppProtectManager.pro5109(this.pro5153) == 0) {
                AppProtectManager.pro5157();
            }
            if (this.pro5152) {
                return;
            }
            pro5131();
        }
    }

    public final void pro5109(String str) {
        if (AppProtectManager.pro5136(str)) {
            return;
        }
        int i = 0;
        while (true) {
            String[] strArr = AppProtectManager.pro5175;
            if (i >= strArr.length) {
                return;
            }
            if (str.equals(strArr[i])) {
                AppProtectManager.pro5176[i] = 200;
                return;
            }
            i++;
        }
    }

    public void pro5109(Selector selector) throws Exception {
        pro5131(0);
        this.pro5148.set(0);
        this.pro5150.set(0);
        this.pro5149.set(System.currentTimeMillis());
        this.pro5144 = selector;
        ServerSocketChannel open = ServerSocketChannel.open();
        this.pro5145 = open;
        open.socket().bind(new InetSocketAddress(this.pro5109, this.pro5130));
        this.pro5145.configureBlocking(false);
        this.pro5145.register(this.pro5144, 16, this);
        this.pro5157 = new Random().nextInt(10);
    }
}