def decode(self, aBuffer): t = ImpactPacket.TCP(aBuffer) self.set_decoded_protocol(t) off = t.get_header_size() self.data_decoder = DataDecoder() packet = self.data_decoder.decode(aBuffer[off:]) t.contains(packet) return t
def decode(self, aBuffer): u = ImpactPacket.UDP(aBuffer) self.set_decoded_protocol(u) off = u.get_header_size() self.data_decoder = DataDecoder() packet = self.data_decoder.decode(aBuffer[off:]) u.contains(packet) return u
def decode(self, aBuffer): arp = ImpactPacket.ARP(aBuffer) self.set_decoded_protocol( arp ) off = arp.get_header_size() self.data_decoder = DataDecoder() packet = self.data_decoder.decode(aBuffer[off:]) arp.contains(packet) return arp
def decode(self, aBuffer): ic = ImpactPacket.ICMP(aBuffer) self.set_decoded_protocol(ic) off = ic.get_header_size() if ic.get_icmp_type() == ImpactPacket.ICMP.ICMP_UNREACH: self.ip_decoder = IPDecoderForICMP() packet = self.ip_decoder.decode(aBuffer[off:]) else: self.data_decoder = DataDecoder() packet = self.data_decoder.decode(aBuffer[off:]) ic.contains(packet) return ic
def decode(self, aBuffer): i = ImpactPacket.IP(aBuffer) self.set_decoded_protocol(i) off = i.get_header_size() if i.get_ip_p() == ImpactPacket.UDP.protocol: self.udp_decoder = UDPDecoder() packet = self.udp_decoder.decode(aBuffer[off:]) else: self.data_decoder = DataDecoder() packet = self.data_decoder.decode(aBuffer[off:]) i.contains(packet) return i
def decode(self, aBuffer): t = ImpactPacket.TCP(aBuffer) self.set_decoded_protocol(t) off = t.get_header_size() self.data_decoder = DataDecoder() # Setting limits on the header if off <= 70: packet = self.data_decoder.decode(aBuffer[off:]) else: packet = self.data_decoder.decode(aBuffer[off:70]) t.contains(packet) return t
def decode(self, aBuffer): e = ImpactPacket.LinuxSLL(aBuffer) self.set_decoded_protocol(e) off = 16 if e.get_ether_type() == ImpactPacket.IP.ethertype: self.ip_decoder = IPDecoder() packet = self.ip_decoder.decode(aBuffer[off:]) elif e.get_ether_type() == ImpactPacket.ARP.ethertype: self.arp_decoder = ARPDecoder() packet = self.arp_decoder.decode(aBuffer[off:]) else: self.data_decoder = DataDecoder() packet = self.data_decoder.decode(aBuffer[off:]) e.contains(packet) return e
def decode(self, aBuffer): e = ImpactPacket.Ethernet(aBuffer) self.set_decoded_protocol(e) off = e.get_header_size() if e.get_ether_type() == ImpactPacket.IP.ethertype: self.ip_decoder = IPDecoder() packet = self.ip_decoder.decode(aBuffer[off:]) # elif e.get_ether_type() == ImpactPacket.ARP.ethertype: # self.arp_decoder = ARPDecoder() # packet = self.arp_decoder.decode(aBuffer[off:]) else: self.data_decoder = DataDecoder() packet = self.data_decoder.decode(aBuffer[off:]) e.contains(packet) return e
def decode(self, aBuffer): i = ImpactPacket.IP(aBuffer) self.set_decoded_protocol(i) start = i.get_header_size() end = i.get_ip_len() if i.get_ip_p() == ImpactPacket.UDP.protocol: self.udp_decoder = UDPDecoder() packet = self.udp_decoder.decode(aBuffer[start:end]) elif i.get_ip_p( ) == ImpactPacket.TCP.protocol: # something could be wrong here self.tcp_decoder = TCPDecoder() packet = self.tcp_decoder.decode(aBuffer[start:end]) elif i.get_ip_p() == ImpactPacket.ICMP.protocol: self.icmp_decoder = ICMPDecoder() packet = self.icmp_decoder.decode(aBuffer[start:end]) else: self.data_decoder = DataDecoder() packet = self.data_decoder.decode(aBuffer[start:end]) i.contains(packet) return i
def decode(self, aBuffer): d = ImpactPacket.Data(aBuffer) self.set_decoded_protocol(d) return d