How to exit netfilter block?
Pooshkis opened this issue · 0 comments
Pooshkis commented
I'm running this code:
import os, sys
queue = NetfilterQueue()
QUEUE_NUM1 = 1
def changing_payload(pkt):
global binary_rep
if len(binary_rep) == 0:
raise KeyboardInterrupt
print(binary_rep)
binary_rep = binary_rep[1:]
binary_rep = "0101000021002220201551051101545"
try:
os.system("iptables -I OUTPUT -d 10.0.1.0/24 -p udp --dport 7078 -j NFQUEUE --queue-num {}".format(QUEUE_NUM1))
queue.bind(QUEUE_NUM1, changing_payload)
queue.run()
except KeyboardInterrupt:
queue.unbind()
os.system("iptables --flush")
print('Message sent..')
and get error message but netfilterqueue que is still running:
Traceback (most recent call last):
File "/home/nfq.py", line 10, in changing_payload
raise KeyboardInterrupt("Should stop")
KeyboardInterrupt: Should stop
Any ideas how could I stop netfilterqueue without exiting program? (BTW pressing "CTRL+C" isn't working too)