当前位置: 首页>>代码示例>>Python>>正文


Python aiodns.DNSResolver方法代码示例

本文整理汇总了Python中aiodns.DNSResolver方法的典型用法代码示例。如果您正苦于以下问题:Python aiodns.DNSResolver方法的具体用法?Python aiodns.DNSResolver怎么用?Python aiodns.DNSResolver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aiodns的用法示例。


在下文中一共展示了aiodns.DNSResolver方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def __init__(self, *, timeout=defaults.TIMEOUT, loop):
        self._loop = loop
        self._timeout = timeout
        self._resolver = aiodns.DNSResolver(timeout=timeout, loop=loop)
        self._http_timeout = aiohttp.ClientTimeout(total=timeout)
        self._proxy_info = aiohttp.helpers.proxies_from_env().get('https', None)
        self._logger = logging.getLogger("RES")

        if self._proxy_info is None:
            self._proxy = None
            self._proxy_auth = None
        else:
            self._proxy = self._proxy_info.proxy
            self._proxy_auth = self._proxy_info.proxy_auth

    # pylint: disable=too-many-locals,too-many-branches,too-many-return-statements 
开发者ID:Snawoot,项目名称:postfix-mta-sts-resolver,代码行数:18,代码来源:resolver.py

示例2: __init__

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def __init__(self, verbosity=0, max_tasks=512):
        """Constructor.

        Args:
            verbosity: set output verbosity: 0 (default) is none, 3 is debug
            max_tasks: the maximum number of tasks asyncio will queue (default 512)
        """
        self.tasks = []
        self.errors = []
        self.fqdn = []
        self.ignore_hosts = []
        asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
        self.loop = asyncio.get_event_loop()
        self.resolver = aiodns.DNSResolver(loop=self.loop, rotate=True)
        self.sem = asyncio.BoundedSemaphore(max_tasks)
        self.max_tasks = max_tasks
        self.verbosity = verbosity
        self.logger = ConsoleLogger(verbosity) 
开发者ID:blark,项目名称:aiodnsbrute,代码行数:20,代码来源:cli.py

示例3: queue_dns_lookups

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def queue_dns_lookups(ips):
    """
    Queue handler for reverse DNS lokups.

    :param ips: A list of IP addresses to queue for PTR lookup.
    :type ips: list
    :return: IP addresses and their respective PTR record
    :rtype: dict
    """
    loop = asyncio.get_event_loop()
    resolver = aiodns.DNSResolver(loop=loop)
    if settings.CUSTOM_DNS_SERVERS and settings.DNS_SERVERS:
        resolver.nameservers = settings.DNS_SERVERS
    queue = asyncio.gather(*(reverse_lookup(resolver, ip) for ip in ips))
    results = loop.run_until_complete(queue)
    return results 
开发者ID:synackray,项目名称:vcenter-netbox-sync,代码行数:18,代码来源:run.py

示例4: check_takeover

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def check_takeover(
        subdomain: str, resolver: aiodns.DNSResolver
) -> Tuple[str, Union[str, None]]:
    """This function asynchronously resolves a domain name"""
    try:
        result = await resolver.query(subdomain, "CNAME")
        domain = tldextract.extract(subdomain)
        domain = f"{domain.domain}.{domain.suffix}"
        result_domain = tldextract.extract(result.cname)
        result_domain = f"{result_domain.domain}.{result_domain.suffix}"
        await check_expiry(result_domain, subdomain, "whois.verisign-grs.com")

        if domain not in result_domain:
            log.debug(
                "%s points to an external domain %s", subdomain, result_domain
            )

        return (subdomain, result.cname, result_domain)
    except aiodns.error.DNSError:
        return (subdomain, None, None) 
开发者ID:JordyZomer,项目名称:autoSubTakeover,代码行数:22,代码来源:command.py

示例5: parse_data

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def parse_data(
        wordlist: str, domainlist: str, nameservers: Union[str, None]
) -> None:
    """This function loads the specified worlist and domainlist and runs the resolve function"""
    with open(wordlist, "r") as file_handler:
        word_list = file_handler.read().splitlines()
    with open(domainlist, "r") as file_handler:
        domain_list = file_handler.read().splitlines()
    if nameservers is None:
        name_servers = None
    else:
        with open(nameservers, "r") as file_handler:
            name_servers = file_handler.read().splitlines()

    resolver = aiodns.DNSResolver(nameservers=name_servers)

    tasks = [
        check_takeover(f"{subdomain}.{domain}", resolver)
        for subdomain in word_list
        for domain in domain_list
    ]

    resolved = await asyncio.gather(*tasks)
    resolved = [x for x in resolved if x[1] is not None]
    log.debug("Domains resolved: %d", len(resolved)) 
开发者ID:JordyZomer,项目名称:autoSubTakeover,代码行数:27,代码来源:command.py

示例6: dns_resolve

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def dns_resolve(self):
        padding_domain = 'www.' + self.domain
        loop = asyncio.new_event_loop()
        asyncio.set_event_loop(loop)
        resolver = aiodns.DNSResolver(loop=loop)
        f = resolver.query(padding_domain, 'A')
        result = loop.run_until_complete(f)
        return result[0].host 
开发者ID:m4yfly,项目名称:butian-src-domains,代码行数:10,代码来源:subdomain_brute.py

示例7: dns_resolve

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def dns_resolve(self):
        padding_domain = 'www.' + self.domain
        # loop = asyncio.get_event_loop()
        loop = asyncio.new_event_loop()
        asyncio.set_event_loop(loop)
        resolver = aiodns.DNSResolver(loop=loop)
        f = resolver.query(padding_domain, 'A')
        result = loop.run_until_complete(f)
        return result[0].host 
开发者ID:FeeiCN,项目名称:ESD,代码行数:11,代码来源:__init__.py

示例8: __init__

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def __init__(self, *,
                 loop=None,
                 middleware=(),
                 defaults=None,
                 debug=False,
                 dialplan=BaseDialplan(),
                 dns_resolver=aiodns.DNSResolver()
                 ):

        if loop is None:
            loop = asyncio.get_event_loop()

        if defaults:
            self.defaults = {**DEFAULTS, **defaults}
        else:
            self.defaults = DEFAULTS

        self.debug = debug
        self.dns = dns_resolver
        self._finish_callbacks = []
        self._state = {}
        self._dialogs = {}
        self._connectors = {UDP: UDPConnector(self, loop=loop),
                            TCP: TCPConnector(self, loop=loop),
                            WS: WSConnector(self, loop=loop)}
        self._middleware = middleware
        self._tasks = list()

        self.dialplan = dialplan
        self.loop = loop 
开发者ID:Eyepea,项目名称:aiosip,代码行数:32,代码来源:application.py

示例9: prepare_resolvers

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def prepare_resolvers(nameservers, loop=None):
    if not loop:
        loop = asyncio.get_event_loop()

    resolvers = {}
    for name, servers in nameservers.items():
        resolvers[name] = list(
            (server, aiodns.DNSResolver(loop=loop, nameservers=[server]))
            for server in servers
        )

    return resolvers 
开发者ID:andir,项目名称:ipv6.watch,代码行数:14,代码来源:generate.py

示例10: __init__

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def __init__(self, host, port, *, trust_forwarded_for, ssl=None):
        self.host = host
        self.port = port
        self.trust_forwarded_for = trust_forwarded_for
        self.ssl = ssl

        self.loop = asyncio.get_event_loop()
        self.resolver = aiodns.DNSResolver(loop=self.loop)

        self.start_time = time.time()
        self.processed = 0
        self.avg_latency_sec = 0

        # URL: include some basic metadata inside the URL -- mozilla found
        # they needed to do this to allow fast sharding at high data
        # rates. maybe the instance-id and the submission-nonce? (mozilla's
        # metadata is which app, which version of it, which ping type, etc.)
        # -- https://bugzilla.mozilla.org/show_bug.cgi?id=860846 include a
        # version number of course.
        #   POST incoming.sempervirens.whereever.org/1.0/submit/<instance-id>/<submission-nonce>
        #   POST incoming.sempervirens.whereever.org/1.0/opt-out/<instance-id>

        self.app = web.Application(loop=self.loop)
        self.app.router.add("GET", "/", self.root)
        self.app.router.add("POST", "/1.0/submit/{install_id}", self.submit)
        self.app.router.add("POST", "/1.0/opt-out/{install_id}", self.opt_out) 
开发者ID:njsmith,项目名称:sempervirens,代码行数:28,代码来源:server.py

示例11: main

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def main(loop):
    resolver = aiodns.DNSResolver(loop=loop)
    for domain in ('example.com', 'google.com', 'ns', 'test', 'fails'):
        await query(resolver, domain, 'A')
    await query(resolver, 'example.com', 'MX')
    await query(resolver, 'foobar.example.com', 'A')
    await query(resolver, 'testing.com', 'TXT') 
开发者ID:samuelcolvin,项目名称:dnserver,代码行数:9,代码来源:run.py

示例12: __init__

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def __init__(self, loop: Optional[asyncio.AbstractEventLoop]=None,
                 *args: Any, **kwargs: Any) -> None:
        if aiodns is None:
            raise RuntimeError("Resolver requires aiodns library")

        self._loop = get_running_loop(loop)
        self._resolver = aiodns.DNSResolver(*args, loop=loop, **kwargs)

        if not hasattr(self._resolver, 'gethostbyname'):
            # aiodns 1.1 is not available, fallback to DNSResolver.query
            self.resolve = self._resolve_with_query  # type: ignore 
开发者ID:TouwaStar,项目名称:Galaxy_Plugin_Bethesda,代码行数:13,代码来源:resolver.py

示例13: __init__

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def __init__(self, timeout=5, loop=None):
        self._timeout = timeout
        self._loop = loop or asyncio.get_event_loop()
        self._resolver = aiodns.DNSResolver(loop=self._loop) 
开发者ID:constverum,项目名称:ProxyBroker,代码行数:6,代码来源:resolver.py

示例14: __init__

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def __init__(self,nameservers=[],timeout=2,loop=None):
        self.resolver = aiodns.DNSResolver()
        self.loop = loop if loop else asyncio.get_event_loop()
        self.lookup_history = {}
        self.rlookup_history = {}
        if nameservers:
            self.resolver.nameservers = nameservers 
开发者ID:nnewsom,项目名称:webbies,代码行数:9,代码来源:DNSResolver.py

示例15: setUp

# 需要导入模块: import aiodns [as 别名]
# 或者: from aiodns import DNSResolver [as 别名]
def setUp(self):
        self.loop = asyncio.new_event_loop()
        self.addCleanup(self.loop.close)
        self.resolver = aiodns.DNSResolver(loop=self.loop) 
开发者ID:saghul,项目名称:aiodns,代码行数:6,代码来源:tests.py


注:本文中的aiodns.DNSResolver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。