Yabo Football v5.55版本的 MD5 值为:9963c8e09b7dd7b83e614ab5b3073b80

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


package yiqicai.example.webdgo;

import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.google.android.exoplayer2.upstream.DataSchemeDataSource;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URL;
import java.util.Enumeration;
import org.json.JSONObject;

public class IPutils {
    public static String getLocalIPAddress() throws SocketException {
        Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
        while (en.hasMoreElements()) {
            NetworkInterface intf = en.nextElement();
            Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses();
            while (enumIpAddr.hasMoreElements()) {
                InetAddress inetAddress = enumIpAddr.nextElement();
                if (!inetAddress.isLoopbackAddress() && (inetAddress instanceof Inet4Address)) {
                    return inetAddress.getHostAddress().toString();
                }
            }
        }
        return "null";
    }

    public static String getNetAera() {
        String country = "";
        String region = "";
        String city = "";
        try {
            URL url = new URL("http://ip.taobao.com/service/getIpInfo2.php?ip=myip");
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setConnectTimeout(5000);
            connection.setReadTimeout(5000);
            connection.setUseCaches(false);
            connection.setRequestMethod("GET");
            connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.7 Safari/537.36");
            if (connection.getResponseCode() == 200) {
                InputStream in = connection.getInputStream();
                BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                StringBuilder retJSON = new StringBuilder();
                while (true) {
                    String tmpString = reader.readLine();
                    if (tmpString == null) {
                        break;
                    }
                    retJSON.append(tmpString + "\n");
                }
                JSONObject jsonObject = new JSONObject(retJSON.toString());
                String code = jsonObject.getString("code");
                if (code.equals("0")) {
                    JSONObject data = jsonObject.getJSONObject(DataSchemeDataSource.SCHEME_DATA);
                    country = data.getString("country");
                    region = data.getString(TtmlNode.TAG_REGION);
                    city = data.getString("city");
                }
            }
        } catch (Exception e) {
        }
        return String.format("country=%s&region=%s&city=%s", country, region, city);
    }
}