因此,我尝试运行以下伪造wlan连接的示例代码:
from scapy.all import Dot11,Dot11Beacon,Dot11Elt,RadioTap,sendp,hexdump
netSSID = 'testSSID' #Network name here
iface = 'wlan0mon' #Interface name here
dot11 = Dot11(type=0, subtype=8, addr1='ff:ff:ff:ff:ff:ff',
addr2='22:22:22:22:22:22', addr3='33:33:33:33:33:33')
beacon = Dot11Beacon(cap='ESS+privacy')
essid = Dot11Elt(ID='SSID',info=netSSID, len=len(netSSID))
rsn = Dot11Elt(ID='RSNinfo', info=(
'\x01\x00' #RSN Version 1
'\x00\x0f\xac\x02' #Group Cipher Suite : 00-0f-ac TKIP
'\x02\x00' #2 Pairwise Cipher Suites (next two lines)
'\x00\x0f\xac\x04' #AES Cipher
'\x00\x0f\xac\x02' #TKIP Cipher
'\x01\x00' #1 Authentication Key Managment Suite (line below)
'\x00\x0f\xac\x02' #Pre-Shared Key
'\x00\x00')) #RSN Capabilities (no extra capabilities)
frame = RadioTap()/dot11/beacon/essid/rsn
frame.show()
print("\nHexdump of frame:")
hexdump(frame)
raw_input("\nPress enter to start\n")
sendp(frame, iface=iface, inter=0.100, loop=1)我得到了下面的错误。
Traceback (most recent call last):
File "test.py", line 11, in <module>
rsn = Dot11Elt(ID='RSNinfo', info=(
File "/home/dani/Desktop/scapy/scapy/base_classes.py", line 266, in __call__
i.__init__(*args, **kargs)
File "/home/dani/Desktop/scapy/scapy/packet.py", line 164, in __init__
self.fields[fname] = self.get_field(fname).any2i(self, value)
File "/home/dani/Desktop/scapy/scapy/fields.py", line 1808, in any2i
return self.any2i_one(pkt, x)
File "/home/dani/Desktop/scapy/scapy/fields.py", line 1787, in any2i_one
x = self.s2i[x]
KeyError: 'RSNinfo'在我看到的所有示例代码中都使用了'RSNinfo‘,那么为什么这里不能识别它呢?如果它改变了什么,我使用的是ubuntu20.4,并尝试了python2和3。
发布于 2020-08-09 02:18:01
https://stackoverflow.com/questions/63311369
复制相似问题