Returns the internal ip of the container if available
499304
def get_container_ip(self, container):
        
        info = self.inspect_container(container)
        if not info:
            return None

        netInfo = info['NetworkSettings']
        if not netInfo:
            return None

        ip = netInfo['IPAddress']
        if not ip:
            return None

        return ip
987126
def _get_ip(self, interface):
        
        if interface in ni.interfaces():
            addresses = ni.ifaddresses(interface)
            if ni.AF_INET in addresses:
                return addresses[ni.AF_INET][0]["addr"]
        return ""
1271253
def get_ips(self, instance_id):
        
        self._load_instance(instance_id)
        instance = self._load_instance(instance_id)
        IPs = [ip for ip in (instance.private_ip_address, instance.ip_address) if ip]

        # We also need to check if there is any floating IP associated
        if self.request_floating_ip and not self._vpc:
            # We need to list the floating IPs for this instance
            floating_ips = [ip for ip in self._ec2_connection.get_all_addresses() if ip.instance_id == instance.id]
            if not floating_ips:
                log.debug("Public ip address has to be assigned through "
                          "elasticluster.")
                ip = self._allocate_address(instance)
                # This is probably the preferred IP we want to use
                IPs.insert(0, ip)
            else:
                IPs = [ip.public_ip for ip in floating_ips] + IPs

        return list(set(IPs))
1335721
def interface_ip(interface):
    """"""
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(
        fcntl.ioctl(
            sock.fileno(), 0x8915, struct.pack('256s', interface[:15])
        )[20:24]
    )
63456
def get_own_ip():
    
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    try:
        sock.connect(("8.8.8.8", 80))
    except socket.gaierror:
        ip_ = "127.0.0.1"
    else:
        ip_ = sock.getsockname()[0]
    finally:
        sock.close()
    return ip_
521659
def current(cls):
        
        name = socket.getfqdn()
        ip = socket.gethostbyname(name)

        return cls(name, ip)
475483
def execute(self, container, start=None, end=None, registers=None):
        
        if registers:
            self.__cpu.registers = dict(registers)

        ip = start if start else container[0].address

        while ip and ip != end:
            try:
                instr = container.fetch(ip)
            except ReilContainerInvalidAddressError:
                logger.info("Invalid address: {:#010x}:{:#02x}".format(ip >> 8, ip & 0xff))

                raise ReilCpuInvalidAddressError()

            next_ip = self.__execute_one(instr)

            ip = next_ip if next_ip else container.get_next_address(ip)

        return dict(self.__cpu.registers), self.__mem
291045
def get_container_for(self, instance):
        
        if IReferenceAnalysis.providedBy(instance):
            return api.get_uid(instance.getSample())
        return instance.getRequestUID()
1315402
def get_ip(host):
    '''
    
    '''
    hosts = _list_hosts()
    if not hosts:
        return ''
    # Look for the op
    for addr in hosts:
        if host in hosts[addr]:
            return addr
    # ip not found
    return ''
687570
def get_client_ip(environ):
    # type: (Dict[str, str]) -> Optional[Any]
    
    try:
        return environ["HTTP_X_FORWARDED_FOR"].split(",")[0].strip()
    except (KeyError, IndexError):
        pass

    try:
        return environ["HTTP_X_REAL_IP"]
    except KeyError:
        pass

    return environ.get("REMOTE_ADDR")
455475
private String[] probeIps() {
        Set<String> ips = new TreeSet<String>();
        for (int i = 0; i < 32; ++i) {
            InetSocketAddress sa = new InetSocketAddress(_server, _port);
            ips.add(sa.getAddress().getHostAddress());
        }

        if (LOG.isDebugEnabled()) {
            StringBuffer sb = new StringBuffer();
            for (String ip : ips) {
                sb.append(ip);
                sb.append(" ");
            }
            LOG.debug(sb.toString());
        }

        return (String[]) ips.toArray(new String[0]);
    }
413101
def find_state(self, container, start=None, end=None, avoid=None, initial_state=None, final_state=None):
        
        self.__set_cpu_state(initial_state)

        # Convert input native addresses to reil addresses.
        start = to_reil_address(start) if start else None
        end = to_reil_address(end) if end else None
        avoid = [to_reil_address(addr) for addr in avoid] if avoid else []

        # Load instruction pointer.
        ip = start if start else container[0].address

        execution_state = Queue()

        trace_current = []
        trace_final = []

        self.__fs_process_container(container, final_state, ip, end, avoid, initial_state, execution_state,
                                    trace_current, trace_final)

        # Only returns when all paths have been visited.
        assert execution_state.empty()

        return trace_final
1060508
public static InetAddress getLocalIP() {
        try {
            Collection<InterfaceAddress> ips = getAllIPAddresses();
            if (ips.size() > 0) {
                return (InetAddress) ips.iterator().next().getAddress();
            } else {
                return null;
            }
        } catch (Exception e) {
            return null;
        }
    }
1152571
def get_self_ip():
        '''
        
        '''
        sck = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        try:
            sck.connect(('1.255.255.255', 1))  # Does not needs to be reachable
            ip_addr = sck.getsockname()[0]
        except Exception:
            ip_addr = socket.gethostbyname(socket.gethostname())
        finally:
            sck.close()
        return ip_addr
774983
def get_ip_info(ip_str):
    
    ip = None
    is_routable_ip = False
    if is_valid_ip(ip_str):
        ip = ip_str
        is_routable_ip = is_public_ip(ip)
    return ip, is_routable_ip
1221725
def get_private_ip(self, addr_family=None, *args, **kwargs):
        """"""
        return self.get_ip('private', addr_family, *args, **kwargs)
604995
def get(self):
        """"""
        q = queue.Queue()

        for u, j, k in urls:
            t = threading.Thread(target=self._get_ip_public, args=(q, u, j, k))
            t.daemon = True
            t.start()

        timer = Timer(self.timeout)
        ip = None
        while not timer.finished() and ip is None:
            if q.qsize() > 0:
                ip = q.get()

        return ', '.join(set([x.strip() for x in ip.split(',')]))