scapy:发送数据包时出错 [英] scapy: error sending packets

查看:183
本文介绍了scapy:发送数据包时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 scapy 的新手,我正在学习一些在线教程,但我遇到了这个问题.我能够通过有线连接发送数据包,但是当我尝试使用无线连接时,我遇到了这个错误.我尝试搜索谷歌,但没有帮助.我希望找到解决办法.提前致谢.

我使用的是 windows 8.1,python 2.7

<预><代码>>>>p=IP(dst="192.168.1.1")/ICMP()>>>sr1(p)开始发射:错误:---发送数据包时出错回溯(最近一次调用最后一次):文件c:\Python27\lib\site-packages\scapy\arch\windows\__init__.py",第 374 行,在 sndrcv 中pks.send(p)文件c:\Python27\lib\site-packages\scapy\arch\pcapdnet.py",第 257 行,发送sx = str(cls()/x)文件c:\Python27\lib\site-packages\scapy\packet.py",第 268 行,在 __str__ 中返回 self.build()文件c:\Python27\lib\site-packages\scapy\packet.py",第 330 行,在构建中p = self.do_build()文件c:\Python27\lib\site-packages\scapy\packet.py",第 319 行,在 do_buildpkt = self.self_build()文件c:\Python27\lib\site-packages\scapy\packet.py",第 310 行,在 self_buildp = f.addfield(self, p, val)文件c:\Python27\lib\site-packages\scapy\fields.py",第 70 行,在 addfield返回 s+struct.pack(self.fmt, self.i2m(pkt,val))文件c:\Python27\lib\site-packages\scapy\layers\l2.py",第 95 行,在 i2m 中返回 MACField.i2m(self, pkt, self.i2h(pkt, x))文件c:\Python27\lib\site-packages\scapy\layers\l2.py",第 89 行,在 i2h 中x = conf.neighbor.resolve(pkt,pkt.payload)文件c:\Python27\lib\site-packages\scapy\layers\l2.py",第38行,解析返回 self.resolvers[k](l2inst,l3inst)文件c:\Python27\lib\site-packages\scapy\layers\inet.py",第 732 行,在 <lambd>conf.neighbor.register_l3(Ether, IP, lambda l2,l3: getmacbyip(l3.dst))文件c:\Python27\lib\site-packages\scapy\arch\windows\__init__.py",第 292 行,在 getmacbyipifip = str(pcapdnet.dnet.intf().get(iff)['addr'])密钥错误:'地址'信息: --- 发送数据包时出错......................................收到 25 个数据包,得到 0 个回答,剩余 1 个数据包警告:__del__:不知道如何关闭文件描述符.前面有错误!恳求se 报告此错误.

解决方案

有点晚了,但是:

几个月前我遇到了同样的问题,最终对我有用的是通过另一个网络接口隧道连接 WiFi.看来问题出在IP获取过程中;也许您应该尝试以管理员身份运行,并设置 Python 和 Scapy 文件的功能,以便它们具有完全控制权(右键单击->属性->安全性).

您在使用 send/sr/srp 等其他方法时是否遇到同样的问题?

I am new to scapy and I am following some online tutorial, but I am stuck at this problem. I am able to send packets through a wired connection but when I try this with wireless, I face this error. I tried searching google but it was of no help. I hope to find a solution. Thanks in advance.

I am using windows 8.1, python 2.7

>>> p=IP(dst="192.168.1.1")/ICMP()
>>> sr1(p)
Begin emission:
ERROR: --- Error sending packets
Traceback (most recent call last):
  File "c:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 374,
 in sndrcv
    pks.send(p)
  File "c:\Python27\lib\site-packages\scapy\arch\pcapdnet.py", line 257, in send

    sx = str(cls()/x)
  File "c:\Python27\lib\site-packages\scapy\packet.py", line 268, in __str__
    return self.build()
  File "c:\Python27\lib\site-packages\scapy\packet.py", line 330, in build
    p = self.do_build()
  File "c:\Python27\lib\site-packages\scapy\packet.py", line 319, in do_build
    pkt = self.self_build()
  File "c:\Python27\lib\site-packages\scapy\packet.py", line 310, in self_build
    p = f.addfield(self, p, val)
  File "c:\Python27\lib\site-packages\scapy\fields.py", line 70, in addfield
    return s+struct.pack(self.fmt, self.i2m(pkt,val))
  File "c:\Python27\lib\site-packages\scapy\layers\l2.py", line 95, in i2m
    return MACField.i2m(self, pkt, self.i2h(pkt, x))
  File "c:\Python27\lib\site-packages\scapy\layers\l2.py", line 89, in i2h
    x = conf.neighbor.resolve(pkt,pkt.payload)
  File "c:\Python27\lib\site-packages\scapy\layers\l2.py", line 38, in resolve
    return self.resolvers[k](l2inst,l3inst)
  File "c:\Python27\lib\site-packages\scapy\layers\inet.py", line 732, in <lambd
a>
    conf.neighbor.register_l3(Ether, IP, lambda l2,l3: getmacbyip(l3.dst))
  File "c:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 292,
 in getmacbyip
    ifip = str(pcapdnet.dnet.intf().get(iff)['addr'])
KeyError: 'addr'
INFO: --- Error sending packets
.........................
Received 25 packets, got 0 answers, remaining 1 packets
WARNING: __del__: don't know how to close the file descriptor. Bugs ahead ! Plea
se report this bug.

解决方案

Slightly late, but:

I ran into the same problem a few months ago, and what worked for me eventually was to tunnel the WiFi through another network interface. It seems that the problem is in the IP obtaining process; Maybe you should try to run as administrator, and set the features of both Python and the Scapy files so that they have full control (right click->Properties->Security).

Do you encounter the same problem while using other methods like send/sr/srp?

这篇关于scapy:发送数据包时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