Beispiel #1
0
 def decode_name(self):
     """
         Decode label at current offset in buffer (following pointers
         to cached elements where necessary)
     """
     label = []
     done = False
     while not done:
         (len,) = self.unpack("!B")
         if get_bits(len,6,2) == 3:
             # Pointer
             self.offset -= 1
             pointer = get_bits(self.unpack("!H")[0],0,14)
             save = self.offset
             self.offset = pointer
             label.extend(self.decode_name().label)
             self.offset = save
             done = True
         else:
             if len > 0:
                 label.append(self.get(len))
             else:
                 done = True
     return DNSLabel(label)
Beispiel #2
0
 def decode_name(self):
     """
         Decode label at current offset in buffer (following pointers
         to cached elements where necessary)
     """
     label = []
     done = False
     while not done:
         (len, ) = self.unpack("!B")
         if get_bits(len, 6, 2) == 3:
             # Pointer
             self.offset -= 1
             pointer = get_bits(self.unpack("!H")[0], 0, 14)
             save = self.offset
             self.offset = pointer
             label.extend(self.decode_name().label)
             self.offset = save
             done = True
         else:
             if len > 0:
                 label.append(self.get(len))
             else:
                 done = True
     return DNSLabel(label)
Beispiel #3
0
 def get_rcode(self):
     return get_bits(self.bitmap,0,4)
Beispiel #4
0
 def get_ra(self):
     return get_bits(self.bitmap,7)
Beispiel #5
0
 def get_rd(self):
     return get_bits(self.bitmap,8)
Beispiel #6
0
 def get_tc(self):
     return get_bits(self.bitmap,9)
Beispiel #7
0
 def get_aa(self):
     return get_bits(self.bitmap,10)
Beispiel #8
0
 def get_opcode(self):
     return get_bits(self.bitmap,11,4)
Beispiel #9
0
 def get_qr(self):
     return get_bits(self.bitmap,15)
Beispiel #10
0
 def get_rcode(self):
     return get_bits(self.bitmap, 0, 4)
Beispiel #11
0
 def get_ra(self):
     return get_bits(self.bitmap, 7)
Beispiel #12
0
 def get_rd(self):
     return get_bits(self.bitmap, 8)
Beispiel #13
0
 def get_tc(self):
     return get_bits(self.bitmap, 9)
Beispiel #14
0
 def get_aa(self):
     return get_bits(self.bitmap, 10)
Beispiel #15
0
 def get_opcode(self):
     return get_bits(self.bitmap, 11, 4)
Beispiel #16
0
 def get_qr(self):
     return get_bits(self.bitmap, 15)