Exemplo n.º 1
0
    def fragment(self, packet):

        max_frame_size = 1472 if int(self.__port.max_frame_size) > 1472 else \
        int(self.__port.max_frame_size) 
        if (packet.haslayer(Raw) and  max_frame_size < len(packet[Raw].load)) or\
        (packet.haslayer(SNMP) and max_frame_size < len(packet[SNMP])):
            return fragment(packet, max_frame_size)
        else:
            return [packet]
Exemplo n.º 2
0
 def fragment(self, packet):
     max_frame_size = 1472 if self.__port.max_frame_size > 1472 else \
     self.__port.max_frame_size
     # we aren't using packet[UDP].len because if the packet is a SNMP
     # packet, the length we are getting is None !!. Hence this workaroud
     payload_length = len(packet[UDP]) - 8
     if max_frame_size < payload_length:
         return fragment(packet, max_frame_size)
     else:
         return [packet]