Capturing Traffic Using Wireshark

capturing traffic using wireshark

Capturing Traffic Using Wireshark – Before we move on to exploitation, we’ll use the Wireshark monitoring tool, as well as other tools, to sniff and manipulate traffic to gain useful information from other machines on the local network.

On an internal penetration test, when we’re simulating an insider threat or an attacker who has breached the perimeter, capturing traffic from other systems in the network can give us additional interesting information (perhaps even usernames and passwords) that can help us with exploitation. The trouble is that capturing traffic can produce a massive amount of potentially useful data. Capturing all traffic on just your home network could quickly fill several Wireshark screens, and discovering which traffic is useful for a pentest can be difficult. In this blog, we’ll look at several ways to manipulate a network to get access to traffic we have no business being able to see.

Networking for Capturing Traffic

If you find yourself in a network that uses hubs rather than switches, capturing traffic not intended for your machine will be easy, because when a network hub receives a packet, it rebroadcasts it on all ports, leaving it up to each device to decide whom the packet belongs to. In a hubbed network, capturing other systems’ traffic is as easy as selecting Use promiscuous mode on all interfaces in Wireshark. This tells our Network Interface Controller (NIC) to grab everything it sees, which in a hubbed network will be every packet.

Unlike hubs, switches send traffic only to the intended system, so on a switched network, we won’t be able to view, for example, all the traffic to and from the domain controller without fooling the network into sending us that traffic. Most networks you encounter on pentests will probably be switched networks; even some legacy network hardware that claims to be a hub may have the functionality of a switch.

Virtual networks seem to act like hubs, because all your virtual machines share one physical device. If you capture traffic in promiscuous mode in a virtual network, you may be able to see traffic from every virtual machine as well as the host machine, even if you are using a switch instead of a hub in your environment. To simulate a non-virtualized network, we’ll turn off Use promiscuous mode on all interfaces in Wireshark, which means we will have to work a little harder to capture traffic from our target virtual machines.


Wireshark is a graphical network protocol analyzer that lets us take a deep dive into the individual packets moving around the network. Wireshark can be used to capture Ethernet, wireless, Bluetooth, and many other kinds of traffic. It can decode different protocols that it sees, so you could, for instance, reconstruct the audio of Voice over IP (VoIP) phone calls. Let’s take a look at the basics of using Wireshark to capture and analyze traffic.

Capturing Traffic

Let’s start by using Wireshark to capture traffic on our local network. Start Wireshark in Kali, as shown here. Click through any warnings about using Wireshark as root being dangerous.

[email protected]:~# wireshark

Tell Wireshark to capture on the local network interface (eth0) by selecting Capture4Options, and selecting the eth0 option.  Remember to uncheck the Use promiscuous mode on all interfaces option so that the results will be like those on a physical switched network rather than the VMware network. Exit the Options menu. Finally, click Capture Start to begin the traffic capture.

You should start to see traffic coming in, and you should be able to capture all traffic intended for the Kali machine as well as any broadcast traffic (traffic sent to the entire network).

To illustrate the traffic we can capture in a switched network, let’s start by contacting our Windows XP target from our Kali machine over FTP. Log in as anonymous, to see the captured traffic in Wireshark. (In the previous chapter, we discovered that the anonymous user is allowed on the Windows XP target. Although anonymous requires that you enter a password, it doesn’t matter what it is. Traditionally, it is an email address, but the FTP server will accept whatever you would like to use.)

[email protected]:~# ftp
Connected to
220-FileZilla Server version 0.9.32 beta
220-written by Tim Kosse ([email protected])
220 Please visit
Name ( anonymous
331 Password required for anonymous
230 Logged on
Remote system type is UNIX.

You should see packets in Wireshark from the system with IP address to and vice versa, with the Protocol field marked as FTP. Wireshark is capturing the traffic moving to and from our Kali machine.

Switch over to your Ubuntu Linux target machine, and log in to the FTP server on the Windows XP target. Looking back at Wireshark in Kali, you should see that no additional FTP packets have been captured. In our simulated switched network, any traffic not destined for our Kali machine will not be seen by the network interface and, thus, will not be captured by Wireshark.

Filtering Traffic

The sheer volume of network traffic captured by Wireshark can be a bit overwhelming because, in addition to our FTP traffic, every other packet to or from the Kali system is captured. To find specific interesting packets, we can use Wireshark filters. The Filter field is located at the top left of the Wireshark GUI. As a very simple first Wireshark filtering example, let’s look for all traffic that uses the FTP protocol. Enter ftp in the Filter field and click Apply,

As expected, Wireshark filters the captured packets to show only those that use the FTP protocol. We can see our entire FTP conversation, including our login information, in plaintext.

We can use more advanced filters to further fine-tune the packets returned. For example, we can use the filter ip.dst== to return only packets with the destination IP address We can even chain filters together, such as using the filter ip.dst== and ftp to find only FTP traffic destined for

Following a TCP Stream

Even after filtering traffic, there may be multiple FTP connections captured during the same time frame, so it could still be difficult to tell what’s going on. But once we find an interesting packet, such as the beginning of an FTP login, we can dig deeper into the conversation by right-clicking the packet and selecting Follow TCP Stream,

The resulting screen will show us the full contents of our FTP connection, including its credentials in plaintext,

220-FileZilla Server version 0.9.32 beta
220-written by Tim Kosse ([email protected])
220 Please visit
USER anonymous
331 Password required for anonymous
PASS [email protected]
230 Logged on
215 UNIX emulated by FileZilla

Dissecting Packets

By selecting a specific captured packet, we can get more information about the captured data, At the bottom of the Wireshark
screen, you can see details of the selected packet. With a little guidance, Wireshark will break down the data for you. For example, we can easily find the TCP destination port by selecting the TCP entry and looking for Destination port, as highlighted in the figure. When we select this field, the entry in the raw bytes of the packet is highlighted as well.

If You Like This Post Please Comment Down And For More Hacking Content Click Here

Related posts

Leave a Comment