I have pcap files continuously generated to me. It want to continuously feed them to a "ever-running" tshark/wireshark. Here is what I have tried (OSX)
mkfifo tsharkin
tail -f -c +0 tsharkin | tshark -l -i - > tsharkout 2>stderr &
cat file1.pcap > tsharkin
The above works fine, I get expected output from file1.pcap in tsharkout
cat file2.pcap > tsharkin
The above does not work, I get nothing in tsharkout, but I get "1 packet dropped" + "3 packets captured" in stderr
cat file2.pcap > tsharkin
Trying again makes the tail/tshark processes stop/crash
I tried doing it again, but this time with file2.pcap first and then file1.pcap. This time file2.pcap is processed just fine, and file1.pcap is making tail/tshark processes stop/crash. So I will conclude that nothing is wrong with the two pcap-files, but it seems tshark does not like having more than one pcap-file thrown at it.
Just to test it, I tried merging file1.pcap and file2.pcap using mergecap first, and feed that into tshark
mergecap -F pcap -w file1_2.pcap file1.pcap file2.pcap
cat file1_2.pcap > tsharkin
This works fine, I get expected output from both file1.pcap and file2.pcap in tsharkout
Problem is that my pcap-files arrive along the way, so I cannot just merge them all before feeding to tshark. I need to be able to feed the pcap-files as they arrive, to a "ever-running" tshark. How can I do that?