bind callback is not work
unloadble opened this issue · 2 comments
unloadble commented
hi guys i want to make a packet queue with this simple code :
from netfilterqueue import NetfilterQueue
def print_and_accept(pkt):
print(pkt)
nfqueue = NetfilterQueue()
nfqueue.bind(0, print_and_accept)
but
"print_and_accept" is not fire and work !
program doesnt print packet and internet is worked well !
how ?
and how can fix it
slrendell commented
You need to accept the packet after you print it and you need to call run on nfqueue.
from netfilterqueue import NetfilterQueue
def print_and_accept(pkt):
print(pkt)
pkt.accept()
nfqueue = NetfilterQueue()
nfqueue.bind(0, print_and_accept)
nfqueue.run()
You also need to insert a rule in to iptables to queue the packets.
sudo iptables -I INPUT 1 -j NFQUEUE --queue-num 0
Remove the rule after with
sudo iptables -D INPUT 1
oremanj commented
Reply is correct, closing this since it hasn't seen any activity.