翰林优商.apk(点击下载) / g.java


package com.mobile.auth.d;

import android.content.Context;
import android.text.TextUtils;
import com.kwai.video.player.KsMediaMeta;
import com.mobile.auth.b.a;
import com.mobile.auth.b.c;
import com.mobile.auth.b.d;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.regex.Pattern;

public final class g {
    private static final Pattern a = Pattern.compile("^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$");

    public static String a() {
        String hostAddress;
        try {
            StringBuffer stringBuffer = new StringBuffer();
            try {
                Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
                while (networkInterfaces.hasMoreElements()) {
                    NetworkInterface nextElement = networkInterfaces.nextElement();
                    String name = nextElement.getName();
                    if (name == null || (!name.contains("wlan") && !name.equals("eth0"))) {
                        Enumeration<InetAddress> inetAddresses = nextElement.getInetAddresses();
                        while (inetAddresses.hasMoreElements()) {
                            InetAddress nextElement2 = inetAddresses.nextElement();
                            if (!nextElement2.isLoopbackAddress() && !nextElement2.isLinkLocalAddress() && (hostAddress = nextElement2.getHostAddress()) != null && a.matcher(hostAddress).matches()) {
                                if (stringBuffer.length() > 0) {
                                    stringBuffer.append(",");
                                }
                                stringBuffer.append(hostAddress);
                            }
                        }
                    }
                }
            } catch (Throwable th) {
                th.printStackTrace();
            }
            return stringBuffer.toString();
        } catch (Throwable th2) {
            ExceptionProcessor.processException(th2);
            return null;
        }
    }

    public static String a(Context context, String str, String str2, String str3, String str4) {
        try {
            HashMap hashMap = new HashMap();
            hashMap.put("pipl", a());
            hashMap.put("timeStamp", Long.toString(System.currentTimeMillis()));
            hashMap.put("rl", "00000");
            hashMap.put("bussinessType", str3);
            hashMap.put("sdkversion", "SDK-JJ-v3.7.3");
            hashMap.put("networkType", f.f(context));
            hashMap.put("onlineType", f.g(context));
            hashMap.put("aip", context.getPackageName());
            return a(str, str2, hashMap, str4);
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    private static String a(String str, String str2, Map<String, String> map, String str3) {
        try {
            String a2 = d.a(str3, d.a());
            String a3 = a.a(a(map, "&"), str3);
            HashMap hashMap = new HashMap();
            hashMap.put("appId", str);
            hashMap.put("clientType", "30020");
            hashMap.put(KsMediaMeta.KSM_KEY_FORMAT, "json");
            hashMap.put("paramKey", a2);
            hashMap.put("paramStr", a3);
            hashMap.put("version", "3.0");
            hashMap.put("sign", b(hashMap, str2));
            return a(hashMap, "&");
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    private static String a(Map<String, String> map, String str) {
        try {
            StringBuilder sb = new StringBuilder();
            if (map != null && !map.isEmpty()) {
                if (TextUtils.isEmpty(str)) {
                    str = "&";
                }
                for (Map.Entry<String, String> entry : map.entrySet()) {
                    sb.append(entry.getKey());
                    sb.append("=");
                    sb.append(entry.getValue());
                    sb.append(str);
                }
                sb = sb.deleteCharAt(sb.length() - 1);
            }
            return sb.toString();
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    private static String b(Map<String, String> map, String str) {
        try {
            ArrayList arrayList = new ArrayList(map.entrySet());
            Collections.sort(arrayList, new Comparator<Map.Entry<String, String>>() {
                /* class com.mobile.auth.d.g.AnonymousClass1 */

                public final int a(Map.Entry<String, String> entry, Map.Entry<String, String> entry2) {
                    try {
                        return entry.getKey().compareTo(entry2.getKey());
                    } catch (Throwable th) {
                        ExceptionProcessor.processException(th);
                        return -1;
                    }
                }

                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
                @Override // java.util.Comparator
                public final /* synthetic */ int compare(Map.Entry<String, String> entry, Map.Entry<String, String> entry2) {
                    try {
                        return a(entry, entry2);
                    } catch (Throwable th) {
                        ExceptionProcessor.processException(th);
                        return -1;
                    }
                }
            });
            String str2 = "";
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                str2 = str2 + ((String) ((Map.Entry) it.next()).getValue());
            }
            return c.b(c.a(str2, str));
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }
}