是的,是的。
我有一些Python代码,可以使用nfqueue与Linux iptables交互以执行防火墙职责。我可以在iptables中使用如下规则:
iptables -A INPUT -j NFQUEUE --queue-num 1
然后有一些看起来像这样的Python代码:
import nfqueuefrom dpkt import ipq = Nonedef 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



