First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

How to shrink size of captured packets in multiple files?

  • retag add tags

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.

Dmitriy's avatar
3
Dmitriy
asked 2023-10-19 12:48:51 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

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...

Yardvark's avatar
1
Yardvark
answered 2023-10-20 15:41:36 +0000
edit flag offensive 0 remove flag delete link

Comments

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

Dmitriy's avatar Dmitriy (2023-10-25 15:23:29 +0000) edit
add a comment see more comments
0

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
Chuckc's avatar
3k
Chuckc
answered 2023-10-19 17:35:51 +0000
edit flag offensive 0 remove flag delete link

Comments

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

Dmitriy's avatar Dmitriy (2023-10-25 15:23:06 +0000) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer