Retrieve a complete list of bought ip address related only to PRO Servers.
        It create an internal object (Iplist) representing all of the ips object
        iterated form the WS.
        @param: None
        @return: None
490729
def get_ip(self):
        
        json_scheme = self.gen_def_json_scheme('GetPurchasedIpAddresses')
        json_obj = self.call_method_post(method='GetPurchasedIpAddresses ', json_scheme=json_scheme)
        self.iplist = IpList()
        for ip in json_obj['Value']:
            r = Ip()
            r.ip_addr = ip['Value']
            r.resid = ip['ResourceId']
            r.serverid = ip['ServerId'] if 'None' not in str(ip['ServerId']) else None
            self.iplist.append(r)
1102377
def get_ips(self, interface=None, family=None, scope=None, timeout=0):
        

        kwargs = {}
        if interface:
            kwargs['interface'] = interface
        if family:
            kwargs['family'] = family
        if scope:
            kwargs['scope'] = scope

        ips = None
        timeout = int(os.environ.get('LXC_GETIP_TIMEOUT', timeout))

        while not ips:
            ips = _lxc.Container.get_ips(self, **kwargs)
            if timeout == 0:
                break

            timeout -= 1
            time.sleep(1)

        return ips
1010554
def get_ip_address_from_rackspace_server(server_id):
    
    nova = connect_to_rackspace()
    server = nova.servers.get(server_id)
    # the server was assigned IPv4 and IPv6 addresses, locate the IPv4 address
    ip_address = None
    for network in server.networks['public']:
        if re.match('\d+\.\d+\.\d+\.\d+', network):
            ip_address = network
            break

    # find out if we have an ip address
    if ip_address is None:
        log_red('No IP address assigned')
        return False
    else:
        return ip_address
1028695
def Delete(self):
		

		public_ip_set = [{'public_ipId': o.id} for o in self.parent.public_ips if o!=self]
		self.parent.public_ips = [o for o in self.parent.public_ips if o!=self]
		return(clc.v2.Requests(clc.v2.API.Call('DELETE','servers/%s/%s/publicIPAddresses/%s' % (self.parent.server.alias,self.parent.server.id,self.id),
											   session=self.session),
		                       alias=self.parent.server.alias,
							   session=self.session))
425376
def ParseForwardedIps(self, forwarded_ips):
    
    addresses = []
    forwarded_ips = forwarded_ips or []
    for ip in forwarded_ips:
      if ip and (IP_REGEX.match(ip) or IP_ALIAS_REGEX.match(ip)):
        addresses.append(ip[:-3] if ip.endswith('/32') else ip)
      else:
        self.logger.warning('Could not parse IP address: "%s".', ip)
    return addresses
613683
def ips(self):
        """"""
        r = []
        names = ['X_FORWARDED_FOR', 'CLIENT_IP', 'X_REAL_IP', 'X_FORWARDED', 
               'X_CLUSTER_CLIENT_IP', 'FORWARDED_FOR', 'FORWARDED', 'VIA',
               'REMOTE_ADDR']

        for name in names:
            vs = self.get_header(name, '')
            if vs:
                r.extend(map(lambda v: v.strip(), vs.split(',')))

            vs = self.environ.get(name, '')
            if vs:
                r.extend(map(lambda v: v.strip(), vs.split(',')))

        return r
619502
def check_ips(self, addrs):
        
        tasks = []
        for addr in addrs:
            tasks.append(self._check_ip(addr))
        return self._loop.run_until_complete(asyncio.gather(*tasks))
453675
def get_ip4():
    
    addresses = []

    shell_cmd = "ifconfig | awk '/inet addr/{print substr($2,6)}'"
    proc = subprocess.Popen([shell_cmd], stdout=subprocess.PIPE, shell=True)
    (out, err) = proc.communicate()
    ip_addresses = out.split('\n')
    for addr in ip_addresses:
        if re.match(r'\d{1,4}\.\d{1,4}\.\d{1,4}\.\d{1,4}', addr):
             addresses.append(addr)
    return addresses
269578
def get_or_create_from_ip(ip):
        
        data = ip_api_handler.get(ip)
        if data and any(v for v in data.values()):
            if data.get('ip_address', None) is None or not data['ip_address']:
                data['ip_address'] = ip
            return IPInfo.objects.get_or_create(**data)
        return None, False
119570
def getNeighbouringRouters(self):
        
        print '%s call getNeighbouringRouters' % self.port
        try:
            routerInfo = []
            routerList = []
            routerList = self.__sendCommand('router list')[0].split()
            print routerList

            if 'Done' in routerList:
                print 'no neighbouring routers'
                return None

            for index in routerList:
                router = []
                cmd = 'router %s' % index
                router = self.__sendCommand(cmd)

                for line in router:
                    if 'Done' in line:
                        break
                    #elif 'Rloc' in line:
                    #    rloc16 = line.split()[1]
                    elif 'Ext Addr' in line:
                        eui = line.split()[2]
                        routerInfo.append(int(eui, 16))
                    #elif 'LQI In' in line:
                    #    lqi_in = line.split()[1]
                    #elif 'LQI Out' in line:
                    #    lqi_out = line.split()[1]
                    else:
                        pass

            print routerInfo
            return routerInfo
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger("getNeighbouringDevice() Error: " + str(e))
953110
def query(self, ip_address):
        
        try:
            return self._decode_response(
                socket.gethostbyname(self._build_query(ip_address)))
        except socket.gaierror:  # Not listed
            return {
                'days_since_last_activity': None,
                'name': None,
                'threat_score': 0,
                'type': None
            }
937097
def get_ips(self, instance_id):
        
        self._init_az_api()
        cluster_name, node_name = instance_id
        # XXX: keep in sync with contents of `vm_deployment_template`
        ip_name = ('{node_name}-public-ip'.format(node_name=node_name))
        ip = self._network_client.public_ip_addresses.get(cluster_name, ip_name)
        if (ip.provisioning_state == 'Succeeded' and ip.ip_address):
            return [ip.ip_address]
        else:
            return []
599073
def get_my_ips():
    """"""
    ips = list()
    if not os.path.exists("/sys/class/net"): # not linux
        return ['127.0.0.1']
    for ifdev in os.listdir("/sys/class/net"):
        if ifdev == "lo":
            continue
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            ips.append(socket.inet_ntoa(fcntl.ioctl(
                sock.fileno(),
                0x8915,  # SIOCGIFADDR
                struct.pack('256s', ifdev[:15].encode())
            )[20:24]))
        except OSError:
            pass
    return ips
497202
def get_hosts_info(self):
        
        result = []
        index = 0
        while index < self.host_numbers:
            host = self.get_generic_host_entry(index)
            result.append({
                'ip': host['NewIPAddress'],
                'name': host['NewHostName'],
                'mac': host['NewMACAddress'],
                'status': host['NewActive']})
            index += 1
        return result
599110
def get_client_ip(request):
    
    # set the default value of the ip to be the REMOTE_ADDR if available
    # else None
    ip = request.META.get('REMOTE_ADDR')
    # try to get the first non-proxy ip (not a private ip) from the
    # HTTP_X_FORWARDED_FOR
    x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
    if x_forwarded_for:
        proxies = x_forwarded_for.split(',')
        # remove the private ips from the beginning
        proxies = [proxy for proxy in proxies
                   if not proxy.startswith(settings.PRIVATE_IPS_PREFIX)]
        # take the first ip which is not a private one (of a proxy)
        if len(proxies) > 0:
            ip = proxies[0]

    return ip
479093
def _get_real_ip(self):
        
        try:
            # Trying to work with most common proxy headers
            real_ip = self.request.META['HTTP_X_FORWARDED_FOR']
            return real_ip.split(',')[0]
        except KeyError:
            return self.request.META['REMOTE_ADDR']
        except Exception:
            # Unknown IP
            return None
137683
def ip_addresses(self, value):
        
        if not isinstance(value, list):
            raise ValueError('ip_addresses value must be a list')
        # in soem cases self.data might be none, so let's instantiate an empty dict
        if self.data is None:
            self.data = {}
        # update field
        self.data['ip_addresses'] = ', '.join(value)