#!/bin/bash
# Usage: ./extract_udp_hex.sh input.pcap output.txt

if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <input.pcap> <output.txt>"
    exit 1
fi

INPUT="$1"
OUTPUT="$2"

# Extract UDP payloads as hex, one per line
tshark -r "$INPUT" -Y "udp" -T fields -e data > "$OUTPUT"

echo "UDP hex streams written to $OUTPUT"