python 2.7 - I want to know how capture RAW data packets in a Queue using Iptables or Nftables -


my doubt want captire raw data packets, can use them built firewall. following script prints short description of each packet before accepting it. netfilterqueue import netfilterqueue

def print_and_accept(pkt):     print pkt     pkt.accept()  nfqueue = netfilterqueue() nfqueue.bind(1, print_and_accept) try:     nfqueue.run() except keyboardinterrupt:     print 

to send packets destined lan script, type like:

iptables -i input -d 192.168.0.0/24 -j nfqueue --queue-num 1 

according comment, raw packet mean layer 2. iptables works @ layer 3, need use ebtables instead.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -