Network Conversation Heatmap
Tags: wireshark, network, visualization
Published: 2021-06-06 02:07:48

With the rise of dockerized environments and microservices, I find myself regularly using Wireshark to analyze network packets for performance-related issues. And one of the functionality I often use is the conversation view.

The conversation view is a nice way of getting packet summary between different endpoints. Below is an example of it. To keep the anonymity, the full IP addresses are not disclosed.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/us7k2dlqriyeion53uib.png)

The conversation view in Wireshark has all the information you need about the network conversation. As you can see, if there are too many conversations (tcp) captured, it can become a little hard to keep track of them all. Even if you switch to IPv4 view, there are 37 different conversations.

At times, you just want a simple high-level view of all the conversations. Something that will visually shows you the packet flow, total bytes transferred and any anomaly. Plus something simple that can be shared with others without them needing to install Wireshark or a similar tool. And that brings us to the Network Conversation Heatmap.

The [Network Conversation heatmap](https://github.com/hseera/python-utilities/blob/main/network_conversation_flow.py) is a python utility that takes the network trace (pcap/pcapng) and generates a network conversation heatmap. The benefits of the heatmap are:

1. Visually highlights all the IP addresses captured in the trace file.
2. Shows you the total number of sources and destinations and any relationship between them.
3. Highlights the highest bandwidth-consuming conversations. Red signifies a high amount of data transferred between the endpoints, while Green means a less.
4. The total amount of data transfer between the endpoints is also shown. The data is in Bytes.
5. Easy to share the conversation with others to support your findings. Plus not everyone needs to have Wireshark installed to view it.
6. You also get basic insights. Such as # of hosts on the same network communicating to a single destination, one-way communication (for example, workgroup announcement) and system where the trace was captured.

How to interpret the heatmap:

* The y-axis is the source. These are the systems/applications that are sending data to the destinations.
* The x-axis is the destination. These are the systems/applications receiving the data from the sources.
* The color (& legend) signifies total data transmitted between source and destination for the captured session.
* Intersection point of all the traffic is the system where the network trace file was captured from.

Below are some heatmap examples.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uzgwn4zy3jk95ja4htkx.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c01n23pshuvxrowubr2g.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/24j3yqqnvv7mnjwy4fvr.png)

The script also provides an option to visualize data as a graph instead of heatmap too. However it is currently work in progress. If you are interested to help enhance the code, please reach out to me.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e4gxuqaw4xbv1w7jqtyu.png)

**Note:** Time to generate heatmap is dependent on the size of the pcap file.

------------------------------------------------------------------

Thanks for reading!

If you enjoyed this article feel free to share on social media 🙂

Say Hello on: [Linkedin](https://www.linkedin.com/in/harinderseera/) | [Twitter](https://twitter.com/harinderseera) | [Polywork](https://www.polywork.com/harinderseera) 

Blogging: [Dev](https://dev.to/harinderseera) | [Hashnode](https://harinderseera.hashnode.dev/)

Github: [hseera](https://github.com/hseera)