Code written in partial fulfilment of Course Computer Networks (CS F303). BITS Pilani, Pilani Campus. (Jan-May 2017)
It currently works only in Linux based systems. It is tested in Ubuntu 17.04 but should work fine with older versions of Ubuntu also.
gcc main.c -o capture
sudo ./capture
Note: The program needs sudo permission for opening the sock to capture packets
- In the beginning the program will ask you to enter a file name where it should print the details of the packets captured. Enter any file name here (eg. log.txt)
- Then it will ask for number of packets to be captured for analysis
- Then it will start capturing and once the desired number of packets are captured, Analysis prompt will be given to user.
- Print all captured packets
It prints the details of all the packets that are captured
-
Filter packets
- Filter by MAC address
Gives a list of all MAC addresses whose packets were captured. You can select any one MAC address to filter.
- Filter by IP
Gives a list of all IP addresses whose packets were captured. You can select any one IP address to filter.
- Filter by Protocol
You can select to filter only HTTP or FTP packets that were captured
- Back to main menu
-
Display Network Traffic Graph
Creates "Number of packets captured vs Time" graph using gnuplot
Note: gnuplot must be installed in your system for this option to work . To install gnuplot in ubuntu run
sudo apt-get install gnuplot
-
Exit