예제 #1
0
 def resolve(self, request, handler):
     if request.q.qname in self.blacklist:
         # print(request.q.qname)
         answer = RR(rdata=A(self.host))
         answer.set_rname(self.answer)
         reply = request.reply()
         reply.add_answer(answer)
         # print(reply)
         # print('-' * 200)
         return reply
     else:
         return ProxyResolver.resolve(self, request, handler)
예제 #2
0
    def resolve(self, request, handler):
        print(request.q.qname)

        if request.q.qname in self.blacklist:
            answer = RR(rdata=A(self.host))
            answer.set_rname(self.answer)
            reply = request.reply()
            reply.add_answer(answer)
            print(reply)
            print("-" * 200)
            return reply

        return ProxyResolver.resolve(self, request, handler)