导航菜单

页面标题

页面副标题

饼干视频 v4.1.0 - C0150.java 源代码

正在查看: 饼干视频 v4.1.0 应用的 C0150.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package amc.cd.p024;

import amc.cd.p010.InterfaceC0046;
import amc.cd.p1199.AbstractC7758;
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 C0150 implements InterfaceC0046 {

    public static Logger f306 = Logger.getLogger(C0150.class.getName());

    public final List<InetAddress> f307;

    public final Set<String> f308;

    public final Set<String> f309;

    public int f310;

    public final List<NetworkInterface> f311;

    public class C0151 extends AbstractC7758<NetworkInterface> {
        public C0151(Collection collection) {
            super(collection);
        }

        @Override
        public void mo343(int i) {
            synchronized (C0150.this.f311) {
                C0150.this.f311.remove(i);
            }
        }
    }

    public class C0152 extends AbstractC7758<InetAddress> {
        public C0152(Collection collection) {
            super(collection);
        }

        @Override
        public void mo343(int i) {
            synchronized (C0150.this.f307) {
                C0150.this.f307.remove(i);
            }
        }
    }

    public C0150() throws InitializationException {
        this(0);
    }

    public void m334() throws InitializationException {
        try {
            synchronized (this.f311) {
                Iterator<NetworkInterface> it = this.f311.iterator();
                while (it.hasNext()) {
                    NetworkInterface next = it.next();
                    f306.finer("Discovering addresses of interface: " + next.getDisplayName());
                    int i = 0;
                    for (InetAddress inetAddress : m338(next)) {
                        if (inetAddress == null) {
                            f306.warning("Network has a null address: " + next.getDisplayName());
                        } else if (mo335(next, inetAddress)) {
                            f306.fine("Discovered usable network interface address: " + inetAddress.getHostAddress());
                            i++;
                            synchronized (this.f307) {
                                this.f307.add(inetAddress);
                            }
                        } else {
                            f306.finer("Ignoring non-usable network interface address: " + inetAddress.getHostAddress());
                        }
                    }
                    if (i == 0) {
                        f306.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 C0151(this.f311);
    }

    public boolean mo335(NetworkInterface networkInterface, InetAddress inetAddress) {
        if (!(inetAddress instanceof Inet4Address)) {
            f306.finer("Skipping unsupported non-IPv4 address: " + inetAddress);
            return false;
        }
        if (inetAddress.isLoopbackAddress()) {
            f306.finer("Skipping loopback address: " + inetAddress);
            return false;
        }
        if (this.f309.size() <= 0 || this.f309.contains(inetAddress.getHostAddress())) {
            return true;
        }
        f306.finer("Skipping unwanted address: " + inetAddress);
        return false;
    }

    public void mo336() throws InitializationException {
        try {
            Iterator it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator();
            while (it.hasNext()) {
                NetworkInterface networkInterface = (NetworkInterface) it.next();
                f306.finer("Analyzing network interface: " + networkInterface.getDisplayName());
                if (m342(networkInterface)) {
                    f306.fine("Discovered usable network interface: " + networkInterface.getDisplayName());
                    synchronized (this.f311) {
                        this.f311.add(networkInterface);
                    }
                } else {
                    f306.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 m337(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 C0152(this.f307);
    }

    @Override
    public InetAddress mo30() {
        try {
            return InetAddress.getByName("239.255.255.250");
        } catch (UnknownHostException e) {
            throw new RuntimeException(e);
        }
    }

    public List<InetAddress> m338(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) {
            f306.log(Level.WARNING, "Cannot get hardware address for: " + inetAddress, th);
            return null;
        }
    }

    public boolean mo339() {
        return true;
    }

    @Override
    public int mo33() {
        return this.f310;
    }

    @Override
    public boolean mo34() {
        return this.f311.size() > 0 && this.f307.size() > 0;
    }

    public InetAddress m340(InetAddress inetAddress) {
        synchronized (this.f311) {
            Iterator<NetworkInterface> it = this.f311.iterator();
            while (it.hasNext()) {
                for (InterfaceAddress interfaceAddress : m341(it.next())) {
                    synchronized (this.f307) {
                        if (interfaceAddress != null) {
                            if (this.f307.contains(interfaceAddress.getAddress())) {
                                if (m337(inetAddress.getAddress(), interfaceAddress.getAddress().getAddress(), interfaceAddress.getNetworkPrefixLength())) {
                                    return interfaceAddress.getAddress();
                                }
                            }
                        }
                    }
                }
            }
            return null;
        }
    }

    public List<InterfaceAddress> m341(NetworkInterface networkInterface) {
        return networkInterface.getInterfaceAddresses();
    }

    @Override
    public InetAddress mo35(NetworkInterface networkInterface, boolean z, InetAddress inetAddress) {
        InetAddress m340 = m340(inetAddress);
        if (m340 != null) {
            return m340;
        }
        f306.finer("Could not find local bind address in same subnet as: " + inetAddress.getHostAddress());
        for (InetAddress inetAddress2 : m338(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 m342(NetworkInterface networkInterface) throws Exception {
        if (!networkInterface.isUp()) {
            f306.finer("Skipping network interface (down): " + networkInterface.getDisplayName());
            return false;
        }
        if (m338(networkInterface).size() == 0) {
            f306.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"))) {
            f306.finer("Skipping network interface (VMWare): " + networkInterface.getDisplayName());
            return false;
        }
        if (networkInterface.getName().toLowerCase(locale).startsWith("vnic")) {
            f306.finer("Skipping network interface (Parallels): " + networkInterface.getDisplayName());
            return false;
        }
        if (networkInterface.getName().toLowerCase(locale).startsWith("vboxnet")) {
            f306.finer("Skipping network interface (Virtual Box): " + networkInterface.getDisplayName());
            return false;
        }
        if (networkInterface.getName().toLowerCase(locale).contains("virtual")) {
            f306.finer("Skipping network interface (named '*virtual*'): " + networkInterface.getDisplayName());
            return false;
        }
        if (networkInterface.getName().toLowerCase(locale).startsWith("ppp")) {
            f306.finer("Skipping network interface (PPP): " + networkInterface.getDisplayName());
            return false;
        }
        if (networkInterface.isLoopback()) {
            f306.finer("Skipping network interface (ignoring loopback): " + networkInterface.getDisplayName());
            return false;
        }
        if (this.f308.size() > 0 && !this.f308.contains(networkInterface.getName())) {
            f306.finer("Skipping unwanted network interface (-Dorg.fourthline.cling.network.useInterfaces): " + networkInterface.getName());
            return false;
        }
        if (networkInterface.supportsMulticast()) {
            return true;
        }
        f306.warning("Network interface may not be multicast capable: " + networkInterface.getDisplayName());
        return true;
    }

    public C0150(int i) throws InitializationException {
        HashSet hashSet = new HashSet();
        this.f308 = hashSet;
        HashSet hashSet2 = new HashSet();
        this.f309 = hashSet2;
        ArrayList arrayList = new ArrayList();
        this.f311 = arrayList;
        ArrayList arrayList2 = new ArrayList();
        this.f307 = 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(",")));
        }
        mo336();
        m334();
        if (arrayList.size() == 0 || arrayList2.size() == 0) {
            f306.warning("No usable network interface or addresses found");
            if (mo339()) {
                throw new NoNetworkException("Could not discover any usable network interfaces and/or addresses");
            }
        }
        this.f310 = i;
    }
}