


IP ) : print ( 'Non IP Packet type not supported %s\n' % eth. type ) # Make sure the Ethernet data contains an IP packet if not isinstance (eth. Ethernet (buf ) print ( 'Ethernet Frame: ', mac_addr (eth. utcfromtimestamp (timestamp ) ) ) # Unpack the Ethernet frame (mac src/dst, ethertype)Įth = dpkt. """ # For each packet in the pcap process the contents for timestamp, buf in pcap : # Print out the timestamp in UTC print ( 'Timestamp: ', str (datetime.

AF_INET6, inet ) def print_packets (pcap ) : """Print out information about each packet in a pcap AF_INET, inet ) except ValueError : return socket. """ # First try ipv4 and then ipv6 try : return socket. join ( '%02x' % compat_ord (b ) for b in address ) def inet_to_str (inet ) : """Convert inet object to a string ()ĭef mac_addr (address ) : """Convert a MAC address to a readable/printable stringĪddress (str): a MAC address in hex form (e.g.
