This program allows us to analyze the ethernet/network packets (IPv4 Only) that are routed through our device. On running this program it displays various important information about the packets origin and destination such as its addresses and ports,apart from these we can also analyze different layers of the frame to further investigate on its segments (UDP ,TCP, ICMP) to display its version and protocol infos.
NOTE:- i have not considered the core data that the frame is carrying beacause most of the times it is encrypted unless untill the protocol is http, as those data are not encrypted. HTTP data are packed inside the packet as plain text.
Python3 -
You can download and install it from it's official website.
It is available for all types of platforms (windows , Linux and mac). In Linux/Mac it comes pre-installed.
Here i have used some of python's built in modules (socket and struct) for capturing and analyzing packets.
so there is no need of installing any external package.
Download the project and extract it. or
Open terminal and clone the project.
git clone https://github.com/hb10001/Network-Packet-Analyzer.git
After the download/clone process is completed,navigate over to the project location inside the terminal. when you are inside the project folder you can see a python script named 'main.py'.
Now run that script-
sudo python3 main.py
As the code works by creating sockets, we need to have root/administrative access to create them. (By this you give permission to capture the network packets)
windows user-
open CMD as administrator
Right-Click-On-CMD >> Run-As-Administrator
navigate over to the project folder and then run the script
python3 main.py
you should get an output similar to this -
we know that HTTP data are not encrypted,they are transmitted as plain text.and also for the fact that they use port 80 as their source and destination ports. so we can use these facts to generalize that whenever the port address is 80 we should pass the core data to a function which is capable of properly formatting the texts and display it to the user.