Search code examples
pythonpython-3.xscapysniffer

How to fix OSError: b'Error opening adapter: Cannot find specified device. (20)'


i'm trying to run this simple python code just to start learning how a sniffer works, but i get this constant error:

OSError: b'Error opening adapter: Cannot find specified device. (20)'

Please note that the "Cannot find specified device" was in my language, and i translated in english, so it might be a little bit different. The code that i'm trying to run is:

import scapy.all as scapy

def process_packet(packet):
    print(packet)

def sniffing(interface):
    scapy.sniff(iface=interface, store=False, prn=process_packet)


sniffing('Wi-Fi')

The video i watched is here: https://www.youtube.com/watch?v=rI0rTpH0f1o

Thank you for your time. If you need the original error (in my language) please post a comment and i'll write it.


Solution

  • Thanks to dianiel kullmann for providing an answer. To other users having the same issue, replacing sniffing('Wi-Fi') with sniffing(None) solved the issue.

    Please note: issue fixed on windows 10