Skip to content

Network monitor in python3. Monitor every incoming and outgoing packet. Parse Ethernet, IP, TCP/UDP & DNS packets to log network activity.

License

Notifications You must be signed in to change notification settings

rootsec1/Network-monitor

Repository files navigation

sniffer.py

Network monitor. The scope is to Monitor every incoming as well as outgoing packet. Then parse various packets like 'Ethernet', 'IP', 'TCP/UDP' & 'DNS' to log network activity.

Features

This started as a method for me to monitor network activity on my laptop even while idle. So the feature-set is as per my requirement:

  • Human readable protocol types like TCP, UDP, etc...
  • Human readable packet types like IPv4, ARP, IPv6, etc...
  • Human readbale port numbers like DNS, HTTP, HTTPS, etc...
  • Human readable IPs like Local-IP, PRIMARY-DNS, etc...
  • Reverse IP to domain mapping so the IPs will given a domain name like "google.com" or "dropbox.com"
  • Both pretty-print or print in csv format is possible.

Example usage

$> sudo python ./sniffer.py eth0

====================================|  SNIFFing on eth0  |====================================

-------------------------------------------------------------------------------------------------------------------------------------------
| DATE/TIME     	    | TYPE        	|                  SOURCE IP | PORT  	|                    DEST IP | PROTOCOL(PORT)
-------------------------------------------------------------------------------------------------------------------------------------------
| 2014-10-10 03:29:59	| IPv4/UDP    	|                   Local-IP | 33372 	|                Primary-DNS | DNS(53)
| 2014-10-10 03:29:59	| IPv4/UDP    	|                Primary-DNS | DNS(53)	|                   Local-IP | 33372
| 2014-10-10 03:30:04	| ARP         	|                   Local-IP | n/a   	|                Primary-DNS | n/a
| 2014-10-10 03:30:04	| ARP         	|                Primary-DNS | n/a   	|                   Local-IP | n/a
| 2014-10-10 03:30:08	| IPv4/UDP    	|                   Local-IP | Dropbox 	|            255.255.255.255 | Dropbox LanSync Protocol(17500)
| 2014-10-10 03:30:08	| IPv4/UDP    	|                   Local-IP | Dropbox 	|             192.168.81.255 | Dropbox LanSync Protocol(17500)
| 2014-10-10 03:30:15	| IPv4/TCP    	|        notify9.dropbox.com | HTTP(80)	|                   Local-IP | 40208
| 2014-10-10 03:30:15	| IPv4/TCP    	|                   Local-IP | 40208 	|        notify9.dropbox.com | HTTP(80)

About

Network monitor in python3. Monitor every incoming and outgoing packet. Parse Ethernet, IP, TCP/UDP & DNS packets to log network activity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages