是的,是的。
我有一些Python代码,可以使用nfqueue与Linux iptables交互以执行防火墙职责。我可以在iptables中使用如下规则:
iptables -A INPUT -j NFQUEUE --queue-num 1
然后有一些看起来像这样的Python代码:
import nfqueue
from dpkt import ip
q = None
def cb(dummy, payload):
# make decision about if the packet should be allowed. in this case, drop everything:
payload.set_verdict(nfqueue.NF_DROP)
q = nfqueue.queue()
q.open()
q.bind()
q.set_callback(cb)
q.create_queue(1)
q.try_run()
http://blog.yancomm.net/2011/05/nfqueue-packet-mangling-with- python.html