當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。