灵犀直播 v1.0.127版本的 MD5 值为:a63989b077d9456fb57c6835ee2849a1
以下内容为反编译后的 d0.java 源代码,内容仅作参考
package c.i.a.y;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import androidx.recyclerview.widget.RecyclerView;
import com.taobao.accs.utl.UtilityImpl;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
import java.net.Socket;
import java.util.Enumeration;
public class d0 {
public static final String[] f2506a = {"180.76.76.76:80", "119.29.29.29:80", "182.254.116.116:80", "8.8.8.8:53"};
public class a extends c.l.a.a.c<Void> {
public final String[] q;
public final b r;
public a(String[] strArr, b bVar) {
this.q = strArr;
this.r = bVar;
}
@Override
public Void v() {
b bVar;
int i = 0;
while (true) {
String[] strArr = this.q;
if (i >= strArr.length) {
return null;
}
String[] split = strArr[i].split(":");
try {
new Socket().connect(new InetSocketAddress(split[0], Integer.parseInt(split[1])), RecyclerView.MAX_SCROLL_DURATION);
b bVar2 = this.r;
if (bVar2 == null) {
break;
}
bVar2.onNetworkSuccess();
break;
} catch (Throwable unused) {
if (i >= this.q.length - 1 && (bVar = this.r) != null) {
bVar.onNetworkError();
}
i++;
}
}
return null;
}
}
public interface b {
void onNetworkError();
void onNetworkSuccess();
}
public static String a(String str) {
return o0.d(str) ? "" : str.replace(":", "").toUpperCase();
}
public static String b() {
String str = null;
try {
NetworkInterface byName = NetworkInterface.getByName("eth0");
if (byName != null) {
str = o0.b(byName.getHardwareAddress(), ":");
}
} catch (Throwable th) {
th.printStackTrace();
}
if (o0.d(str) || "02:00:00:00:00:00".equals(str)) {
try {
str = new LineNumberReader(new InputStreamReader(Runtime.getRuntime().exec("cat /sys/class/net/eth0/address").getInputStream())).readLine();
} catch (Throwable th2) {
th2.printStackTrace();
}
}
return a(str);
}
public static String c() {
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress nextElement = inetAddresses.nextElement();
if (!nextElement.isLoopbackAddress() && !nextElement.isLinkLocalAddress() && (nextElement instanceof Inet4Address)) {
return nextElement.getHostAddress();
}
}
}
} catch (Throwable th) {
th.printStackTrace();
}
return o0.c(null);
}
public static String d(Context context) {
String e2;
int i = Build.VERSION.SDK_INT;
if (i < 23) {
e2 = f(context);
} else if (i == 23) {
e2 = g();
} else {
e2 = e();
}
return a(e2);
}
public static String e() {
try {
NetworkInterface byName = NetworkInterface.getByName("wlan0");
if (byName != null) {
return o0.b(byName.getHardwareAddress(), ":");
}
return null;
} catch (Throwable th) {
th.printStackTrace();
return null;
}
}
public static String f(Context context) {
String str = null;
try {
WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(UtilityImpl.NET_TYPE_WIFI);
if (wifiManager != null) {
str = wifiManager.getConnectionInfo().getMacAddress();
}
} catch (Throwable th) {
th.printStackTrace();
}
return (o0.d(str) || "02:00:00:00:00:00".equals(str)) ? g() : str;
}
public static String g() {
String str;
try {
str = new LineNumberReader(new InputStreamReader(Runtime.getRuntime().exec("cat /sys/class/net/wlan0/address").getInputStream())).readLine();
} catch (Throwable th) {
th.printStackTrace();
str = null;
}
return (o0.d(str) || "02:00:00:00:00:00".equals(str)) ? e() : str;
}
public static boolean h(Context context) {
NetworkInfo activeNetworkInfo;
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService("connectivity");
if (connectivityManager == null || (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) == null) {
return false;
}
return activeNetworkInfo.isConnected();
} catch (Throwable th) {
th.printStackTrace();
return false;
}
}
public static void i(String[] strArr, b bVar) {
if (strArr != null && strArr.length != 0) {
new a(strArr, bVar).g(new Void[0]);
} else {
bVar.onNetworkSuccess();
}
}
}