Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to compile filter expression ip proto UDP and [...] #1

Open
Thus0 opened this issue Jan 26, 2022 · 2 comments
Open

Failed to compile filter expression ip proto UDP and [...] #1

Thus0 opened this issue Jan 26, 2022 · 2 comments

Comments

@Thus0
Copy link

Thus0 commented Jan 26, 2022

Hi

I have some scapy.error.scapy_Exception on scapy sniff filters beginning with the expression "ip proto UDP and ..."

scapy.error.Scapy_Exception: Failed to compile filter expression ip proto UDP ...

If I replace the expression "ip proto UDP" by "udp", the filter is working. Which version of python and scapy are you using ?

I'm testing in docker containers with "alpine:latest" image which provides : python 3.8 and scapy 2.4.5

@CountablyInfinite
Copy link
Owner

Thanks for bringing this up, it seems like something changed in a recent scapy update.

I developed DIT on Ubuntu 20.04 LTS using Python 3.8.5 and scapy 2.4.4. I used the widely deployed Berkeley Paket Filter (BPF) syntax to write the filter, but it seems like the sniff function won't accept it anymore.

I have not tested this on my dev setup, but i don't think that this is an OS, but rather a scapy problem. If i find time to test and evaluate scapy 2.4.5 on with my dev Setup, i will update the proxy module to work with scapy 2.4.5.

So far you should do fine with your fix.

@Thus0 Thus0 changed the title Failed tom compile filter expression ip proto UDP and [...] Failed to compile filter expression ip proto UDP and [...] Jan 28, 2022
@Thus0
Copy link
Author

Thus0 commented Jan 28, 2022

I've tried with scapy 2.4.4. and I have the same problem. So I'm suspecting perhaps a container problem.

I have the same error with tcpdump with bpf filter

/app/dit # tcpdump "ip proto udp"
tcpdump: can't parse filter expression: syntax error

/app/dit # tcpdump "ip proto 17"
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes

/app/dit # tcpdump "udp"
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes

I'm guessing "ip proto 17" should work in all cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants