MCPcopy Create free account
hub / github.com/TheRook/subbrute / BaseResolver

Class BaseResolver

dnslib/server.py:95–115  ·  view source on GitHub ↗

Base resolver implementation. Provides 'resolve' method which is called by DNSHandler with the decode request (DNSRecord instance) and returns a DNSRecord instance as reply. In most cases you should be able to create a custom resolver by just replacing the

Source from the content-addressed store, hash-verified

93from dnslib import DNSRecord,DNSError,QTYPE,RCODE,RR
94
95class BaseResolver(object):
96 """
97 Base resolver implementation. Provides 'resolve' method which is
98 called by DNSHandler with the decode request (DNSRecord instance)
99 and returns a DNSRecord instance as reply.
100
101 In most cases you should be able to create a custom resolver by
102 just replacing the resolve method with appropriate resolver code for
103 application (see fixedresolver/zoneresolver/shellresolver for
104 examples)
105
106 Note that a single instance is used by all DNSHandler instances so
107 need to consider blocking & thread safety.
108 """
109 def resolve(self,request,handler):
110 """
111 Example resolver - respond to all requests with NXDOMAIN
112 """
113 reply = request.reply()
114 reply.header.rcode = getattr(RCODE,'NXDOMAIN')
115 return reply
116
117class DNSHandler(socketserver.BaseRequestHandler):
118 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected