title: I want to know how capture RAW data packets in a Queue using Iptables or Nftables
body: <p>My doubt is I want to captire raw data packets, so that I can use them to built firewall.
  The following script prints a short description of each packet before accepting it.
      from netfilterqueue import NetfilterQueue</p>
  
  <pre><code>def print_and_accept(pkt):
      print pkt
      pkt.accept()
  
  nfqueue = NetfilterQueue()
  nfqueue.bind(1, print_and_accept)
  try:
      nfqueue.run()
  except KeyboardInterrupt:
      print
  </code></pre>
  
  <p>To send packets destined for your LAN to the script, type something like:</p>
  
  <pre><code>iptables -I INPUT -d 192.168.0.0/24 -j NFQUEUE --queue-num 1
  </code></pre>