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


Python server.DNSServer方法代码示例

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


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

示例1: main

# 需要导入模块: from dnslib import server [as 别名]
# 或者: from dnslib.server import DNSServer [as 别名]
def main():
    zone = '''
*.{dnsdomain}.       IN      NS      {ns1domain}.
*.{dnsdomain}.       IN      NS      {ns2domain}.
*.{dnsdomain}.       IN      A       {serverip}
{dnsdomain}.       IN      A       {serverip}
'''.format(
        dnsdomain=settings.DNS_DOMAIN, ns1domain=settings.NS1_DOMAIN,
        ns2domain=settings.NS2_DOMAIN, serverip=settings.SERVER_IP)
    resolver = ZoneResolver(zone, True)
    logger = MysqlLogger()
    print("Starting Zone Resolver (%s:%d) [%s]" % ("*", 53, "UDP"))

    udp_server = DNSServer(resolver,
                           port=53,
                           address='',
                           logger=logger)
    udp_server.start() 
开发者ID:shad0w008,项目名称:Scanver,代码行数:20,代码来源:dnslog.py

示例2: main

# 需要导入模块: from dnslib import server [as 别名]
# 或者: from dnslib.server import DNSServer [as 别名]
def main():
    global pkt_handler
    global dns_server

    signal.signal(signal.SIGTERM, exit_handler)

    logging.basicConfig(level=logging.INFO,
                        format='%(asctime)s - %(levelname)-7s - %(threadName)-12s (%(module)-6s.%(funcName)s:%(lineno)d) - %(message)s')
    if DEBUG:
        logger = logging.getLogger()
        logger.setLevel(logging.DEBUG)

    dns_logger = LocalDNSLogger()
    pkt_handler = PacketHandler()
    resolver = BeaconResolver()
    dns_server = DNSServer(resolver, port=PORT, address=ADDR, logger=dns_logger)
    dns_server.start_thread()

    ui = MainMenu()
    ui.cmdloop()

    logging.warning("After cmdloop initialized. Code shouldn't get here so long as MainMenu is running.")
    while dns_server.isAlive():
        time.sleep(1) 
开发者ID:facebookincubator,项目名称:WEASEL,代码行数:26,代码来源:server.py

示例3: start

# 需要导入模块: from dnslib import server [as 别名]
# 或者: from dnslib.server import DNSServer [as 别名]
def start(self):
        if not self.server:
            print(" * Starting DNS server on {}:53".format(self.default_ip))
            try:
                self.server = DNSServer(self.resolver, port=53, address=self.default_ip)
                self.server.start_thread()
            except Exception as e:
                print(" * ERROR: Unable to bind to port 53. DNS server could not start: {}".format(e)) 
开发者ID:AMWA-TV,项目名称:nmos-testing,代码行数:10,代码来源:DNS.py

示例4: run_dns_proxy

# 需要导入模块: from dnslib import server [as 别名]
# 或者: from dnslib.server import DNSServer [as 别名]
def run_dns_proxy(self):
        resolver = HTTPSResolver()
        logger = DNSLogger()

        server = DNSServer(resolver,
                           port=DNS_PORT,
                           address='localhost',
                           logger=logger)

        server.start_thread()
        while self.is_running:
            # this just keeps the thing alive...
            time.sleep(5)
        server.stop() 
开发者ID:robputt796,项目名称:Py-DNS-over-HTTPS-Proxy,代码行数:16,代码来源:__init__.py


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