1
2
3 """Linux libpcap "cooked" capture encapsulation."""
4
5 import arp, dpkt, ethernet
6
7 -class SLL(dpkt.Packet):
8 __hdr__ = (
9 ('type', 'H', 0),
10 ('hrd', 'H', arp.ARP_HRD_ETH),
11 ('hlen', 'H', 6),
12 ('hdr', '8s', ''),
13 ('ethtype', 'H', ethernet.ETH_TYPE_IP),
14 )
15 _typesw = ethernet.Ethernet._typesw
16
18 dpkt.Packet.unpack(self, buf)
19 try:
20 self.data = self._typesw[self.ethtype](self.data)
21 setattr(self, self.data.__class__.__name__.lower(), self.data)
22 except (KeyError, dpkt.UnpackError):
23 pass
24