Get vendor company name.

            Keyword arguments:
            mac -- MAC address or OUI for searching
421739
def get_vendor(self, mac):
        

        data = {
            self._SEARCH_F: mac,
            self._FORMAT_F: self._VERBOSE_T
        }

        response = self.__decode_str(self.__call_api(self.__url, data), 'utf-8')

        return response
5557
def get_vendors_info(self, limit=10, offset=10):
        
        params = {}
        if offset:
            params['offset'] = offset
        if limit:
            params['limit'] = limit
        url = 'rest/1.0/vendors'
        return (self.get(url, params=params) or {}).get('vendors')
642767
def _find_chain_name(self, mac):
        """"""

        ipt_cmd = ['iptables', '-t', 'filter', '-S']
        cmdo = dsl.execute(ipt_cmd, root_helper=self._root_helper,
                           log_output=False)
        for o in cmdo.split('\n'):
            if mac in o.lower():
                chain = o.split()[1]
                LOG.info('Find %(chain)s for %(mac)s.',
                         {'chain': chain, 'mac': mac})
                return chain
109787
def get_if_raw_hwaddr(ifname):
    """"""

    NULL_MAC_ADDRESS = b'\x00' * 6

    # Handle the loopback interface separately
    if ifname == LOOPBACK_NAME:
        return (ARPHDR_LOOPBACK, NULL_MAC_ADDRESS)

    # Get ifconfig output
    try:
        fd = os.popen("%s %s" % (conf.prog.ifconfig, ifname))
    except OSError as msg:
        raise Scapy_Exception("Failed to execute ifconfig: (%s)" % msg)

    # Get MAC addresses
    addresses = [l for l in fd.readlines() if l.find("ether") >= 0 or
                 l.find("lladdr") >= 0 or
                 l.find("address") >= 0]
    if not addresses:
        raise Scapy_Exception("No MAC address found on %s !" % ifname)

    # Pack and return the MAC address
    mac = addresses[0].split(' ')[1]
    mac = [chr(int(b, 16)) for b in mac.split(':')]
    return (ARPHDR_ETHER, ''.join(mac))
847036
function getVendorPropertyName(prop) {
    // Handle unprefixed versions (FF16+, for example)
    if (prop in div.style) return prop;

    var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
    var prop_ = prop.charAt(0).toUpperCase() + prop.substr(1);

    if (prop in div.style) { return prop; }

    for (var i=0; i<prefixes.length; ++i) {
      var vendorProp = prefixes[i] + prop_;
      if (vendorProp in div.style) { return vendorProp; }
    }
  }
866363
def _find_interfaces_ip(mac):
    '''
    
    '''
    try:
        mac = napalm_helpers.convert(napalm_helpers.mac, mac)
    except AddrFormatError:
        return ('', '', [])

    all_interfaces = _get_mine('net.interfaces')
    all_ipaddrs = _get_mine('net.ipaddrs')

    for device, device_interfaces in six.iteritems(all_interfaces):
        if not device_interfaces.get('result', False):
            continue
        for interface, interface_details in six.iteritems(device_interfaces.get('out', {})):
            try:
                interface_mac = napalm_helpers.convert(napalm_helpers.mac, interface_details.get('mac_address'))
            except AddrFormatError:
                continue
            if mac != interface_mac:
                continue
            interface_ipaddrs = all_ipaddrs.get(device, {}).get('out', {}).get(interface, {})
            ip_addresses = interface_ipaddrs.get('ipv4', {})
            ip_addresses.update(interface_ipaddrs.get('ipv6', {}))
            interface_ips = ['{0}/{1}'.format(ip_addr,
                                              addr_details.get('prefix_length', '32'))
                             for ip_addr, addr_details in six.iteritems(ip_addresses)]
            return device, interface, interface_ips

    return ('', '', [])
711171
def get_primary_mac_address():
    
    log = logging.getLogger(mod_logger + '.get_primary_mac_address')
    log.debug('Attempting to determine the MAC address for eth0...')
    try:
        mac_address = netifaces.ifaddresses('eth0')[netifaces.AF_LINK][0]['addr']
    except Exception:
        _, ex, trace = sys.exc_info()
        msg = '{n}: Unable to determine the eth0 mac address for this system:\n{e}'.format(
            n=ex.__class__.__name__, e=str(ex))
        raise AWSMetaDataError, msg, trace
    return mac_address
1367556
async def query(
            cls, *,
            hostnames: typing.Iterable[str] = None,
            domains: typing.Iterable[str] = None,
            zones: typing.Iterable[str] = None,
            macs: typing.Iterable[str] = None,
            system_ids: typing.Iterable[str] = None,
            agent_name: str = None,
            level: typing.Union[Level, int, str] = None,
            before: int = None,
            after: int = None,
            limit: int = None,
            owner: typing.Union[User, str] = None):
        """"""

        if before is not None and after is not None:
            raise ValueError("Specify either `before` or `after`, not both.")

        params = {}

        if hostnames is not None:
            params["hostname"] = list(hostnames)
        if domains is not None:
            params["domain"] = list(domains)
        if zones is not None:
            params["zone"] = list(zones)
        if macs is not None:
            params["mac_address"] = list(macs)
        if system_ids is not None:
            params["id"] = list(system_ids)
        if agent_name is not None:
            params["agent_name"] = [agent_name]
        if level is not None:
            level = Level.normalise(level)
            params["level"] = [level.name]
        if before is not None:
            params["before"] = ["{:d}".format(before)]
        if after is not None:
            params["after"] = ["{:d}".format(after)]
        if limit is not None:
            params["limit"] = ["{:d}".format(limit)]
        if owner is not None:
            if isinstance(owner, User):
                params["owner"] = [owner.username]
            elif isinstance(owner, str):
                params["owner"] = [owner]
            else:
                raise TypeError(
                    "owner must be either User or str, not %s" % (
                        type(owner).__name__))

        data = await cls._handler.query(**params)
        return cls(data)
39299
def get_vendor_extension_fields(mapping):
    
    return {k: v for k, v in mapping.items() if k.startswith('x-')}
705508
def check_mac(original_mac):
    '''
    
    '''
    mac = (original_mac.upper()).strip()
    parts = mac.split(':')
    if len(parts) == 6:
        # let's think that it is a : separated mac
        for p in parts:
            if len(p) != 2:
                return None
        mac = ''.join(parts)
    elif len(parts) > 1:
        return None
    for c in mac:
        if c not in '0123456789ABCDEF':
            return None
    return mac
771363
def get_macs_for_vlan(self, ip, vlan, display_progress=0, snmpobj=None, system_name=None, ifname_vbtbl=None):
        '''
        
        '''
        ret_macs = []

        if (snmpobj == None):
            snmpobj = natlas_snmp(ip)
            if (snmpobj.get_cred(self.config.snmp_creds) == 0):
                return None
        if (ifname_vbtbl == None):
            ifname_vbtbl = snmpobj.get_bulk(OID_IFNAME)
        if (system_name == None):
            system_name = util.shorten_host_name(snmpobj.get_val(OID_SYSNAME), self.config.host_domains)

        # change our SNMP credentials
        old_cred = snmpobj.v2_community
        snmpobj.v2_community = old_cred + '@' + str(vlan)

        if (display_progress == 1):
            sys.stdout.write(str(vlan)) # found VLAN
            sys.stdout.flush()

        # get CAM table for this VLAN
        cam_vbtbl       = snmpobj.get_bulk(OID_VLAN_CAM)
        portnum_vbtbl   = snmpobj.get_bulk(OID_BRIDGE_PORTNUMS)
        ifindex_vbtbl   = snmpobj.get_bulk(OID_IFINDEX)
        cam_match       = None

        if (cam_vbtbl == None):
            # error getting CAM for VLAN
            return None

        for cam_row in cam_vbtbl:
            for cam_n, cam_v in cam_row:
                cam_entry = natlas_mac.mac_format_ascii(cam_v, 0)

                # find the interface index
                p               = cam_n.getOid()
                portnum_oid     = '%s.%i.%i.%i.%i.%i.%i' % (OID_BRIDGE_PORTNUMS, p[11], p[12], p[13], p[14], p[15], p[16])
                bridge_portnum  = snmpobj.cache_lookup(portnum_vbtbl, portnum_oid)

                # get the interface index and description
                try:
                    ifidx       = snmpobj.cache_lookup(ifindex_vbtbl, OID_IFINDEX + '.' + bridge_portnum)
                    port        = snmpobj.cache_lookup(ifname_vbtbl, OID_IFNAME + '.' + ifidx)
                except TypeError:
                    port = 'None'

                mac_addr = natlas_mac.mac_format_ascii(cam_v, 1)
                
                if (display_progress == 1):
                    sys.stdout.write('.') # found CAM entry
                    sys.stdout.flush()

                entry = natlas_mac.mac_object(system_name, ip, vlan, mac_addr, port)
                ret_macs.append(entry)

        # restore SNMP credentials
        snmpobj.v2_community = old_cred
        return ret_macs
384162
public function vendorName()
    {
        $name = $this->name();
        if (null === $name) {
            return null;
        }

        $atoms = explode(static::NAME_SEPARATOR, $name);
        array_pop($atoms);
        if (count($atoms) < 1) {
            return null;
        }

        return implode(static::NAME_SEPARATOR, $atoms);
    }
856970
def get(self, mac):
        

        data = {
            self._FORMAT_F: 'json',
            self._SEARCH_F: mac
        }

        response = self.__decode_str(self.__call_api(self.__url, data), 'utf-8')

        if len(response) > 0:
            return self.__parse(response)
        raise EmptyResponseException()
378028
def FindByName(cls, name):
        """"""

        reg = ComponentRegistry()
        for _, entry in reg.load_extensions('iotile.auth_provider', name_filter=name):
            return entry
1305992
def catalogFactory(name, **kwargs):
    
    fn = lambda member: inspect.isclass(member) and member.__module__==__name__
    catalogs = odict(inspect.getmembers(sys.modules[__name__], fn))

    if name not in list(catalogs.keys()):
        msg = "%s not found in catalogs:\n %s"%(name,list(kernels.keys()))
        logger.error(msg)
        msg = "Unrecognized catalog: %s"%name
        raise Exception(msg)

    return catalogs[name](**kwargs)
688855
def _find_interfaces_mac(ip):  # pylint: disable=invalid-name
    '''
    
    '''
    all_interfaces = _get_mine('net.interfaces')
    all_ipaddrs = _get_mine('net.ipaddrs')

    for device, device_ipaddrs in six.iteritems(all_ipaddrs):
        if not device_ipaddrs.get('result', False):
            continue
        for interface, interface_ipaddrs in six.iteritems(device_ipaddrs.get('out', {})):
            ip_addresses = interface_ipaddrs.get('ipv4', {}).keys()
            ip_addresses.extend(interface_ipaddrs.get('ipv6', {}).keys())
            for ipaddr in ip_addresses:
                if ip != ipaddr:
                    continue
                interface_mac = all_interfaces.get(device, {}).get('out', {}).get(interface, {}).get('mac_address', '')
                return device, interface, interface_mac

    return ('', '', '')
369098
def get_customer(code):
    
    Party = client.model('party.party')
    results = Party.find([('code', '=', code)])
    if results:
        return results[0]['id']