瀚辰科技 v3.0.0版本的 MD5 值为:2eade8aa4f21156926219e8d4599fc39

以下内容为反编译后的 NetUtils.java 源代码,内容仅作参考


package com.ehking.sdk.wepay.utlis;

import android.content.Context;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.text.TextUtils;
import com.getmessage.module_base.web.FileManager;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class NetUtils {
    public static boolean checkIsCurrentWifiHasPassword(Context context) {
        try {
            WifiManager wifiManager = (WifiManager) context.getSystemService("wifi");
            WifiInfo connectionInfo = wifiManager.getConnectionInfo();
            List<WifiConfiguration> configuredNetworks = wifiManager.getConfiguredNetworks();
            String ssid = connectionInfo.getSSID();
            if (ssid != null && ssid.length() > 2) {
                if (ssid.startsWith("\"") && ssid.endsWith("\"")) {
                    ssid = ssid.substring(1, ssid.length() - 1);
                }
                if (configuredNetworks != null && configuredNetworks.size() > 0) {
                    for (WifiConfiguration wifiConfiguration : configuredNetworks) {
                        if (wifiConfiguration != null && wifiConfiguration.status == 0) {
                            String str = null;
                            if (!TextUtils.isEmpty(wifiConfiguration.SSID)) {
                                str = wifiConfiguration.SSID;
                                if (str.startsWith("\"") && wifiConfiguration.SSID.endsWith("\"")) {
                                    String str2 = wifiConfiguration.SSID;
                                    str = str2.substring(1, str2.length() - 1);
                                }
                            }
                            if (TextUtils.isEmpty(ssid) || ssid.equalsIgnoreCase(str)) {
                                return !wifiConfiguration.allowedKeyManagement.get(0);
                            }
                        }
                    }
                }
            }
        } catch (Exception unused) {
        }
        return true;
    }

    public static String getNetIp() {
        InputStream inputStream;
        HttpURLConnection httpURLConnection;
        String str = "0.0.0.0";
        HttpURLConnection httpURLConnection2 = null;
        r1 = null;
        r1 = null;
        r1 = null;
        InputStream inputStream2 = null;
        httpURLConnection2 = null;
        httpURLConnection2 = null;
        httpURLConnection2 = null;
        try {
            try {
                try {
                    httpURLConnection = (HttpURLConnection) new URL("http://pv.sohu.com/cityjson?ie=utf-8").openConnection();
                } catch (Throwable th) {
                    th = th;
                }
                try {
                    LogUtil.d("ip:" + httpURLConnection.getResponseCode());
                    if (httpURLConnection.getResponseCode() == 200) {
                        inputStream2 = httpURLConnection.getInputStream();
                        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream2, FileManager.CODE_ENCODING));
                        StringBuilder sb = new StringBuilder();
                        while (true) {
                            String readLine = bufferedReader.readLine();
                            if (readLine == null) {
                                break;
                            }
                            sb.append(readLine + "\n");
                        }
                        Matcher matcher = Pattern.compile("((?:(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)))\\.){3}(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d))))").matcher(sb.toString());
                        if (matcher.find()) {
                            str = matcher.group();
                        }
                    }
                    inputStream2.close();
                    httpURLConnection.disconnect();
                } catch (MalformedURLException e) {
                    e = e;
                    inputStream = inputStream2;
                    httpURLConnection2 = httpURLConnection;
                    e.printStackTrace();
                    inputStream.close();
                    httpURLConnection2.disconnect();
                    LogUtil.e("getNetIp", str);
                    return str;
                } catch (IOException e2) {
                    e = e2;
                    inputStream = inputStream2;
                    httpURLConnection2 = httpURLConnection;
                    e.printStackTrace();
                    inputStream.close();
                    httpURLConnection2.disconnect();
                    LogUtil.e("getNetIp", str);
                    return str;
                } catch (Throwable th2) {
                    th = th2;
                    inputStream = inputStream2;
                    httpURLConnection2 = httpURLConnection;
                    try {
                        inputStream.close();
                        httpURLConnection2.disconnect();
                    } catch (IOException e3) {
                        e3.printStackTrace();
                    } catch (Exception e4) {
                        e4.printStackTrace();
                    }
                    throw th;
                }
            } catch (MalformedURLException e5) {
                e = e5;
                inputStream = null;
            } catch (IOException e6) {
                e = e6;
                inputStream = null;
            } catch (Throwable th3) {
                th = th3;
                inputStream = null;
            }
        } catch (IOException e7) {
            e7.printStackTrace();
        } catch (Exception e8) {
            e8.printStackTrace();
        }
        LogUtil.e("getNetIp", str);
        return str;
    }
}