lookup performs the sending of DNS queries for the given items
 returns an array of DNSBLResult
422938
def lookup(item)
			# if item is an array, use it, otherwise make it one
			items = item
			if item.is_a? String
				items = [item]
			end
			# place the results in the results array
			results = []
			# for each ip or hostname
			items.each do |item|
				# sent is used to determine when we have all the answers
				sent = 0
				# record the start time
				@starttime = Time.now.to_f
				# determine the type of query
				itemtype = (item =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) ? 'ip' : 'domain'
				# for each dnsbl that supports our type, create the DNS query packet and send it
				# rotate across our configured name servers and increment sent
				@dnsbls.each do |name,config|
					next if config['disabled']
					next unless config['type'] == itemtype
					begin
						msg = _encode_query(item,itemtype,config['domain'],config['apikey'])
						@sockets[@socket_index].send(msg,0)
						@socket_index += 1
						@socket_index %= @sockets.length
						sent += 1
					rescue Exception => e
						puts e
						puts e.backtrace.join("\n")
					end
				end
				# while we still expect answers
				while sent > 0
					# wait on the socket for maximally 1.5 seconds
					r,_,_ = IO.select(@sockets,nil,nil,1.5)
					# if we time out, break out of the loop
					break unless r
					# for each reply, decode it and receive results, decrement the pending answers
					r.each do |s|
						begin
							response = _decode_response(s.recv(4096))
							results += response
						rescue Exception => e
							puts e
							puts e.backtrace.join("\n")
						end
						sent -= 1
					end
				end
			end
			results
		end
1028858
def lookup!(nameserver=nil)
      resolver = Resolv.resolver(nameserver)
      ips = begin
              resolver.getaddresses(self.address)
            rescue
              []
            end

      ips.map! do |addr|
        IPAddress.first_or_create(
          :address => addr,
          :host_names => [self]
        )
      end

      return ips
    end
695568
async def _check_ip(self, addr):
        

        tasks = []
        for provider in self.providers:
            tasks.append(self.dnsbl_request(addr, provider))
        results = await asyncio.gather(*tasks)
        return DNSBLResult(addr=addr, results=results)
310682
public static dnsnsrec[] get(nitro_service service) throws Exception{
		dnsnsrec obj = new dnsnsrec();
		dnsnsrec[] response = (dnsnsrec[])obj.get_resources(service);
		return response;
	}
991596
def lookup(self, domain, get_last_full_query=True):
        

        last_full_builtwith_scan_date = None

        if self.api_version == 7 and isinstance(domain, list):
            domain = ','.join(domain)

        if self.api_version in [2, 7]:
            last_updates_resp = requests.get(ENDPOINTS_BY_API_VERSION[self.api_version], params={'UPDATE': 1})
            last_updated_data = last_updates_resp.json()

            if get_last_full_query and last_updated_data['FULL']:
              last_full_builtwith_scan_date = datetime.datetime.strptime(last_updated_data['FULL'], '%Y-%m-%d').date()

        params = {
            'KEY': self.key,
            'LOOKUP': domain,
        }

        response = requests.get(ENDPOINTS_BY_API_VERSION[self.api_version], params=params)

        if self.api_version == 1:
            return response.json()
        elif self.api_version == 2:
            return BuiltWithDomainInfo(response.json(), last_full_builtwith_scan_date)
        elif self.api_version == 7:
            domain_info = list()
            for result in response.json()['Results']:
                domain_info.append(BuiltWithDomainInfo(result['Result'], last_full_builtwith_scan_date))
            return domain_info
549829
def _create_dns_list(self, dns):
        
        if not dns:
            return None

        dns_list = []

        if isinstance(dns, six.string_types):
            if is_valid_ip(dns):
                dns_list.append(dns)
            else:
                raise ValueError("dns is required to be a valid ip adress. {0} was passed.".format(dns))
        elif isinstance(dns, list):
            for dns_entry in dns:
                if is_valid_ip(dns_entry):
                    dns_list.append(dns_entry)
            else:
                raise ValueError("dns is required to be a valid ip adress. {0} was passed.".format(dns))

        else:
            raise ValueError("dns and dns search must be a list or string. {0} was passed.".format(dns))

        return dns_list
369055
public static dnsaction[] get(nitro_service service) throws Exception{
		dnsaction obj = new dnsaction();
		dnsaction[] response = (dnsaction[])obj.get_resources(service);
		return response;
	}
1090706
def _encode_query(item,itemtype,domain,apikey=nil)
			label = nil
			if itemtype == 'ip'
				label = item.split(/\./).reverse.join(".")
			elsif itemtype == 'domain'
				label = normalize(item)
			end
			lookup = "#{label}.#{domain}"
			if apikey
				lookup = "#{apikey}.#{lookup}"
			end
			txid = lookup.sum
			message = Resolv::DNS::Message.new(txid)
			message.rd = 1
			message.add_question(lookup,Resolv::DNS::Resource::IN::A)
			message.encode
		end
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)
1241040
function _mapInDNs(&$root, $path, $asn1)
    {
        $dns = &$this->_subArray($root, $path);

        if (is_array($dns)) {
            for ($i = 0; $i < count($dns); $i++) {
                for ($j = 0; $j < count($dns[$i]); $j++) {
                    $type = $dns[$i][$j]['type'];
                    $value = &$dns[$i][$j]['value'];
                    if (is_object($value) && $value instanceof Element) {
                        $map = $this->_getMapping($type);
                        if (!is_bool($map)) {
                            $decoded = $asn1->decodeBER($value);
                            $value = $asn1->asn1map($decoded[0], $map);
                        }
                    }
                }
            }
        }
    }
911668
def _get_dns_entry_trs(self):
        
        from bs4 import BeautifulSoup
        dns_list_response = self.session.get(
            self.URLS['dns'].format(self.domain_id))
        self._log('DNS list', dns_list_response)
        assert dns_list_response.status_code == 200, \
            'Could not load DNS entries.'

        html = BeautifulSoup(dns_list_response.content, 'html.parser')
        self._log('DNS list', html)
        dns_table = html.find('table', {'id': 'cp_domains_dnseintraege'})
        assert dns_table is not None, 'Could not find DNS entry table'

        def _is_zone_tr(elm):
            has_ondblclick = elm.has_attr('ondblclick')
            has_class = elm.has_attr('class')
            return elm.name.lower() == 'tr' and (has_class or has_ondblclick)

        rows = dns_table.findAll(_is_zone_tr)
        assert rows is not None and rows, 'Could not find any DNS entries'
        return rows
1137845
def lookup(sock, domain, cache = None):
    """"""
    domain = normalize_domain(domain)

    # cache miss, perform lookup
    reply = sam_cmd(sock, "NAMING LOOKUP NAME=%s" % domain)

    b64_dest = reply.get('VALUE')
    if b64_dest:
        dest = Dest(b64_dest, encoding='base64')
        if cache:
            cache[dest.base32 + '.b32.i2p'] = dest
        return dest
    else:
        raise NSError('Domain name %r not resolved because %r' % (domain, reply))
203008
public static dnsnameserver[] get(nitro_service service) throws Exception{
		dnsnameserver obj = new dnsnameserver();
		dnsnameserver[] response = (dnsnameserver[])obj.get_resources(service);
		return response;
	}
418711
def query_mxrecords(self):
        
        import dns.resolver
        logging.info('Resolving DNS query...')
        answers = dns.resolver.query(self.domain, 'MX')
        addresses = [answer.exchange.to_text() for answer in answers]
        logging.info(
            '{} records found:\n{}'.format(
                len(addresses), '\n  '.join(addresses)))
        return addresses
470255
public static dnsptrrec[] get(nitro_service service) throws Exception{
		dnsptrrec obj = new dnsptrrec();
		dnsptrrec[] response = (dnsptrrec[])obj.get_resources(service);
		return response;
	}
118133
def _get_nameservers(domain):
        
        nameservers = []
        rdtypes_ns = ['SOA', 'NS']
        rdtypes_ip = ['A', 'AAAA']
        for rdtype_ns in rdtypes_ns:
            for rdata_ns in Provider._dns_lookup(domain, rdtype_ns):
                for rdtype_ip in rdtypes_ip:
                    for rdata_ip in Provider._dns_lookup(rdata_ns.to_text().split(' ')[0],
                                                         rdtype_ip):
                        if rdata_ip.to_text() not in nameservers:
                            nameservers.append(rdata_ip.to_text())
        LOGGER.debug('DNS Lookup => %s IN NS %s', domain, ' '.join(nameservers))
        return nameservers
1012499
function getDomain(data, accessor) {
      return data
        .map(function (item) {
          return accessor.call(this, item);
        })
        .filter(function (item, index, array) {
          return array.indexOf(item) === index;
        });
    }