Brief description
My systemd service looks something like this
[Unit]
Description=asdf
[Service]
Type=simple
ExecStart=/usr/bin/python3 -u /usr/bin/foo
Restart=on-failure
[Install]
WantedBy=graphical.target
and my usage of sniff boils down to
from scapy.sendrecv import sniff
import time
while True:
packages = sniff(
filter="udp portrange 2000-3000",
timeout=2,
)
print(packages)
time.sleep(10)
As far as I know WantedBy=graphical.target is the latest point at which I can start the service, still, it does not detect any traffic later when I interact with my system.
I was hoping that there is a way to make scapy reset or check for changes in network interfaces or whatever to make it work, but couldn't find anything.
As soon as I do systemctl restart asdf.service it starts detecting traffic
Adding a minute of sleep via bash -c "sleep 60 && ... also makes it work.
Scapy version
2.6.1+dfsg-1
Python version
3.13.3
Operating system
6.14.0-37-generic, Ubuntu 25.04
Additional environment information
No response
How to reproduce
see above
Actual result
doesn't capture any network traffic
Expected result
captures network traffic
Related resources
No response
Brief description
My systemd service looks something like this
and my usage of sniff boils down to
As far as I know
WantedBy=graphical.targetis the latest point at which I can start the service, still, it does not detect any traffic later when I interact with my system.I was hoping that there is a way to make scapy reset or check for changes in network interfaces or whatever to make it work, but couldn't find anything.
As soon as I do
systemctl restart asdf.serviceit starts detecting trafficAdding a minute of sleep via
bash -c "sleep 60 && ...also makes it work.Scapy version
2.6.1+dfsg-1
Python version
3.13.3
Operating system
6.14.0-37-generic, Ubuntu 25.04
Additional environment information
No response
How to reproduce
see above
Actual result
doesn't capture any network traffic
Expected result
captures network traffic
Related resources
No response