T-Shark User Guide
Installation
See if tshark is installed.
tshark
apt list tsharkIf it is not installed.
sudo apt install tsharkHelp menu
tshark -hCapture Packets with Tshark
tshark -i wlan0 -w capture-output.pcapReading a File
tshark -r [file-name.cap]When used with
wc -lwe cann see how mnay packets are in a capture
tshark -r [file-name.cap | wc -l]Filters
Tshark filters are different than bpf syntax.
If we are interested in DNS A records only we can use:
dns.qry.type==1Display filters are added with the
-Yswitch.View all DNS A records:
tshark -r [file-name.cap] -Y "dns.qry.type == 1"DNS requests only in a file:
tshark -r [file-name.pcap] -Y "dns.flags.response == 0" | wc -lExtracted data
One way to extract data is using
-Tand-e [field name]switches.Extract the A records in the pcap, we would use
-T fields -e dns.query.name.
tshark -r dns.cap -Y "dns.qry.type == 1" -T fields -e dns.qry.nameAn easy way to identify field names in Wireshark is to navigate to the Packet Details in the capture, highlight the interesting field, then view the bottom left corner.
Queries
See who queried for a particular domain:
tshark -r [file-name.pcap] -T fields -e ip.src -eList all queries
tshark -r [file-name.pcap] -T fields -e ip.src -eLast updated