d3babe1252d05f07e58a6602b47e1a09bbd56af5,networkml/parsers/pcap/reader.py,,packetizer,#Any#,67

Before Change



    // Read get the pcap info with tcpdump
    FNULL = open(os.devnull, "w")
    proc = subprocess.Popen(
        ["tshark", "-n", "-T", "json", "-x", "-r", path, "-o", "tcp.desegment_tcp_streams:false"],
        stdout=subprocess.PIPE,
        stderr=FNULL
    )
    packet_dict = OrderedDict()
    buf = ""
    for line in proc.stdout:
        line = line.decode("utf-8")
        if not line.startswith(" "):
            continue
        if line.startswith("  ,"):
            continue
        buf += line
        if line.startswith("  }"):
            parse_buf(buf)
            buf = ""
    return packet_dict


def sessionizer(path, duration=None, threshold_time=None):

After Change


    """

    packet_dict = OrderedDict()
    with pyshark.FileCapture(path, use_json=True, include_raw=True,
            custom_parameters={"-o": "tcp.desegment_tcp_streams:false"}) as cap:
        for packet in cap:
            data = packet.get_raw_packet()
            head = parse_packet_head(packet)
            if head is not None:
                packet_dict[head] = binascii.hexlify(data).decode("utf-8")
    return packet_dict


def sessionizer(path, duration=None, threshold_time=None):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: CyberReboot/NetworkML
Commit Name: d3babe1252d05f07e58a6602b47e1a09bbd56af5
Time: 2019-12-10
Author: josh@vandervecken.com
File Name: networkml/parsers/pcap/reader.py
Class Name:
Method Name: packetizer


Project Name: MTG/freesound
Commit Name: 99a1522f89b93b12917087ae7ae7d910cf0c2cf1
Time: 2018-07-18
Author: phil.tgun@gmail.com
File Name: sounds/models.py
Class Name: Sound
Method Name: compute_crc


Project Name: pantsbuild/pants
Commit Name: 3d7c03ab5a7fcd2459128d9cc849031b28b3f350
Time: 2015-10-12
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/backend/jvm/tasks/test_binary_create_integration.py
Class Name: BinaryCreateIntegrationTest
Method Name: test_deploy_excludes