Пример #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)
Пример #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)
Пример #3
0
 def get_rcode(self):
     return get_bits(self.bitmap,0,4)
Пример #4
0
 def get_ra(self):
     return get_bits(self.bitmap,7)
Пример #5
0
 def get_rd(self):
     return get_bits(self.bitmap,8)
Пример #6
0
 def get_tc(self):
     return get_bits(self.bitmap,9)
Пример #7
0
 def get_aa(self):
     return get_bits(self.bitmap,10)
Пример #8
0
 def get_opcode(self):
     return get_bits(self.bitmap,11,4)
Пример #9
0
 def get_qr(self):
     return get_bits(self.bitmap,15)
Пример #10
0
 def get_rcode(self):
     return get_bits(self.bitmap, 0, 4)
Пример #11
0
 def get_ra(self):
     return get_bits(self.bitmap, 7)
Пример #12
0
 def get_rd(self):
     return get_bits(self.bitmap, 8)
Пример #13
0
 def get_tc(self):
     return get_bits(self.bitmap, 9)
Пример #14
0
 def get_aa(self):
     return get_bits(self.bitmap, 10)
Пример #15
0
 def get_opcode(self):
     return get_bits(self.bitmap, 11, 4)
Пример #16
0
 def get_qr(self):
     return get_bits(self.bitmap, 15)