utils/pcap_parser.py
def parse_ethernet(pkt_bytes):
    """Parse the Ethernet header out of the given bytes."""
    total_len = 14
    eth = {}
    if len(pkt_bytes) < total_len:
        eprint("ERROR: not enough bytes to parse Ethernet header")
        return eth, pkt_bytes
    eth['dstHi'] = struct.unpack(">L", '\x00' + pkt_bytes[0:3])[0]
    eth['dstLow'] = struct.unpack(">L", '\x00' + pkt_bytes[3:6])[0]
    eth['srcHi'] = struct.unpack(">L", '\x00' + pkt_bytes[6:9])[0]
    eth['srcLow'] = struct.unpack(">L", '\x00' + pkt_bytes[9:12])[0]
    eth['type'] = struct.unpack(">H", pkt_bytes[12:14])[0]
    return eth, pkt_bytes[total_len:]
Parse the Ethernet header out of the given bytes.
Parse the Ethernet header out of the given bytes.
Parse the Ethernet header out of the given bytes .
def parse_ethernet(pkt_bytes):
    total_len = 14
    eth = {}
    if len(pkt_bytes) < total_len:
        eprint("ERROR: not enough bytes to parse Ethernet header")
        return eth, pkt_bytes
    eth['dstHi'] = struct.unpack(">L", '\x00' + pkt_bytes[0:3])[0]
    eth['dstLow'] = struct.unpack(">L", '\x00' + pkt_bytes[3:6])[0]
    eth['srcHi'] = struct.unpack(">L", '\x00' + pkt_bytes[6:9])[0]
    eth['srcLow'] = struct.unpack(">L", '\x00' + pkt_bytes[9:12])[0]
    eth['type'] = struct.unpack(">H", pkt_bytes[12:14])[0]
    return eth, pkt_bytes[total_len:]
def parse_ethernet ( pkt_bytes ) : total_len = 14 eth = { } if len ( pkt_bytes ) < total_len : eprint ( "ERROR: not enough bytes to parse Ethernet header" ) return eth , pkt_bytes eth [ 'dstHi' ] = struct . unpack ( ">L" , '\x00' + pkt_bytes [ 0 : 3 ] ) [ 0 ] eth [ 'dstLow' ] = struct . unpack ( ">L" , '\x00' + pkt_bytes [ 3 : 6 ] ) [ 0 ] eth [ 'srcHi' ] = struct . unpack ( ">L" , '\x00' + pkt_bytes [ 6 : 9 ] ) [ 0 ] eth [ 'srcLow' ] = struct . unpack ( ">L" , '\x00' + pkt_bytes [ 9 : 12 ] ) [ 0 ] eth [ 'type' ] = struct . unpack ( ">H" , pkt_bytes [ 12 : 14 ] ) [ 0 ] return eth , pkt_bytes [ total_len : ]
Parse the Ethernet header out of the given bytes.
Parse the Ethernet header out of the given bytes .
"""Parse the Ethernet header out of the given bytes."""
pkt_bytes