Wireshark

Introduction

Wireshark is a traffic analyser program for Ethernet computer networks and some others. It has a graphical user interface. Initially the project was called Ethereal, but because of trademark problems in June 2006 the project was renamed to Wireshark.

The functionality that Wireshark provides is very similar to the capabilities of the tcpdump program, however Wireshark has a graphical user interface and far more options for sorting and filtering information.

The program allows the user to view all the traffic passing over the network in real time, by putting the network card into an indiscriminate mode (English: promiscuous mode).

The program is distributed under the free GNU GPL licence and uses the cross-platform Qt library to build its graphical interface.

There are versions for most UNIX-like systems, including GNU/Linux , Solaris, FreeBSD , NetBSD, OpenBSD , macOS, as well as for Windows .

Wireshark is an application that knows the structure of a wide variety of network protocols, and therefore allows a network packet to be parsed, showing the value of each protocol field of any layer.

Since pcap is used to capture packets, it is possible to capture data only from those networks that are supported by this library. Nevertheless, Wireshark can work with many input data formats, so you can open data files captured by other programs, which extends the capture capabilities. To extend the capabilities of the program, the Lua scripting language can be used.

Installing Wireshark

For details on installing WireShark, read here

Monitoring a specific port

If I want to monitor my Thrift server on port 9090, the filter will look like this

tcp.port eq 9090

Filter by protocol

Example - FTP

The task is to check whether the developer removed the outdated FTP polling.

Checking the logs does not suit us, because the developer could have deleted the log entry but forgotten to remove the polling itself

Therefore we need to check the actual data exchange, for which Wireshark is perfect.

We start Wireshark. We apply the filter ftp-data. We start the client. We carefully watch which messages Wireshark captures

Wireshark example of the ftp-data filter 
        image from the site www.aredel.com Wireshark example of the ftp-data filter 
        image from the site www.aredel.com

We shut down the old client. We delete the database if it is shared. We restart Wireshark. We apply the filter ftp-data. We carefully watch which messages Wireshark captures

Wireshark example of the ftp-data filter 
    image from the site www.aredel.com
Example of the ftp-data filter

It is clear that no packets were sent over ftp. Everything is quiet. We accept the work. We accept the story.

Compound filters in Wireshark

It is often necessary to apply several conditions at once. Logical operators are provided for this case

and && «AND»
or|| «OR»
xor^^ exclusive «OR»
not! negation
[…][…] substring selection

Save the filter

So that you do not have to write the filtering conditions every time, a manually entered filter can be saved.

To do this, in the "Filter" toolbar you need to click the bookmark icon and choose

Save this filter

Exchange between specific hosts

If we are interested only in the data exchange between two specific hosts, we use the filters ip.src to set the source address and ip.dst to set the destination address.

Suppose we are interested in what 10.6.1.2 sends to 10.6.1.3

We use the filter

ip.src==10.6.1.2 and ip.dst==10.6.1.3

If you need to specify subnet masks: ip.src==10.6.1.2/4 and ip.dst==10.6.1.3/4

By setting an additional condition you can monitor traffic exchange only over a specific protocol

ip.src==10.6.1.2 and ip.dst==10.6.1.3 and ftp

If you are interested in traffic over several protocols, you can list them with the condition or

ip.src==10.6.1.2 and ip.dst==10.6.1.3 and (ftp or smb2)

If you need traffic in both directions

(ip.src==10.6.1.2 or ip.src==10.6.1.3) and (ip.dst==10.6.1.3 or ip.dst==10.6.1.2) and (ftp or smb2)

Time

By default time is counted from the moment the first packet is received. It looks approximately as follows:

100.123456

If you need to change the time display format, this is done through

View → Time Display Format

If you choose the Data and Time of Day option, the time will look in the following original way

2026-11-23 19:14:11.200944

Article author: Andrei Olegovich

Banner image