(self, query)
| 181 | |
| 182 | class DNSResponse(object): |
| 183 | def __init__(self, query): |
| 184 | self.id = query.data[:2] # Use the ID from the request. |
| 185 | self.flags = DNSFlag(aa=args.authoritative).pack() |
| 186 | self.questions = query.data[4:6] # Number of questions asked... |
| 187 | # Answer RRs (Answer resource records contained in response) 1 for now. |
| 188 | self.rranswers = b"\x00\x01" |
| 189 | self.rrauthority = b"\x00\x00" # Same but for authority |
| 190 | self.rradditional = b"\x00\x00" # Same but for additionals. |
| 191 | # Include the question section |
| 192 | self.query = _get_question_section(query) |
| 193 | # The pointer to the resource record - seems to always be this value. |
| 194 | self.pointer = b"\xc0\x0c" |
| 195 | # This value is set by the subclass and is defined in TYPE dict. |
| 196 | self.type = None |
| 197 | self.dnsclass = b"\x00\x01" # "IN" class. |
| 198 | # TODO: Make this adjustable - 1 is good for noobs/testers |
| 199 | self.ttl = b"\x00\x00\x00\x01" |
| 200 | # Set by subclass because is variable except in A/AAAA records. |
| 201 | self.length = None |
| 202 | self.data = None # Same as above. |
| 203 | |
| 204 | def make_packet(self): |
| 205 | try: |
nothing calls this directly
no test coverage detected