Skip to content

mar0ls/packets_sniffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Packets sniffer

Written as part of self-study. The python library socket was used . Below I will present what was helpful to create the above application.

What`s i need to know ?

IP Header Struckture

#image

TCP Header Structure

image

UDP Header Structure

image

This program works on linux.

image

  • If you run this program on Windows, you show this:
Traceback (most recent call last):
  File "C:\packets_sniffer.py", line 165, in <module>
    main()
  File "C:\packets_sniffer.py", line 141, in main
    sniffer_socket = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.htons(0x0003))
                                   ^^^^^^^^^^^^^^^^
AttributeError: module 'socket' has no attribute 'PF_PACKET'

If you want to run it on Windows, you should PF_PACKET change to AF_INET in socket.