Problems with netfilerqueue (dns spoof)

So following the “learn python for ethical hacking from scratch-course”

-------------------------------------THE CODE:
#!/usr/bin/env python

import netfilterqueue
import scapy.all as scapy

def process_packet(packet):
scapy_packet = scapy.IP(packet.get_payload())
if scapy_packet.haslayer(scapy.DNSRR):

queue = netfilterqueue.NetfilterQueue()
queue.bind(0, process_packet)

Firstly i am using these commands to setup some rules for iptables:
iptables -I OUTPUT -j NFQUEUE --queue-num 0
iptables -I INPUT -j NFQUEUE --queue-num 0

then i run my program (in python2) as Zaid does it.

But everytime i run the program i get this ERROR:

Traceback (most recent call last):
File “”, line 15, in
queue.bind(0, process_packet)
File “netfilterqueue.pyx”, line 182, in netfilterqueue.NetfilterQueue.bind (netfilterqueue.c:4388)
OSError: Failed to create queue 0.

I have tried everything: making sure it was the correct installation, i have cython installed as well and followed every single netfilter trouble shooting.

Any advice?

Try Zaid’s website forums for support:

Also try Zaid’s customized Kali, which will probably help with many issues:

1 Like

thank you my friend :slight_smile:

I cannot post on his forum, you ahve to buy a course from the website :slight_smile:

but i will keep on fighting, and downloading his kali. and trying it out again

the funny thing is; i just downloaded Zaids kali linux version, and tried the coding. i still get the same error :stuck_out_tongue:

Hey i am stuck at the same bit . Did you solve it by any chance ?

Did you remember to create the queue using (iptables -I INPUT -j NFQUEUE --queue-num 0) command? remember to run it again changing input to output too.

Oh btw the anwser to the problem is use queue 1 instead

Yeah I know I’m late to fix this one.