How To Use Wireshark
How To Use Wireshark
Comparitech.com
[email protected]
8th February 2022
TABLE OF CONTENTS
Most users use Wireshark to detect network problems and test their software. As
an open-source project, Wireshark is maintained by a unique team keeping
service standards high.
Install on Windows
Once you’ve downloaded the program you can start the setup process.
During installation, you may be prompted to install WinPcap. It’s important to
install WinPcap as without it you will be unable to capture live network traffic.
Without WinPcap you will only be able to open saved capture files. To install,
simply check the Install WinPcap box.
Let’s look at this in more detail.
Select the installer for your Windows architecture (64-bit or 32-bit) click on the
link to download the package.
Look in your Start menu for the Wireshark icon. Click on it to run the utility.
Install on Mac
To install Wireshark on Mac you first need to download an installer. To do this,
download an installer such as exquartz. Once you’ve done this, open the
Terminal and input the following command:
<% /Applications/Wireshark.app/Contents/Mac0S/Wireshark>
After installing the above supporting software, and downloading the software
for Wireshark, you need to extract it from the tar file.
gzip -d wireshark-1.2-tar.gz
Change to the Wireshark directory and then issue the following commands:
./configure
make
make install
You can now run the Wireshark program on your Unix computer.
Wireshark 'no interfaces found' Error
Explained & Troubleshooting
Firewall errors
Your firewall shouldn’t be blocking Wireshark’s access to the network because
firewalls generally work to prevent external processes from getting onto your
computer not to prevent processes on your computer getting to the network.
However, just in case the problem lies with your computer’s firewall software try
the following test.
Close down Wireshark and turn off your firewall. Open Wireshark again to get it
to look for networks. If it now manages to find the network, the problem lies
with your firewall. Set Wireshark as an exception in your firewall rules and turn
the firewall back on again.
Above all, you need to realize that the problem with visibility of the network is
all down to the data capturing process and not Wireshark. You need to focus
on the health of WinPcap, npcap, or dumpcap rather than Wireshark itself.
When you install the latest version of Wireshark, the installation process will
check for the relevant data capture process that is written to run on your
operating system. If you are prompted to allow the installer to stop, remove,
replace, or install those capture programs, let it. Your problem with Wireshark
may be caused by you missing these messages in the installation wizard and
not allowing the new versions of those programs to be installed. Try uninstalling
the Wireshark program suite, downloading the latest version and installing it
again. Pay attention to the messages about installing supporting software.
Have you experienced problems with Wireshark? Did you manage to find a
solution that is not listed here in this guide? Let the community know about
your solution by leaving a message in the Comments section below.
Once you’ve done these three things, you’re ready to start the capture
process. When you use Wireshark to capture packets, they are displayed in a
human-readable format to make them legible to the user. You can also break
packets down with filters and color-coding if you wish to see more specific
information.
When you first open up Wireshark, you’ll be met by the following launch
screen:
The first thing you need to do is look at the available interfaces to capture. To
do this, select Capture > Options. The “Capture Interfaces” dialog box will then
open as shown below:
Check the box of the interface you want to capture and press the Start button
to start. You can select multiple interfaces if you want to capture data from
multiple sources simultaneously.
On Unix or Linux, the dialog box is shown in a similar style like this:
Footer
Header
You can also start Wireshark by using the following command line:
<¢ wireshark -i eth0 —k>
You can also use the shark fin button on the toolbar as a shortcut to initiate
packet capturing. Once you click this button, Wireshark will start the live
capture process.
If you want to stop capturing, click the red stop button next to the shark fin.
Promiscuous Mode
If you want to develop an overhead view of your network packet transfers,
then you need to activate ‘promiscuous mode’. Promiscuous mode is an
interface mode where Wireshark details every packet it sees. When this mode
is deactivated, you lose transparency over your network and only develop a
limited snapshot of your network (this makes it more difficult to conduct any
analysis).
To activate promiscuous mode, click on the Capture Options dialog box and
click promiscuous mode. In theory, this should show you all the traffic active on
your network. The promiscuous mode box is shown below:
However, this often isn’t the case. Many network interfaces are resistant to
promiscuous mode, so you need to check the Wireshark website for
information on your specific hardware.
On Windows, it’s useful to open Device Manager and check whether you
have your settings configured to reject promiscuous mode. For example:
Footer
Header
(Simply click on network and then make sure that your promiscuous mode
setting are set to Allow All).
If you have your settings set to “reject” promiscuous mode, then you’re going
to limit the number of packets Wireshark captures. So even if you have
promiscuous mode enabled on Wireshark check your Device Manager to
make sure that your interface isn’t blocking any data from coming through.
Taking the time to check through your network infrastructure will ensure
Wireshark receives all the necessary packets of data.
How to Analyze Captured Packets
Once you’ve captured your network data, you’ll want to look at your captured
packets. In the screenshot below you’ll see three panes, the packet list pane,
the packet bytes pane, and the packet details pane.
If you want more information, you can click on any of the fields in each
packet to see more. When you click on a packet, you’re shown a breakdown
of its internal bytes in the byte view section.
Packet List
The packet list pane is shown at the top of the screenshot. Each piece is
broken down to a number with time, source, destination, protocol and support
information.
Packet Details
Packet details can be found in the middle, showing the protocols of the
chosen packet. You can expand each section by clicking on the arrow next to
your row of choice. You can also apply additional filters by right-clicking on the
chosen item.
Packet Bytes
The packet bytes pane is shown at the bottom of the page. This pane shows
the internal data of your selected packet. If you highlight part of the data in
this section, its corresponding information is also highlighted in the packet
details pane. By default, all data is shown in hexadecimal format. If you want
to change it to bit format, right-click the pane and select this option from the
context menu.
If you want to use Wireshark to inspect your network and analyze all active
traffic, then you need to close down all active applications on your network.
This will reduce traffic to a minimum so you can see what is happening on your
network more clearly. However, even if you turn off all of your applications,
you’ll still have a mass of packets being sent and received.
Using Wireshark to filter these packets is the best way to take stock of your
network data. When your connection is active, thousands of packets are
transferring through your network every second. This means it’s vital that you
filter out the information you don’t need to get a clear picture of what’s going
on.
Capture Filters and Display Filters
Capture Filters and Display Filters are two types of distinct filters that can be
used on Wireshark.
Capture Filters and Display Filters are two types of distinct filters that can be
used on Wireshark. Capture Filters are used to reduce the size of incoming
packet capture, essentially filtering out other packets during live packet
capturing. As a result, capture filters are set before you begin the live capture
process.
Capture Filters are used to reduce the size of incoming packet capture,
essentially filtering out other packets during live the packet capturing. As a
result, capture filters are set before you begin the live capture process.
Capture Filters can’t be modified once a capture has been started. On the
other hand, Display Filters can be used to filter data that has already been
recorded. Capture Filters determine what data you capture from live network
monitoring, and Display Filters dictate the data you see when looking through
previously captured packets.
If you want to start filtering your data, one of the easiest ways to do this is to
use the filter box below the toolbar. For example, if you type in HTTP in the filter
box, you will be provided with a list of all HTTP packets captured. When you
start typing, you’ll be met with an autocomplete field. The filter box is shown
below:
You can use hundreds of different filters to break down your packet
information, from 104apci to zvt. An extensive list can be found on the
Wireshark website here. You can also choose a filter by clicking on the
bookmark icon to the left of the entry field. This will raise a menu of popular
filters.
If you choose to set a capture filter, then your changes will come into effect
once you start recording live network traffic. To activate a display filter, simply
click on the arrow to the right of the entry field. Alternatively, you can click
Analyze > Display Filters and choose a filter from the list of defaults.
After choosing a filter, you can view the TCP conversation behind a packet. To
do this, right click on the packet and click Follow > TCP stream. This will show
you the TCP exchange between the client and server.
If you want more information about Wireshark filtering, Wireshark’s guide to
display filters is a good point of reference.
Using Color Coding
In addition to filtering which packets are shown or recorded, Wireshark’s color-
coding facility makes it easier for the user to identify different packet types
according to their color. For example, TCP traffic is denoted by light purple and
UDP traffic is denoted by light blue. It’s important to note that black is used to
highlight packets with errors.
On Wireshark’s default settings, there are around 20 colors you can choose
from. You may edit, disable or delete these. If you want to turn off colorization,
click on the View menu and click Colorize Packet List field to turn it off. If you’d
like to view more information about the color-coding on Wireshark, click View
>Coloring Rules.
Viewing Network Statistics
To view more information on your network, the statistics drop-down menu is
incredibly useful. The statistics menu can be located at the top of the screen
and will provide you with several metrics from size and timing information to
plotted charts and graphs. You can also apply display filters to these statistics to
narrow down important information.
The Wireshark statistics menu is shown below:
In this menu are a variety of options to help you break down your network
information.
Statistics Menu Selections
Here are some of the core sections:
Protocol Hierarchy – The Protocol Hierarchy option raises a window with a complete
table of all captured protocols. Active display filters are also displayed at the bottom.
Conversations – Reveals the network conversation between two endpoints (For example
exchange of traffic from one IP address to another).
Endpoints – Displays a list of endpoints (a network endpoint is where protocol traffic of a
specific protocol layer ends).
IO Graphs – Displays user-specific graphs, visualizing the number of packets throughout
the data exchange.
RTP_statistics – Allows the user to save the content of an RTP audio stream directly to an
Au-file.
Service Response Time – Displays the response time between a request and the
network’s response.
TcpPduTime – Displays the time taken to transfer data from a Protocol Data Unit. Can be
used to find TCP retransmissions.
VoIP_Calls – Shows VoIP calls obtained from live captures.
Multicast Stream – Detects multicast streams and measures the size of bursts and the
output buffers of certain speeds.
If you’ve ever tried using Wireshark to monitor web traffic, you’ve probably run
into a problem – a lot of it is encrypted transmissions. In fact, most sites are
using SSL or Transport Layer Security (TLS) encryption to keep their users safe.
Ubiquitous encryption is a good thing if you’re shopping on Amazon, but it’s a
real pain when you’re trying to administer a network. Here’s how I decrypt SSL
with Wireshark.
When you’re finished, you’ll be able to decrypt SSL and TLS sessions in Wireshark
without needing access to the target server.
Set a Windows environment variable
In Windows systems, you’ll need to set an environment variable using the
Advanced system settings utility. This variable, named SSLKEYLOGFILE, contains
a path where the pre-master secret keys are stored.
Start by right-clicking on My Computer, and selecting Properties from the
menu. The System menu will open.
Next, click Advanced system settings on the list to the left. The System
Properties window will open.
On the Advanced tab, click the Environment Variables button.
Click the New… button under User variables. You can also create the variable
under System variables if you’d like to log SSL keys for every user on the system,
but I prefer to keep it confined to my profile.
In the Variable value field, type a path to the log file. You can also click the
Browse file… button and specify the path using the file picker.
As a note, if you’re creating this as a system-wide environment variable, you’ll
need to use appropriate wildcards or store the file in a place accessible by all
users. For instance, you might choose %USERPROFILE%\App Data\ssl-keys.log
or C:\ssl-keys.log.
Once you’ve finished, click OK and move to the next set of steps.
Open Launchpad, click Other, and launch a terminal to run this command in
Mac OSX:
nano ~/.bash_profile
The following steps are the same for both operating systems.
At the end of the file, add this line:
export SSLKEYLOGFILE=~/.ssl-key.log
Close the terminal window and open another to set the variable, then type the
following to confirm it’s been set successfully:
echo $SSLKEYLOGFILE
After you execute the command, you should see output similar to the image
above. /Users/comparitech/.ssl-key.log is the full path to my SSL pre-master
key log. Note: You’ll want to make a note of yours, which will be different, to
enter in Wireshark.
Now that the variable has been set, you can move on to the next set of steps.
Launch your browser and check for the log file
Before you launch Wireshark and configure it to decrypt SSL using a pre-master
key, you should start your browser and confirm that the log file is being used.
In order to populate the log, it’s important that you visit a site that has SSL
enabled. I’m using my own Apache server for testing, but any site will work.
One of the biggest benefits of using a pre-master shared key is you don’t need
access to the server to decrypt SSL.
After you’ve visited a SSL-enabled website, check the file for data. In Windows,
you can use Notepad. In Linux or Mac, use the following command:
cat ~/.ssl-log.key
On any operating system, your file should look like mine does above. After
you’ve confirmed that your browser is logging pre-master keys in the location
you selected, you can configure Wireshark to use those keys to decrypt SSL.
Configure Wireshark to decrypt SSL
Once your browser is logging pre-master keys, it’s time to configure Wireshark
to use those logs to decrypt SSL.
Open Wireshark and click Edit, then Preferences. The Preferences dialog will
open, and on the left, you’ll see a list of items. Expand Protocols, scroll down,
then click SSL.
In the list of options for the SSL protocol, you’ll see an entry for (Pre)-Master-
Secret log filename. Browse to the log file you set up in the previous step, or just
paste the path.
When you’ve finished setting the (Pre)-Master-Secret log filename, click OK
and return to Wireshark. You’re ready to move on.
Capture the session and decrypt SSL
The final step is to capture a test session and make sure that Wireshark decrypts
SSL successfully.
Start an unfiltered capture session, minimize it, and open your browser.
Visit a secure site in order to generate data, and optionally set a display filter of ‘ssl’ to
minimize the session noise.
Click on any frame containing encrypted data.
In my case, I’ll select one that contains HTTP traffic with text/HTML encoding,
since I’d like to see the source code the web server is sending to my browser.
But any encrypted transmissions that use a pre-master secret or private key will
work with this method. That includes all data utilizing Perfect Forward
Encryption (PFE) through Diffie-Hellman or comparable key exchanges.
Once you’ve selected an encrypted data frame, look at the Packet byte view,
and specifically the tabs underneath the view. You should see an entry for
Decrypted SSL data, among others.
You’ll notice that my session still looks like it’s full of garbage, and no HTML is
visible. That’s because my web server (and most Apache servers) use GZIP
compression by default.
When you click the Uncompressed entity body tab, which only shows up in this
case with SSL decryption enabled, you can view the source code of the site.
For instance, here’s the title element of the default Apache page in plaintext.
The reason decrypting SSL with an RSA key isn’t commonly used anymore is
that Perfect Forward Encryption (PFE) has made it obsolete. Sessions
negotiated with Diffie-Hellman don’t use the RSA key directly; instead they
generate a one-time key, stored only in RAM, that is encrypted using the key
on disk.
If you were previously using an RSA key to decode traffic, and it stopped
working, you can confirm that the target machine is using Diffie-Hellman
exchanges by enabling SSL logging.
To turn on logging, click Edit from the toolbar menu and select Preferences.
Expand the Protocols menu item on the left and scroll down to SSL. From here,
you can click the Browse button and set the location of your SSL log.
Once the location is set, all SSL interactions will be logged in the specified file.
Capture a session with your SSL-enabled host, then check the logs. Specifically,
you should scroll until you find the frame that the TLS handshake was
negotiated on. It’s likely that you’ll see a telltale DHE entry in the cipher string.
That means Diffie-Hellman key exchanges are enabled. In my case, Apache is
specifically using Diffie-Hellman with elliptic-curve keys, which is denoted by
the string ECDHE.
Scroll a little further and you’re likely to see that the master secret cannot be
found.
If your logs look like that, and you can’t decrypt data using an RSA key, you
have no choice but to switch over to the pre-master secret method above.
Since PFE is becoming standard practice, with TLSv1.3 likely forcing the issue,
simple RSA key decryption is deprecated and should not be used.
The data field at the bottom of the main Wireshark page will show the
decrypted contents of the packet.
setup the Wireless interface to capture all traffic it can receive (Unix/Linux only)
Filter Types
Filter packets during capture
Miscellaneous Items
Logical Operators
All the conditions should match
exclusive alternation – Only one of the two conditions should match not both
Keyboard Shortcuts
Keyboard Shortcuts – main display window
Move between screen elements, e.g. from the toolbars to the packet list to the
packet detail.
In the packet detail, opens the selected tree item and all of its subtrees.
Move to the next packet, even if the packet list isn’t focused.
In the packet detail, opens all tree items.
Move to the previous packet, even if the packet list isn’t focused.
!(ip.addr == 10.10.50.1)
ip.addr == 10.10.50.1/24
tcp.flags.syn == 1
wlan.fc.type_subtype = 0x08
eth.dst == ff:ff:ff:ff:ff:ff
WiresharkMulticast filter
eth.addr == 00:70:f4:23:18:c4
Main Toolbar Items
Uses the same packet capturing options as the previous session, or uses
defaults if no options were set
Although Wireshark is a great packet sniffer, it isn’t the be-all and end-all of
network analysis tools. You can expand Wireshark and support it with
complementary tools. A wide community of supporting plugins and platforms
can enhance Wireshark’s capabilities.
Try out these Wireshark additions to improve your analytical capabilities:
Elastic Stack with Wireshark Use Wireshark as a feed to Elasticsearch and its related data
management modules to create a better analysis environment than Wireshark provides
by itself. The Elastic Stack products are free to use.
NetworkMiner is another analytical tool that acts on feeds from Wireshark. This tool
comes in both a free and paid version.
Show Traffic displays live traffic data, identifying packets by protocol.