What is Wireshark

Wireshark is an open-source network protocol analysis software program started by Gerald Combs in 1998. A global organization of network specialists and software developers supports Wireshark and continues to make updates for new network technologies and encryption methods.

Wireshark is absolutely safe to use. Government agencies, corporations, non-profits, and educational institutions use Wireshark for troubleshooting and teaching purposes. There isn’t a better way to learn networking than to look at the traffic under the Wireshark microscope.

There are questions about the legality of Wireshark since it is a powerful packet sniffer. The Light Side of the Force says that you should only use Wireshark on networks where you have permission to inspect network packets. Using Wireshark to look at packets without permission is a path to the Dark Side.

How does Wireshark work? #

Wireshark is a packet sniffer and analysis tool. Records network traffic to a local network and stores that data for offline analysis. Wireshark captures network traffic from Ethernet, Bluetooth, Wireless (IEEE.802.11), Token Ring, Frame Relay links, and more.

Ed. Note: “Package” is a single message from any network protocol (i.e., TCP, DNS, etc.)

Ed. Note 2: LAN traffic is in streaming mode, which means that one computer with Wireshark can detect traffic between two other computers. If you want to see traffic to an external site, you need to download the packets to a local computer.

Wireshark allows you to filter the log before the start of the recording or during the analysis, so you can slow down and get to zero of what you want in-network tracking. For example, you can set a filter to see TCP traffic between two IP addresses. You can only set it to show you packets sent from one computer. Filters in Wireshark are one of the main reasons it has become a standard tool for package analysis.

How to Download Wireshark #

Downloading and installing Wireshark is easy. Step one is to check the official Wireshark Download page for the operating system you need. The basic version of Wireshark is free.

Wireshark for Windows #

Wireshark comes with two Windows flavors, 32 bit and 64 bit. Select the appropriate version for your OS. The current release is 3.0.3 from this writing. Installation is easy and should not cause problems.

Wireshark for Mac #

Wireshark is available on Mac as a Homebrew install.

To install Homebrew, you need to run this command at your terminal prompt:

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Once you have the Homebrew system in place, you can access several open-source projects for your Mac. To install Wireshark run this command from the Terminal:

brew install wireshark

Homebrew will download and install Wireshark and any dependencies so it will run correctly.

Wireshark for Linux #

Installing Wireshark on Linux can be a little different depending on the Linux distribution. If you aren’t running one of the following distros, please double-check the commands.

Ubuntu

From a terminal prompt, run these commands:

  1. sudo apt-get install wireshark
  2. sudo dpkg-reconfigure wireshark-common
  3. sudo adduser $USER wireshark

Those commands download the package, update the package, and add user privileges to run Wireshark.

Red Hat Fedora

From a terminal prompt, run these commands:

  1. sudo dnf install wireshark-qt
  2. sudo usermod -a -G wireshark username

The first command installs the GUI and CLI version of Wireshark, and the second adds permissions to use Wireshark.

Kali Linux

Wireshark is probably already installed! It’s part of the basic package. Check your menu to verify. It’s under the menu option “Sniffing & Spoofing.”

Data Packets on Wireshark #

Now that we have Wireshark installed let’s go over how to enable the Wireshark packet sniffer and then analyze the network traffic.

Capturing Data Packets on Wireshark #

When you open Wireshark, you see a screen that shows you a list of all of the network connections you can monitor. You also have a capture filter field, so you only capture the network traffic you want to see.

You can select one or more of the network interfaces using “shift left-click.” Once you have the network interface selected, you can start the capture, and there are several ways to do that.

Click the first button on the toolbar, titled “Start Capturing Packets.”

You can select the menu item Capture -> Start.

Or you could use the keystroke Control – E.

During the capture, Wireshark will show you the packets that it captures in real-time.

Once you have captured all the packets you need, you use the same buttons or menu options to stop the capture.

Best practice says that you should stop Wireshark packet capture before you do analysis.

Analyzing Data Packets on Wireshark #

Wireshark shows you three different panes for inspecting packet data. The Packet List, the top pane, is a list of all the packets in the capture. When you click on a packet, the other two panes change to show you the details about the selected packet. You can also tell if the packet is part of a conversation. Here are some details about each column in the top pane:

  • No.: This is the number order of the packet that got captured. The bracket indicates that this packet is part of a conversation.
  • Time: This column shows you how long after you started the capture that this packet got captured. You can change this value in the Settings menu if you need something different displayed.
  • Source: This is the address of the system that sent the packet.
  • Destination: This is the address of the destination of that packet.
  • Protocol: This is the type of packet, for example, TCP, DNS, DHCPv6, or ARP.
  • Length: This column shows you the length of the packet in bytes.
  • Info: This column shows you more information about the packet contents, and will vary depending on what kind of packet it is.

Packet Details, the middle pane, shows you as much readable information about the packet as possible, depending on what kind of packet it is. You can right-click and create filters based on the highlighted text in this field.

The bottom pane, Packet Bytes, displays the packet exactly as it got captured in hexadecimal.

When you are looking at a packet that is part of a conversation, you can right-click the packet and select Follow to see only the packets that are part of that conversation.

Wireshark Filters #

One of the best features of Wireshark is the Wireshark Capture Filters and Wireshark Display Filters. Filters allow you to view the capture the way you need to see it so you can troubleshoot the issues at hand. Here are several filters to get you started.

Wireshark Capture Filters #

Capture filters limit the captured packets by the filter. Meaning if the packets don’t match the filter, Wireshark won’t save them. Here are some examples of capture filters:

host IP-address: this filter limits the capture to traffic to and from the IP address

net 192.168.0.0/24: this filter captures all traffic on the subnet.

dst host IP-address: capture packets sent to the specified host.

port 53: capture traffic on port 53 only.

port not 53 and not arp: capture all traffic except DNS and ARP traffic

Wireshark Display Filters #

The Wireshark Display filters change the view of the scanner during analysis. After you stop packing a scan, you use display filters to minimize Packet List packs so you can solve your problem.

The most useful display filter (in my experience) says:

ip.src == IP-address and ip.dst == IP-address

This filter shows you packets from one computer (ip.src) to another (ip.dst). You can also use ip.addr to show you packets to or from that IP. Here are some:

tcp.port eq 25: This filter will show you all the traffic in port 25, which is usually SMTP traffic.

icmp: This filter will show you ICMP traffic only in photography, probably pings.

ip.addr! = IP_address: This filter shows you all traffic except traffic to or from a particular computer.

Analysts even create filters to detect specific attacks, such as this filter to detect Sasser worms:

ls_ads.opnum == 0x09

Additional Wireshark Features #

Beyond the capture and filtering, there are several other features in Wireshark that can make your life better.

Wireshark Colorization Options #

You can setup Wireshark so it colors your packets in the Packet List according to the display filter, which allows you to emphasize the packets you want to highlight. 

Wireshark Promiscuous Mode #

By default, Wireshark only captures packets going to and from the computer where it runs. By checking the box to run Wireshark in Promiscuous Mode in the Capture Settings, you can capture most of the traffic on the LAN.

Wireshark Commands #

  • wireshark : run Wireshark in GUI mode
  • wireshark –h : show available command line parameters for Wireshark
  • wireshark –a duration:300 –i eth1 –w wireshark. : capture traffic on the Ethernet interface 1 for 5 minutes. –a means automatically stop the capture, -i specifics which interface to capture

Metrics and Statistics #

Under the Statistics menu item, you will find a plethora of options to show details about your capture

Capture File Properties:

Wireshark I/O Graph:

Leave a Reply

Your email address will not be published.