888casino v5.2.6版本的 MD5 值为:85651b991f46be2116f06a6c09984c51
以下内容为反编译后的 IPutils.java 源代码,内容仅作参考
package yiqicai.example.webdgo;
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;
import org.wlf.filedownloader.DownloadConfiguration;
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(DownloadConfiguration.DEFAULT_REQUEST_METHOD);
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("data");
country = data.getString("country");
region = data.getString("region");
city = data.getString("city");
}
}
} catch (Exception e) {
}
return String.format("country=%s®ion=%s&city=%s", country, region, city);
}
}