To be able to craft packets with Scapy, you have to either use sudo or allow setcap for your python environment. I don’t prefer to use sudo when working with my Anaconda environments, so I did the following:
sudo setcap 'cap_net_raw,cap_net_admin,cap_net_bind_service=eip' /home/ubuntu/anaconda3/envs/py311/bin/python3.11
Note: Using in the above example python instead of python3.11 won’t work, since python in that location is just a symbolic link, you have to specify the executable itself directly.
That’s it, now you can run your program without sudo!
Enjoy!