I am trying to send a packet using a UDP protocol. I am running Python 3 on Ubuntu and using scapy. However, I get the following error message: "AttributeError: 'L2Socket' object has no attribute 'ins'". The full error message can be seen below.
I read here https://github.com/secdev/scapy/issues/1868 that it may be a problem with not being able to run as root because Ubuntu is run through a virtual machine. Any help is more than welcome!
These are the lines of code in question:
from scapy.all import *
packet = IP(dst="127.0.0.1")/UDP(dport=123)/Raw(load="123")
send(packet)
You need to start Scapy as root (sudo).
Look at the error closely: it first says "Operation not permitted". The error you're quoting is a consequence of the first one failing.
It was already reported multiple times & the second error was fixed on master: https://github.com/secdev/scapy/issues/1942
Scapy won't be able to run open a Raw socket without root. That's a Linux restriction.