API Documentation

class pcap2csv.pcap2csv.Pcap2csv(pcapfile, outdir, metadatafile=None)[source]

class to make csv from pcap file

__init__(pcapfile, outdir, metadatafile=None)[source]
Parameters
  • pcapfile (str) – pcap file to convert

  • outdir (str) – output directory to save csv files

  • metadatafile (str) – metadata json file with experiment description

makecsvs()[source]

calls the Capture class for packet processing and writes csv

class pcap2csv.pcap2csvutils.Pcap2csvutils[source]

utilities usefuls for users of pcap2csv

__init__()[source]
pdus_from_pkts(pkts_df)[source]

generates a pandas dataframe of pdus from processed dataframe of packets that have already been labeled with correct pdu_idx using the trafficdatasetextractor tool.

Parameters

pkts_df (pandas.DataFrame) – packets dataframe to convert to pdus

Returns

dataframe of pdus

Return type

pandas.DataFrame

module for class packet __all__ = [‘capture’, ‘packet’, ‘gen_tcp’, ‘session’, ‘application’, ‘gen_udp’, ‘lab_netutils’]

class pcap2csv.capture.Capture(pcap_file, begin_time=None)[source]

class extracts packet headers and data into a list of dict

__init__(pcap_file, begin_time=None)[source]
Parameters
  • pcap_file (str) – pcap file to convert

  • begin_time (int, optional) – epochtime used in logs to calculate time elapsed in processing

processPcap()[source]

controls L2-4 header decoding process for each packet buffer