In: Computer Science
Installation of Tshark
To install the latest version on Ubuntu 16.04 or 17.04 use the following commands to add the package repository.
sudo add-apt-repository ppa:dreibh/ppa
sudo apt-get update && sudo apt-get install wireshark tshark
To capture packets using Tshark, you could do it in two steps
1. capture general traffic of interest using tshark or even dumpcap
it captures all the TCP packets of eth0 interface between the range of ports 10 - 11 and 14 - 22 and lastly stores that result to a file quiz1.pcap.
2. Once Tshark terminates, have Tshark read the exact packets of interest from the capture file and process the packets as you'd like
tshark -r quiz1.pcap -Y "ipp contains 02:00:00" -T pdml > output.xml
Results are shown in the following screenshots. In this result i have used wlp3s0f0 interface and captured packets on some different ports