コード例 #1
0
ファイル: feedfilter.py プロジェクト: csirtfoundry/netgrep
    def domains_to_ips(self):
        ar = AsyncResolver([domain_data["domain"] for domain_data in self.repo.get_domain_data()])
        resolved = ar.resolve()

        for host, ips in resolved.items():
            if ips is None:
                logging.debug("%s could not be resolved." % host)
            else:
                self.repo.add_domain_ips(host, ips)
コード例 #2
0
def doAsyncDNSResolution(DomainList):
	'''
	Resolves the domains in the DomainList argument very quickly, asynchronously. 
	Returns a dictionary of {'host': 'ip'}

	@DomainList = A list of domains to be resolved. 

	IMPORTANT: The DomainList cannot contain duplicate domain names 
	or else this function will NEVER return!
	'''
	ar = AsyncResolver(DomainList,intensity=100)
	resolved = ar.resolve()
	return resolved
コード例 #3
0
ファイル: dns_resolver.py プロジェクト: krushnabhalerav/adns
from async_dns import AsyncResolver
import sys
from time import time
hosts=list(sys.argv)
hosts.pop(0)
ar = AsyncResolver(
           hosts
    )
start = time()
resolved = ar.resolve()
end = time()

print "-------------------------------------------"
for host, ip in resolved.items():
  if ip is None:
        	print "%s could not be resolved." % host
      	else:
        	print "%s resolved to %s" % (host, ip)
print "-------------------------------------------"
print "It took %.2f seconds to resolve %d hosts." % (end-start, len(sys.argv)-1)
print "-------------------------------------------"