This repository has been archived on 2025-07-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
an/doCapture.sh
2024-12-12 16:19:59 +00:00

24 lines
480 B
Bash

#!/usr/bin/env bash
set -e
PORT=$1
FSIZE=$2
OUTPUT_FNAME_TPL="tcpdyn-$PORT-$FSIZE-"
N=$((1 + $(find . -name ${OUTPUT_FNAME_TPL}'*' -type f | wc -l)))
N=$(printf "%03d" $N)
OUTPUT_FNAME="$OUTPUT_FNAME_TPL$N.pcap"
tcpdump -i wlp0s20f3 -n -U -w $OUTPUT_FNAME -n 'host 45.76.35.230 or host 2001:19f0:5001:32f3:5400:3ff:fe07:2a1c' &
TCPDUMP_PID=$!
sleep 0.5
curl -v -m 600 -o /dev/null "http://tcpdynamics.uk:$PORT/$FSIZE" || true
sleep 2
kill -SIGINT $TCPDUMP_PID
fg || true