utils/pcap_parser.py
def parse_pkt(pkt_bytes):
    """Parse the given packet byte string into a dictionary."""
    pkt = {}
    pkt['Ethernet'], pkt_bytes = parse_ethernet(pkt_bytes)
    if pkt['Ethernet']['type'] == TYPE_IPV4:
        pkt['IPv4'], pkt_bytes = parse_ipv4(pkt_bytes)
        if pkt['IPv4']['proto'] == PROTO_ICMP:
            pkt['ICMP'], pkt_bytes = parse_icmp(pkt_bytes)
        elif pkt['IPv4']['proto'] == PROTO_TCP:
            pkt['TCP'], pkt_bytes = parse_tcp(pkt_bytes)
        elif pkt['IPv4']['proto'] == PROTO_UDP:
            pkt['UDP'], pkt_bytes = parse_udp(pkt_bytes)
    return pkt
Parse the given packet byte string into a dictionary.
Parse the given packet byte string into a dictionary.
Parse the given packet byte string into a dictionary .
def parse_pkt(pkt_bytes):
    pkt = {}
    pkt['Ethernet'], pkt_bytes = parse_ethernet(pkt_bytes)
    if pkt['Ethernet']['type'] == TYPE_IPV4:
        pkt['IPv4'], pkt_bytes = parse_ipv4(pkt_bytes)
        if pkt['IPv4']['proto'] == PROTO_ICMP:
            pkt['ICMP'], pkt_bytes = parse_icmp(pkt_bytes)
        elif pkt['IPv4']['proto'] == PROTO_TCP:
            pkt['TCP'], pkt_bytes = parse_tcp(pkt_bytes)
        elif pkt['IPv4']['proto'] == PROTO_UDP:
            pkt['UDP'], pkt_bytes = parse_udp(pkt_bytes)
    return pkt
def parse_pkt ( pkt_bytes ) : pkt = { } pkt [ 'Ethernet' ] , pkt_bytes = parse_ethernet ( pkt_bytes ) if pkt [ 'Ethernet' ] [ 'type' ] == TYPE_IPV4 : pkt [ 'IPv4' ] , pkt_bytes = parse_ipv4 ( pkt_bytes ) if pkt [ 'IPv4' ] [ 'proto' ] == PROTO_ICMP : pkt [ 'ICMP' ] , pkt_bytes = parse_icmp ( pkt_bytes ) elif pkt [ 'IPv4' ] [ 'proto' ] == PROTO_TCP : pkt [ 'TCP' ] , pkt_bytes = parse_tcp ( pkt_bytes ) elif pkt [ 'IPv4' ] [ 'proto' ] == PROTO_UDP : pkt [ 'UDP' ] , pkt_bytes = parse_udp ( pkt_bytes ) return pkt
Parse the given packet byte string into a dictionary.
Parse the given packet byte string into a dictionary .
"""Parse the given packet byte string into a dictionary."""
pkt_bytes