示例#1
0
    def encode_message(self):
        message = b''
        message += self.header.encode_header()

        question = DNSQuestion(self.q_type, self.host_name)
        message += question.encode_question()
        return message
示例#2
0
    def encode_message(self, is_TCP):
        message = b''
        message += self.header.encode_header()

        question = DNSQuestion(self.q_type, self.host_name)
        message += question.encode_question()

        if is_TCP:
            message = struct.pack('!H', len(message)) + message

        return message