Convert all pcap file to csv with required columns python

后端 未结 2 806
忘掉有多难
忘掉有多难 2021-01-24 07:01

I need to write all the output CSV files to a different folder. For example if .pcap files were in subfolders Sub1, Sub2. And Sub1

2条回答
  •  渐次进展
    2021-01-24 07:32

    Call tshark, (something like this )

    f_in = 'x.pcap'
    f_out = 'x.csv'
    tshark_template = 'tshark -r {} -T fields -e frame.number -e frame.time -e eth.src -e eth.dst -e ip.src -e ip.dst -e ip.proto -E header=y -E separator=, -E quote=d -E occurrence=f > {}'
    final_tshark_cmd = tshark_template.format(f_in,f_out)
    

    Build the command dynamically using python, so you can control the names of the files.

    Each -e stands for a field that you want to be in the output.

提交回复
热议问题