Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python SCAPY发送数据包错误OSError:[Errno 97]协议不支持地址族_Python_Sockets_Scapy - Fatal编程技术网

Python SCAPY发送数据包错误OSError:[Errno 97]协议不支持地址族

Python SCAPY发送数据包错误OSError:[Errno 97]协议不支持地址族,python,sockets,scapy,Python,Sockets,Scapy,尝试使用发送数据包时,我遇到以下错误: Ubuntu:18.04版 Python:3.6.6 scapy版本:2.4.0 发送(IP(dst=“192.168.1.1”)/ICMP()) --------------------------------------------------------------------------- OSError回溯(最近一次调用上次) 在里面 ---->1发送(IP(dst=“192.168.1.1”)/ICMP() 发送中的~/scapy/lib/

尝试使用发送数据包时,我遇到以下错误:

  • Ubuntu:18.04版
  • Python:3.6.6
  • scapy版本:2.4.0
发送(IP(dst=“192.168.1.1”)/ICMP()) --------------------------------------------------------------------------- OSError回溯(最近一次调用上次) 在里面 ---->1发送(IP(dst=“192.168.1.1”)/ICMP() 发送中的~/scapy/lib/python3.6/site-packages/scapy/sendrecv.py(x、inter、loop、count、verbose、realtime、return_数据包、socket、*args、**kargs) 298[插座=无]->无“” 299如果套接字为“无” -->300插座=conf.L3socket(*args,**kargs) 301返回\uuuuGen\uSend(套接字,x,inter=inter,loop=loop,count=count,verbose=verbose, 302实时=实时,返回\u数据包=返回\u数据包) ~/scapy/lib/python3.6/site-packages/scapy/arch/linux.py in\uuuuuuu init\uuuuuu(self、iface、type、promisc、filter、nofilter、monitor) 405定义初始化(self,type=ETH\u P\u ALL,filter=None,promisc=None,iface=None,nofilter=0): 406 self.type=类型 -->407 self.ins=socket.socket(socket.AF_包、socket.SOCK_原始、socket.htons(类型)) 408 self.ins.setsockopt(socket.SOL_socket,socket.SO_RCVBUF,0) 409如果iface: /usr/lib/python3.6/socket.py在uuuu init_uuuu中(self、family、type、proto、fileno) 142#socket.socket的构造函数将给定参数转换为 143#自动整数。 -->144 _socket.socket.__init___(self、family、type、proto、fileno) 145自参考值=0 146 self.\u closed=False OSError:[Errno 97]协议不支持地址族
在新安装的Scapy上是否有可能导致此问题?

如果您使用VM或Windows Subsystem for Linux,则可能会发生这种情况。请尝试标准安装,这为我解决了相同的问题。

我建议访问,以便更好地了解如何提出一个可靠的问题。此外,还有一些代码、错误和轻微错误为了让他人向你提供帮助,你需要更好的解释(他们首先需要了解实际问题是什么)。请稍候。您是否以root用户身份调用scapy?
sudo scapy
还有一件事:请将代码、输出和诊断作为文本复制并粘贴到问题中。图像对读者来说非常不方便。正确:您无法在Windows上用Python直接打开L2原始套接字,因此scapy使用变通方法([Win]pcap提供程序)绕过这条规则。