Ask Your Question
0

How to shrink size of captured packets in multiple files?

asked 2023-10-19 12:48:51 +0000

Dmitriy gravatar image

Hello colleagues. I've setup dumpcap with ring buffer options and now i have around 20 files and 2Gb in total. I know how I can merge all files into 1, but it's too heavy to work with 2Gb file using filters and so on. I know, that from many packets in those files I need only specific tcp.stream. My question is, how can i get file with one tcp.stream only?

Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2023-10-19 17:35:51 +0000

Chuckc gravatar image

If you know the stream you want:
C:\>mergecap -w - *018152* | tshark -r - -w 231019_stream_2.pcapng tcp.stream==2

Or you could write a script to build a file per tcp.stream:

#!/bin/bash

for TCP_STREAM in `mergecap.exe -w - *018152* | tshark.exe -r - -T fields -e tcp.stream -Y tcp.stream | sort -n | uniq`
do
    TCP_STREAM=`echo $TCP_STREAM | tr -d "\r\n"`
    OUTFILE="211019_stream_${TCP_STREAM}.pcapng"

    mergecap.exe -w - *018152* | tshark.exe -r - -w ${OUTFILE} tcp.stream==${TCP_STREAM}
done
edit flag offensive delete link more

Comments

Thank you so much for your answer, this really help me a lot.

Dmitriy gravatar imageDmitriy ( 2023-10-25 15:23:06 +0000 )edit
0

answered 2023-10-20 15:41:36 +0000

Yardvark gravatar image

Chris Greer did an interview/video where at the end he covered how he filters and merges a ton of data. Skip to the 1 hour mark for that section specifically.

https://youtu.be/ObUgYDn1zZ0?si=wk2BP...

edit flag offensive delete link more

Comments

Thank you, I spend time to watch that clip, very interesting.

Dmitriy gravatar imageDmitriy ( 2023-10-25 15:23:29 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2023-10-19 12:48:51 +0000

Seen: 195 times

Last updated: Oct 20 '23