Using scapy with wifi

3.1k views Asked by At

i've tried to send packet using scapy while connected to wifi, and i got an error about "dnet.pyx". But when i connect to wired connection, it worked. I've searched a lot on the internet about this problem, but there wasn't any answer for this. Is there a problem with scapy and wifi? Or is there something wrong with my computer/scapy?

edit:

send(IP(dst="204.11.192.171")/UDP(dport=5070)/"hello world")

with wifi, the error message was:

Traceback (most recent call last):
File "C:/Users/Tamir/PycharmProjects/SIP/main.py", line 10, in <module>
send(IP(dst="204.11.192.171")/UDP(dport=5070)/"hello world")
File "C:\Python27\lib\site-packages\scapy_real-2.2.0_dev-py2.7.egg\scapy\sendrecv.py", line 251, in send
__gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop, count=count,verbose=verbose, realtime=realtime)
File "C:\Python27\lib\site-packages\scapy_real-2.2.0_dev-py2.7.egg\scapy\sendrecv.py", line 234, in __gen_send
s.send(p)
File "C:\Python27\lib\site-packages\scapy_real-2.2.0_dev-py2.7.egg\scapy\arch\pcapdnet.py", line 237, in send
ifs = dnet.eth(iff)
File "dnet.pyx", line 112, in dnet.eth.__init__ (./dnet.c:1764)
OSError: No such file or directory

with wired connection there was no error

2

There are 2 answers

1
Kaylon Allen On

There is probably just a problem connecting to the WiFi, the wired connection is a guaranteed connect, I have encountered the same occurrence and it usually because the WiFi isn't the stronger connection

1
Kle0s On

Scapy does work on WiFi.

Notice that if you use a computer that has a wired connection as default (most non-laptops are like this), you should state what interface you wish to send the packet on. usually,

"eth0"

is the wired one, and

"wlan0" 

or something like this is the WiFi.

When sending, add the field interface that way:

send(packet, iface="wlan0")

That also works when sniffing packets

sniff(iface=“wlan0”)
sniff(iface=“wlan0”, monitor=True) # not supported on every platform, with monitor mode on

I hope it helps.