oremanj / python-netfilterqueue

Python bindings for libnetfilter_queue
MIT License
248 stars 96 forks source link

Is there anyway to use multiple netfilterqueue Python program to bind to the same queue? #73

Closed XingSc29 closed 2 years ago

XingSc29 commented 2 years ago

I am working on a project which requires different attacks (DNS spoofing, Code injection, File replacer, etc...). So, I need to have multiple netfilterqueue Python programs to intercept the incoming packets in NFQUEUE. However, when more than one netfilterqueue instances access the same queue, the following error will be shown:

queue.bind(int(self.queue_num), self.process_packet) File "netfilterqueue.pyx", line 182, in netfilterqueue.NetfilterQueue.bind OSError: Failed to create queue 0.

oremanj commented 2 years ago

No, this is a limitation at the kernel level -- you can only have one process bound to each queue number. You would need to have a single receiver using NetfilterQueue and then multiplex out the packets to your different programs after that point.