Sunbit v2.4.4版本的 MD5 值为:a5021e5e2a58eb1d6741b432fe7533c4
以下内容为反编译后的 b.java 源代码,内容仅作参考
package d.b.f.q;
import androidx.core.os.EnvironmentCompat;
import d.b.f.j.e;
import d.b.f.m.h;
import d.b.f.n.y;
import d.b.f.u.s;
import d.b.f.u.x;
import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;
import java.net.IDN;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
import java.net.Socket;
import java.net.SocketException;
import java.net.URL;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.LinkedHashSet;
import java.util.TreeSet;
import javax.net.ServerSocketFactory;
import k.r1;
import o.l0.q.g;
import q.j.f;
public class b {
public static final String f9623a = "127.0.0.1";
public static final int b = 1024;
public static final int c = 65535;
public static int a(int i2) {
return a(i2, 65535);
}
private static boolean a(long j2, long j3, long j4) {
return j2 >= j3 && j2 <= j4;
}
public static String b(long j2) {
return String.valueOf(j2 >>> 24) + x.f9735r + String.valueOf((16777215 & j2) >>> 16) + x.f9735r + String.valueOf((g.f21737s & j2) >>> 8) + x.f9735r + String.valueOf(j2 & 255);
}
public static String c(String str) {
StringBuffer stringBuffer = new StringBuffer(str.length());
stringBuffer.append(str.substring(0, str.lastIndexOf(x.f9735r) + 1));
stringBuffer.append(f.W0);
return stringBuffer.toString();
}
public static boolean c(int i2) {
return i2 >= 0 && i2 <= 65535;
}
public static Collection<NetworkInterface> d() {
try {
return d.b.f.f.c.a((Collection) new ArrayList(), (Enumeration) NetworkInterface.getNetworkInterfaces());
} catch (SocketException unused) {
return null;
}
}
public static long e(String str) {
if (y.h(str)) {
int indexOf = str.indexOf(x.f9735r);
int i2 = indexOf + 1;
int indexOf2 = str.indexOf(x.f9735r, i2);
int i3 = indexOf2 + 1;
int indexOf3 = str.indexOf(x.f9735r, i3);
long[] jArr = {Long.parseLong(str.substring(0, indexOf)), Long.parseLong(str.substring(i2, indexOf2)), Long.parseLong(str.substring(i3, indexOf3)), Long.parseLong(str.substring(indexOf3 + 1))};
return (jArr[0] << 24) + (jArr[1] << 16) + (jArr[2] << 8) + jArr[3];
}
return 0L;
}
public static boolean f(String str) {
long e2 = e(str);
return a(e2, e("10.0.0.0"), e("10.255.255.255")) || a(e2, e("172.16.0.0"), e("172.31.255.255")) || a(e2, e("192.168.0.0"), e("192.168.255.255")) || str.equals(f9623a);
}
@Deprecated
public static LinkedHashSet<String> g() {
return f();
}
public static int a(int i2, int i3) {
for (int i4 = i2; i4 <= i3; i4++) {
if (b(s.b(i2, i3 + 1))) {
return i4;
}
}
throw new e("Could not find an available port in the range [{}, {}] after {} attempts", Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i3 - i2));
}
public static String c() {
InetAddress b2 = b();
if (b2 != null) {
return b2.getHostAddress();
}
return null;
}
public static boolean g(String str) {
return x.i(str) || EnvironmentCompat.MEDIA_UNKNOWN.equalsIgnoreCase(str);
}
public static String d(String str) {
return IDN.toASCII(str);
}
public static TreeSet<Integer> a(int i2, int i3, int i4) {
TreeSet<Integer> treeSet = new TreeSet<>();
int i5 = 0;
while (true) {
i5++;
if (i5 > i2 + 100 || treeSet.size() >= i2) {
break;
}
treeSet.add(Integer.valueOf(a(i3, i4)));
}
if (treeSet.size() == i2) {
return treeSet;
}
throw new e("Could not find {} available ports in the range [{}, {}]", Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4));
}
public static String a(long j2) {
return c(b(j2));
}
public static LinkedHashSet<String> f() {
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
if (networkInterfaces != null) {
LinkedHashSet<String> linkedHashSet = new LinkedHashSet<>();
while (networkInterfaces.hasMoreElements()) {
Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress nextElement = inetAddresses.nextElement();
if (nextElement != null && (nextElement instanceof Inet4Address)) {
linkedHashSet.add(nextElement.getHostAddress());
}
}
}
return linkedHashSet;
}
throw new e("Get network interface error!");
} catch (SocketException e2) {
throw new e(e2);
}
}
public static InetSocketAddress a(String str, int i2) {
if (x.i(str)) {
str = f9623a;
}
int indexOf = str.indexOf(x.H);
if (indexOf != -1) {
String substring = str.substring(0, indexOf);
i2 = Integer.parseInt(str.substring(indexOf + 1));
str = substring;
}
return new InetSocketAddress(str, i2);
}
public static boolean b(int i2) {
if (c(i2)) {
try {
ServerSocketFactory.getDefault().createServerSocket(i2, 1, InetAddress.getByName(f9623a)).close();
return true;
} catch (Exception unused) {
return false;
}
}
return false;
}
public static int e() {
return a(1024);
}
public static String b(String str, String str2) {
try {
return new URL(new URL(str), str2).toString();
} catch (Exception e2) {
throw new e(e2, "To absolute url [{}] base [{}] error!", str2, str);
}
}
public static String a(String str) {
try {
return InetAddress.getByName(str).getHostAddress();
} catch (UnknownHostException unused) {
return str;
}
}
public static InetAddress b() {
InetAddress inetAddress = null;
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()) {
if (nextElement.isSiteLocalAddress()) {
return nextElement;
}
if (inetAddress == null) {
inetAddress = nextElement;
}
}
}
}
} catch (SocketException unused) {
}
if (inetAddress == null) {
try {
return InetAddress.getLocalHost();
} catch (UnknownHostException unused2) {
return inetAddress;
}
}
return inetAddress;
}
public static String a() {
return a(b());
}
public static String a(InetAddress inetAddress) {
return a(inetAddress, x.B);
}
public static String a(InetAddress inetAddress, String str) {
if (inetAddress == null) {
return null;
}
try {
byte[] hardwareAddress = NetworkInterface.getByInetAddress(inetAddress).getHardwareAddress();
if (hardwareAddress != null) {
StringBuilder sb = new StringBuilder();
for (int i2 = 0; i2 < hardwareAddress.length; i2++) {
if (i2 != 0) {
sb.append(str);
}
String hexString = Integer.toHexString(hardwareAddress[i2] & r1.f20052d);
if (hexString.length() == 1) {
hexString = 0 + hexString;
}
sb.append(hexString);
}
return sb.toString();
}
return null;
} catch (SocketException e2) {
throw new e(e2);
}
}
public static InetSocketAddress b(String str, int i2) {
if (x.i(str)) {
return new InetSocketAddress(i2);
}
return new InetSocketAddress(str, i2);
}
public static String b(String str) {
String[] split;
if (str == null || str.indexOf(",") <= 0) {
return str;
}
for (String str2 : str.trim().split(",")) {
if (!g(str2)) {
return str2;
}
}
return str;
}
public static void a(String str, int i2, boolean z, ByteBuffer byteBuffer) throws d.b.f.m.g {
try {
SocketChannel open = SocketChannel.open(b(str, i2));
open.configureBlocking(z);
open.write(byteBuffer);
if (open != null) {
open.close();
}
} catch (IOException e2) {
throw new d.b.f.m.g(e2);
}
}
public static void a(String str, int i2, byte[] bArr) throws d.b.f.m.g {
try {
try {
Socket socket = new Socket(str, i2);
try {
OutputStream outputStream = socket.getOutputStream();
outputStream.write(bArr);
outputStream.flush();
socket.close();
h.a((Closeable) outputStream);
} catch (Throwable th) {
try {
throw th;
} catch (Throwable th2) {
try {
socket.close();
} catch (Throwable th3) {
th.addSuppressed(th3);
}
throw th2;
}
}
} catch (IOException e2) {
throw new d.b.f.m.g(e2);
}
} catch (Throwable th4) {
h.a((Closeable) null);
throw th4;
}
}
public static boolean a(String str, String str2) {
String[] g2 = x.g((CharSequence) str, '.');
int parseInt = Integer.parseInt(g2[3]) | (Integer.parseInt(g2[0]) << 24) | (Integer.parseInt(g2[1]) << 16) | (Integer.parseInt(g2[2]) << 8);
int parseInt2 = (-1) << (32 - Integer.parseInt(str2.replaceAll(".*/", "")));
String[] split = str2.replaceAll("/.*", "").split("\\.");
return (parseInt & parseInt2) == ((Integer.parseInt(split[3]) | (((Integer.parseInt(split[0]) << 24) | (Integer.parseInt(split[1]) << 16)) | (Integer.parseInt(split[2]) << 8))) & parseInt2);
}
}