MCPcopy
hub / github.com/fortra/impacket / decode

Method decode

impacket/ImpactDecoder.py:73–98  ·  view source on GitHub ↗
(self, aBuffer)

Source from the content-addressed store, hash-verified

71 pass
72
73 def decode(self, aBuffer):
74 e = ImpactPacket.Ethernet(aBuffer)
75 self.set_decoded_protocol( e )
76 off = e.get_header_size()
77 if e.get_ether_type() == ImpactPacket.IP.ethertype:
78 self.ip_decoder = IPDecoder()
79 packet = self.ip_decoder.decode(aBuffer[off:])
80 elif e.get_ether_type() == IP6.IP6.ethertype:
81 self.ip6_decoder = IP6Decoder()
82 packet = self.ip6_decoder.decode(aBuffer[off:])
83 elif e.get_ether_type() == ImpactPacket.ARP.ethertype:
84 self.arp_decoder = ARPDecoder()
85 packet = self.arp_decoder.decode(aBuffer[off:])
86 elif e.get_ether_type() == eap.DOT1X_AUTHENTICATION:
87 self.eapol_decoder = EAPOLDecoder()
88 packet = self.eapol_decoder.decode(aBuffer[off:])
89 # LLC ?
90 elif e.get_ether_type() < 1500:
91 self.llc_decoder = LLCDecoder()
92 packet = self.llc_decoder.decode(aBuffer[off:])
93 else:
94 self.data_decoder = DataDecoder()
95 packet = self.data_decoder.decode(aBuffer[off:])
96
97 e.contains(packet)
98 return e
99
100# Linux "cooked" capture encapsulation.
101# Used, for instance, for packets returned by the "any" interface.

Callers

nothing calls this directly

Calls 11

get_header_sizeMethod · 0.95
get_ether_typeMethod · 0.95
IPDecoderClass · 0.85
IP6DecoderClass · 0.85
ARPDecoderClass · 0.85
EAPOLDecoderClass · 0.85
LLCDecoderClass · 0.85
DataDecoderClass · 0.85
set_decoded_protocolMethod · 0.80
decodeMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected