python中带有scapy摘要功能的问题

问题描述 投票:0回答:1

我已在我的python代码(arp-spoofer)中导入了scapy模块,当我使用packet.show()/ packet.summary()函数时,终端返回此错误:

错误:

Traceback (most recent call last):
  File "arp-spoofer.py", line 10, in <module>
    print(packet.show())
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/packet.py", line 1261, in show
    return self._show_or_dump(dump, indent, lvl, label_lvl)
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/packet.py", line 1235, in _show_or_dump
    reprval = f.i2repr(self, fvalue)
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/fields.py", line 376, in i2repr
    return fld.i2repr(pkt, val)
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/fields.py", line 502, in i2repr
    x = self.i2h(pkt, x)
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/layers/l2.py", line 136, in i2h
    iff = self.getif(pkt)
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/layers/l2.py", line 132, in <lambda>
    self.getif = (lambda pkt: pkt.route()[0]) if getif is None else getif
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/layers/l2.py", line 400, in route
    fld, dst = fld._find_fld_pkt_val(self, dst)
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/fields.py", line 313, in _find_fld_pkt_val
    if val == dflts_pkt[self.name] and self.name not in pkt.fields:
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/base_classes.py", line 133, in __eq__
    p2, nm2 = self._parse_net(other)
  File "/home/baloo/.local/lib/python3.7/site-packages/scapy/base_classes.py", line 99, in _parse_net
    tmp = net.split('/') + ["32"]
AttributeError: 'NoneType' object has no attribute 'split'

代码:

import scapy.all as scapy

victim_ip = ""
victim_mac_address  = ""
router_ip  = ""

packet = scapy.ARP(op=2, pdst=victim_ip, hwdst=victim_mac_address, psrc=router_ip)
print(packet.show())
print(packet.summary())
python scapy
1个回答
0
投票

您需要有效的IP。如果您不想自己设置它们,请不要指定它们,Scapy将采用默认值。

© www.soinside.com 2019 - 2024. All rights reserved.