Wireshark – Go Deep
Indeed, Wireshark allows you to inspect your network traffic in-depth. And that may be very useful in testing. It may not be as easy to use as Fiddler, for example (more on this tool in the future), but at the same time it helps you learn about the basics of networking. This is why I would start with Wireshark before moving to other tools.
Easy on Windows systems: just get the 32-bit or 64-bit installer, and follow the wizard (do remember to install WinPcap if you plan to capture on local system).
Linux: use your favorite method.
WinPcap, and tcpdump
These go along with Wireshark like peanut butter and jelly. Both are based on the libpcap packet capture library, and are used with Wireshark to capture the network traffic. WinPcap gets installed with the Windows version of Wireshark by default, tcpdump may require additional installation on OSX or Linux.
Capturing the traffic with WinPcap is pretty much automatic, when you are on Windows. All you have to do is use the
Capture menu. But let me share my favorite, universal way of running tcpdump to capture traffic on Linux or OSX systems:
tcpdump -s0 -i eth0 -w dump.pcap
The options are:
-s0: dump the entire packet, important if you want to inspect the full payload
-i eth0: listen on the eth0 interface only, will work in 80% of the cases
-w dump.pcap: dump the output to the dump.pcap file, you will open this file in Wireshark later
I would typically run tcpdump only for the brief period of time to capture the traffic I am interested in. But if you cannot trigger the specific network event at will – you may have to filter tcpdump further by specifying port, limiting amount of payload captured etc.
After I have captured the data – I would copy it over to my local system with something like scp for further analysis.
Typical Wireshark use case for a tester is better understanding of the application under test by seeing what actually gets sent on the wire. This allows you to increase your knowledge of the application. It may enable you to find interesting bugs, or just become an expert overall.
Another case may be any sort of security testing. For example verifying that all traffic is being sent over secure channel. Or looking for ways to exploit the system.
On top of official documentation, you may want to check out these:
- This short video: disabling relative sequence number and other useful tips to make your debugging painless
- Decrypting SSL and made even easier when you have your browser dump keys for you.
This post is also available in: English