Unknown pypcap network interface 'eth0' error with python2 scapy on windows 10 machine

有些话、适合烂在心里 提交于 2021-02-11 13:50:12

问题


I am trying to create a simple web monitoring app with scapy(2.4.3), python 2.7 on a windows 10 machine. I also have winpcap(5.0.9983.830) installed.

This is the code I am trying to run:

def http_header(packet):
    print packet

sniff(iface='eth0', prn=http_header)

And this is the error it throws:

raise ValueError("Unknown pypcap network interface %r" % pcap_name)
ValueError: Unknown pypcap network interface 'eth0'

I also installed .Microsoft Visual C++ Compiler for Python 2.7 just to be safe, as other solutions pointed out, but had no success. Also tried re-installing scapy, winpcap and recreating the Virtual Environment, but again had no luck.


回答1:


Your interface is not called eth0 if you are using Windows.

You can use ipconfig /all to see all your network interfaces, and you can use the description value of the Ethernet interface as the interface name for Scapy. So for example in my laptop it is:

IFACE_NAME="Intel(R) Ethernet Connection (2) I219-LM"
sniff(iface=IFACE_NAME, prn=http_header)


来源:https://stackoverflow.com/questions/59720769/unknown-pypcap-network-interface-eth0-error-with-python2-scapy-on-windows-10-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!