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

应用版本信息
应用名称:Ghostify
版本号:4.0
包名称:com.getghostify

MD5 校验值:a9a821418db4ad35214aeeb08c2f5902

反编译源代码说明

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


package n7;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.Socket;
import java.security.AccessController;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivilegedActionException;
import java.security.Provider;
import java.security.Security;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;

public class g {

    public static final Logger f7755b = Logger.getLogger(g.class.getName());

    public static final String[] f7756c = {"com.google.android.gms.org.conscrypt.OpenSSLProvider", "org.conscrypt.OpenSSLProvider", "com.android.org.conscrypt.OpenSSLProvider", "org.apache.harmony.xnet.provider.jsse.OpenSSLProvider", "com.google.android.libraries.stitch.sslguard.SslGuardProvider"};

    public static final g f7757d;

    public final Provider f7758a;

    public static class a extends g {

        public final d1.d f7759e;

        public final d1.d f7760f;

        public final d1.d f7761g;

        public final d1.d f7762h;

        public final int f7763i;

        public a(d1.d dVar, d1.d dVar2, Method method, Method method2, d1.d dVar3, d1.d dVar4, Provider provider, int i9) {
            super(provider);
            this.f7759e = dVar;
            this.f7760f = dVar2;
            this.f7761g = dVar3;
            this.f7762h = dVar4;
            this.f7763i = i9;
        }

        @Override
        public void c(SSLSocket sSLSocket, String str, List<h> list) {
            if (str != null) {
                this.f7759e.j(sSLSocket, Boolean.TRUE);
                this.f7760f.j(sSLSocket, str);
            }
            d1.d dVar = this.f7762h;
            Objects.requireNonNull(dVar);
            if (dVar.e(sSLSocket.getClass()) != null) {
                this.f7762h.k(sSLSocket, g.b(list));
            }
        }

        @Override
        public String d(SSLSocket sSLSocket) {
            byte[] bArr;
            d1.d dVar = this.f7761g;
            Objects.requireNonNull(dVar);
            if ((dVar.e(sSLSocket.getClass()) != null) && (bArr = (byte[]) this.f7761g.k(sSLSocket, new Object[0])) != null) {
                return new String(bArr, i.f7781b);
            }
            return null;
        }

        @Override
        public int e() {
            return this.f7763i;
        }
    }

    public static class b extends g {

        public final Method f7764e;

        public final Method f7765f;

        public b(Provider provider, Method method, Method method2, n7.d dVar) {
            super(provider);
            this.f7764e = method;
            this.f7765f = method2;
        }

        @Override
        public void c(SSLSocket sSLSocket, String str, List<h> list) {
            SSLParameters sSLParameters = sSLSocket.getSSLParameters();
            ArrayList arrayList = new ArrayList(list.size());
            for (h hVar : list) {
                if (hVar != h.HTTP_1_0) {
                    arrayList.add(hVar.f7779k);
                }
            }
            try {
                this.f7764e.invoke(sSLParameters, arrayList.toArray(new String[arrayList.size()]));
                sSLSocket.setSSLParameters(sSLParameters);
            } catch (IllegalAccessException e9) {
                throw new RuntimeException(e9);
            } catch (InvocationTargetException e10) {
                throw new RuntimeException(e10);
            }
        }

        @Override
        public String d(SSLSocket sSLSocket) {
            try {
                return (String) this.f7765f.invoke(sSLSocket, new Object[0]);
            } catch (IllegalAccessException e9) {
                throw new RuntimeException(e9);
            } catch (InvocationTargetException e10) {
                throw new RuntimeException(e10);
            }
        }

        @Override
        public int e() {
            return 1;
        }
    }

    public static class c extends g {

        public final Method f7766e;

        public final Method f7767f;

        public final Method f7768g;

        public final Class<?> f7769h;

        public final Class<?> f7770i;

        public c(Method method, Method method2, Method method3, Class<?> cls, Class<?> cls2, Provider provider) {
            super(provider);
            this.f7766e = method;
            this.f7767f = method2;
            this.f7768g = method3;
            this.f7769h = cls;
            this.f7770i = cls2;
        }

        @Override
        public void a(SSLSocket sSLSocket) {
            try {
                this.f7768g.invoke(null, sSLSocket);
            } catch (IllegalAccessException unused) {
                throw new AssertionError();
            } catch (InvocationTargetException e9) {
                g.f7755b.log(Level.FINE, "Failed to remove SSLSocket from Jetty ALPN", (Throwable) e9);
            }
        }

        @Override
        public void c(SSLSocket sSLSocket, String str, List<h> list) {
            ArrayList arrayList = new ArrayList(list.size());
            int size = list.size();
            for (int i9 = 0; i9 < size; i9++) {
                h hVar = list.get(i9);
                if (hVar != h.HTTP_1_0) {
                    arrayList.add(hVar.f7779k);
                }
            }
            try {
                this.f7766e.invoke(null, sSLSocket, Proxy.newProxyInstance(g.class.getClassLoader(), new Class[]{this.f7769h, this.f7770i}, new d(arrayList)));
            } catch (IllegalAccessException e9) {
                throw new AssertionError(e9);
            } catch (InvocationTargetException e10) {
                throw new AssertionError(e10);
            }
        }

        @Override
        public String d(SSLSocket sSLSocket) {
            try {
                d dVar = (d) Proxy.getInvocationHandler(this.f7767f.invoke(null, sSLSocket));
                boolean z8 = dVar.f7772b;
                if (!z8 && dVar.f7773c == null) {
                    g.f7755b.log(Level.INFO, "ALPN callback dropped: SPDY and HTTP/2 are disabled. Is alpn-boot on the boot class path?");
                    return null;
                }
                if (z8) {
                    return null;
                }
                return dVar.f7773c;
            } catch (IllegalAccessException unused) {
                throw new AssertionError();
            } catch (InvocationTargetException unused2) {
                throw new AssertionError();
            }
        }

        @Override
        public int e() {
            return 1;
        }
    }

    public static class d implements InvocationHandler {

        public final List<String> f7771a;

        public boolean f7772b;

        public String f7773c;

        public d(List<String> list) {
            this.f7771a = list;
        }

        @Override
        public Object invoke(Object obj, Method method, Object[] objArr) {
            Object obj2;
            String name = method.getName();
            Class<?> returnType = method.getReturnType();
            if (objArr == null) {
                objArr = i.f7780a;
            }
            if (name.equals("supports") && Boolean.TYPE == returnType) {
                return Boolean.TRUE;
            }
            if (name.equals("unsupported") && Void.TYPE == returnType) {
                this.f7772b = true;
                return null;
            }
            if (name.equals("protocols") && objArr.length == 0) {
                return this.f7771a;
            }
            if ((!name.equals("selectProtocol") && !name.equals("select")) || String.class != returnType || objArr.length != 1 || !(objArr[0] instanceof List)) {
                if ((!name.equals("protocolSelected") && !name.equals("selected")) || objArr.length != 1) {
                    return method.invoke(this, objArr);
                }
                this.f7773c = (String) objArr[0];
                return null;
            }
            List list = (List) objArr[0];
            int size = list.size();
            int i9 = 0;
            while (true) {
                if (i9 >= size) {
                    obj2 = this.f7771a.get(0);
                    break;
                }
                if (this.f7771a.contains(list.get(i9))) {
                    obj2 = list.get(i9);
                    break;
                }
                i9++;
            }
            String str = (String) obj2;
            this.f7773c = str;
            return str;
        }
    }

