正在查看: 饼干视频 v4.1.0 应用的 C0048.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 饼干视频 v4.1.0 应用的 C0048.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package amc.cd.p004;
import amc.cd.p001.InterfaceC0008;
import amc.cd.p130.AbstractC1691;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.fourthline.cling.transport.spi.InitializationException;
import org.fourthline.cling.transport.spi.NoNetworkException;
public class C0048 implements InterfaceC0008 {
public static Logger f60 = Logger.getLogger(C0048.class.getName());
public final List<InetAddress> f61;
public final Set<String> f62;
public final Set<String> f63;
public int f64;
public final List<NetworkInterface> f65;
public class C0049 extends AbstractC1691<NetworkInterface> {
public C0049(Collection collection) {
super(collection);
}
@Override
public void mo155(int i) {
synchronized (C0048.this.f65) {
C0048.this.f65.remove(i);
}
}
}
public class C0050 extends AbstractC1691<InetAddress> {
public C0050(Collection collection) {
super(collection);
}
@Override
public void mo155(int i) {
synchronized (C0048.this.f61) {
C0048.this.f61.remove(i);
}
}
}
public C0048() throws InitializationException {
this(0);
}
public void m146() throws InitializationException {
try {
synchronized (this.f65) {
Iterator<NetworkInterface> it = this.f65.iterator();
while (it.hasNext()) {
NetworkInterface next = it.next();
f60.finer("Discovering addresses of interface: " + next.getDisplayName());
int i = 0;
for (InetAddress inetAddress : m150(next)) {
if (inetAddress == null) {
f60.warning("Network has a null address: " + next.getDisplayName());
} else if (mo147(next, inetAddress)) {
f60.fine("Discovered usable network interface address: " + inetAddress.getHostAddress());
i++;
synchronized (this.f61) {
this.f61.add(inetAddress);
}
} else {
f60.finer("Ignoring non-usable network interface address: " + inetAddress.getHostAddress());
}
}
if (i == 0) {
f60.finer("Network interface has no usable addresses, removing: " + next.getDisplayName());
it.remove();
}
}
}
} catch (Exception e) {
throw new InitializationException("Could not not analyze local network interfaces: " + e, e);
}
}
@Override
public Iterator<NetworkInterface> mo28() {
return new C0049(this.f65);
}
public boolean mo147(NetworkInterface networkInterface, InetAddress inetAddress) {
if (!(inetAddress instanceof Inet4Address)) {
f60.finer("Skipping unsupported non-IPv4 address: " + inetAddress);
return false;
}
if (inetAddress.isLoopbackAddress()) {
f60.finer("Skipping loopback address: " + inetAddress);
return false;
}
if (this.f63.size() <= 0 || this.f63.contains(inetAddress.getHostAddress())) {
return true;
}
f60.finer("Skipping unwanted address: " + inetAddress);
return false;
}
public void mo148() throws InitializationException {
try {
Iterator it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator();
while (it.hasNext()) {
NetworkInterface networkInterface = (NetworkInterface) it.next();
f60.finer("Analyzing network interface: " + networkInterface.getDisplayName());
if (m154(networkInterface)) {
f60.fine("Discovered usable network interface: " + networkInterface.getDisplayName());
synchronized (this.f65) {
this.f65.add(networkInterface);
}
} else {
f60.finer("Ignoring non-usable network interface: " + networkInterface.getDisplayName());
}
}
} catch (Exception e) {
throw new InitializationException("Could not not analyze local network interfaces: " + e, e);
}
}
public boolean m149(byte[] bArr, byte[] bArr2, short s) {
if (bArr.length != bArr2.length || s / 8 > bArr.length) {
return false;
}
int i = 0;
while (s >= 8 && i < bArr.length) {
if (bArr[i] != bArr2[i]) {
return false;
}
i++;
s = (short) (s - 8);
}
if (i == bArr.length) {
return true;
}
byte b = (byte) (~((1 << (8 - s)) - 1));
return (bArr[i] & b) == (bArr2[i] & b);
}
@Override
public Iterator<InetAddress> mo29() {
return new C0050(this.f61);
}
@Override
public InetAddress mo30() {
try {
return InetAddress.getByName("239.255.255.250");
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
}
public List<InetAddress> m150(NetworkInterface networkInterface) {
return Collections.list(networkInterface.getInetAddresses());
}
@Override
public int mo31() {
return 1900;
}
@Override
public byte[] mo32(InetAddress inetAddress) {
try {
NetworkInterface byInetAddress = NetworkInterface.getByInetAddress(inetAddress);
if (byInetAddress != null) {
return byInetAddress.getHardwareAddress();
}
return null;
} catch (Throwable th) {
f60.log(Level.WARNING, "Cannot get hardware address for: " + inetAddress, th);
return null;
}
}
public boolean mo151() {
return true;
}
@Override
public int mo33() {
return this.f64;
}
@Override
public boolean mo34() {
return this.f65.size() > 0 && this.f61.size() > 0;
}
public InetAddress m152(InetAddress inetAddress) {
synchronized (this.f65) {
Iterator<NetworkInterface> it = this.f65.iterator();
while (it.hasNext()) {
for (InterfaceAddress interfaceAddress : m153(it.next())) {
synchronized (this.f61) {
if (interfaceAddress != null) {
if (this.f61.contains(interfaceAddress.getAddress())) {
if (m149(inetAddress.getAddress(), interfaceAddress.getAddress().getAddress(), interfaceAddress.getNetworkPrefixLength())) {
return interfaceAddress.getAddress();
}
}
}
}
}
}
return null;
}
}
public List<InterfaceAddress> m153(NetworkInterface networkInterface) {
return networkInterface.getInterfaceAddresses();
}
@Override
public InetAddress mo35(NetworkInterface networkInterface, boolean z, InetAddress inetAddress) {
InetAddress m152 = m152(inetAddress);
if (m152 != null) {
return m152;
}
f60.finer("Could not find local bind address in same subnet as: " + inetAddress.getHostAddress());
for (InetAddress inetAddress2 : m150(networkInterface)) {
if (z && (inetAddress2 instanceof Inet6Address)) {
return inetAddress2;
}
if (!z && (inetAddress2 instanceof Inet4Address)) {
return inetAddress2;
}
}
throw new IllegalStateException("Can't find any IPv4 or IPv6 address on interface: " + networkInterface.getDisplayName());
}
public boolean m154(NetworkInterface networkInterface) throws Exception {
if (!networkInterface.isUp()) {
f60.finer("Skipping network interface (down): " + networkInterface.getDisplayName());
return false;
}
if (m150(networkInterface).size() == 0) {
f60.finer("Skipping network interface without bound IP addresses: " + networkInterface.getDisplayName());
return false;
}
String name = networkInterface.getName();
Locale locale = Locale.ROOT;
if (name.toLowerCase(locale).startsWith("vmnet") || (networkInterface.getDisplayName() != null && networkInterface.getDisplayName().toLowerCase(locale).contains("vmnet"))) {
f60.finer("Skipping network interface (VMWare): " + networkInterface.getDisplayName());
return false;
}
if (networkInterface.getName().toLowerCase(locale).startsWith("vnic")) {
f60.finer("Skipping network interface (Parallels): " + networkInterface.getDisplayName());
return false;
}
if (networkInterface.getName().toLowerCase(locale).startsWith("vboxnet")) {
f60.finer("Skipping network interface (Virtual Box): " + networkInterface.getDisplayName());
return false;
}
if (networkInterface.getName().toLowerCase(locale).contains("virtual")) {
f60.finer("Skipping network interface (named '*virtual*'): " + networkInterface.getDisplayName());
return false;
}
if (networkInterface.getName().toLowerCase(locale).startsWith("ppp")) {
f60.finer("Skipping network interface (PPP): " + networkInterface.getDisplayName());
return false;
}
if (networkInterface.isLoopback()) {
f60.finer("Skipping network interface (ignoring loopback): " + networkInterface.getDisplayName());
return false;
}
if (this.f62.size() > 0 && !this.f62.contains(networkInterface.getName())) {
f60.finer("Skipping unwanted network interface (-Dorg.fourthline.cling.network.useInterfaces): " + networkInterface.getName());
return false;
}
if (networkInterface.supportsMulticast()) {
return true;
}
f60.warning("Network interface may not be multicast capable: " + networkInterface.getDisplayName());
return true;
}
public C0048(int i) throws InitializationException {
HashSet hashSet = new HashSet();
this.f62 = hashSet;
HashSet hashSet2 = new HashSet();
this.f63 = hashSet2;
ArrayList arrayList = new ArrayList();
this.f65 = arrayList;
ArrayList arrayList2 = new ArrayList();
this.f61 = arrayList2;
System.setProperty("java.net.preferIPv4Stack", "true");
String property = System.getProperty("org.fourthline.cling.network.useInterfaces");
if (property != null) {
hashSet.addAll(Arrays.asList(property.split(",")));
}
String property2 = System.getProperty("org.fourthline.cling.network.useAddresses");
if (property2 != null) {
hashSet2.addAll(Arrays.asList(property2.split(",")));
}
mo148();
m146();
if (arrayList.size() == 0 || arrayList2.size() == 0) {
f60.warning("No usable network interface or addresses found");
if (mo151()) {
throw new NoNetworkException("Could not discover any usable network interfaces and/or addresses");
}
}
this.f64 = i;
}
}