    static {
        Method method;
        Provider provider;
        g gVar;
        g gVar2;
        Method method2;
        Method method3;
        int i9;
        boolean z8;
        Provider[] providers = Security.getProviders();
        int length = providers.length;
        boolean z9 = false;
        int i10 = 0;
        loop0: while (true) {
            method = null;
            if (i10 >= length) {
                f7755b.log(Level.WARNING, "Unable to find Conscrypt");
                provider = null;
                break;
            }
            Provider provider2 = providers[i10];
            for (String str : f7756c) {
                if (str.equals(provider2.getClass().getName())) {
                    f7755b.log(Level.FINE, "Found registered provider {0}", str);
                    provider = provider2;
                    break loop0;
                }
            }
            i10++;
        }
        if (provider != null) {
            d1.d dVar = new d1.d(null, "setUseSessionTickets", new Class[]{Boolean.TYPE});
            d1.d dVar2 = new d1.d(null, "setHostname", new Class[]{String.class});
            d1.d dVar3 = new d1.d(byte[].class, "getAlpnSelectedProtocol", new Class[0]);
            d1.d dVar4 = new d1.d(null, "setAlpnProtocols", new Class[]{byte[].class});
            try {
                Class<?> cls = Class.forName("android.net.TrafficStats");
                Method method4 = cls.getMethod("tagSocket", Socket.class);
                try {
                    method = cls.getMethod("untagSocket", Socket.class);
                } catch (ClassNotFoundException | NoSuchMethodException unused) {
                }
                method2 = method4;
                method3 = method;
            } catch (ClassNotFoundException | NoSuchMethodException unused2) {
                method2 = null;
                method3 = null;
            }
            if (!provider.getName().equals("GmsCore_OpenSSL") && !provider.getName().equals("Conscrypt") && !provider.getName().equals("Ssl_Guard")) {
                try {
                    g.class.getClassLoader().loadClass("android.net.Network");
                    z8 = true;
                } catch (ClassNotFoundException e9) {
                    f7755b.log(Level.FINE, "Can't find class", (Throwable) e9);
                    z8 = false;
                }
                if (!z8) {
                    try {
                        g.class.getClassLoader().loadClass("android.app.ActivityOptions");
                        z9 = true;
                    } catch (ClassNotFoundException e10) {
                        f7755b.log(Level.FINE, "Can't find class", (Throwable) e10);
                    }
                    i9 = z9 ? 2 : 3;
                    gVar2 = new a(dVar, dVar2, method2, method3, dVar3, dVar4, provider, i9);
                }
            }
            i9 = 1;
            gVar2 = new a(dVar, dVar2, method2, method3, dVar3, dVar4, provider, i9);
        } else {
            try {
                Provider provider3 = SSLContext.getDefault().getProvider();
                try {
                    SSLContext sSLContext = SSLContext.getInstance("TLS", provider3);
                    sSLContext.init(null, null, null);
                    ((Method) AccessController.doPrivileged(new n7.d())).invoke(sSLContext.createSSLEngine(), new Object[0]);
                    gVar2 = new b(provider3, (Method) AccessController.doPrivileged(new e()), (Method) AccessController.doPrivileged(new f()), null);
                } catch (IllegalAccessException | InvocationTargetException | KeyManagementException | NoSuchAlgorithmException | PrivilegedActionException unused3) {
                    try {
                        Class<?> cls2 = Class.forName("org.eclipse.jetty.alpn.ALPN");
                        gVar = new c(cls2.getMethod("put", SSLSocket.class, Class.forName("org.eclipse.jetty.alpn.ALPN$Provider")), cls2.getMethod("get", SSLSocket.class), cls2.getMethod("remove", SSLSocket.class), Class.forName("org.eclipse.jetty.alpn.ALPN$ClientProvider"), Class.forName("org.eclipse.jetty.alpn.ALPN$ServerProvider"), provider3);
                    } catch (ClassNotFoundException | NoSuchMethodException unused4) {
                        gVar = new g(provider3);
                    }
                    gVar2 = gVar;
                }
            } catch (NoSuchAlgorithmException e11) {
                throw new RuntimeException(e11);
            }
        }
        f7757d = gVar2;
    }

    public g(Provider provider) {
        this.f7758a = provider;
    }

    public static byte[] b(List<h> list) {
        o8.d dVar = new o8.d();
        int size = list.size();
        for (int i9 = 0; i9 < size; i9++) {
            h hVar = list.get(i9);
            if (hVar != h.HTTP_1_0) {
                dVar.z0(hVar.f7779k.length());
                dVar.D0(hVar.f7779k);
            }
        }
        return dVar.a0();
    }

    public void a(SSLSocket sSLSocket) {
    }

    public void c(SSLSocket sSLSocket, String str, List<h> list) {
    }

    public String d(SSLSocket sSLSocket) {
        return null;
    }

    public int e() {
        return 3;
    }
}