我想创建一个python3脚本,它使用无线活动连接(接口当前附加的bssid )发送一个100%自定义的第2层有效负载(或者换句话说,一个100%自定义的第3层或2.5层协议)。
我已经尝试了很多方法,使用如下所示的脚本:
from scapy.all import *
import os
interfaces = os.listdir('/sys/class/net')
interface = interfaces[1] # which is the wireless interface
send(Dot11(addr1 = 'aa:aa:aa:aa:aa:aa'), iface = str(interface)) # I pretend here to send an empty frame to addr1 destination, using the wireless card and the existing bssid on which i'm currently connected我总是将目的MAC地址作为广播地址。当然,我不知道做我想做的事情的正确方式。
欢迎任何建议或澄清。
提前谢谢。
发布于 2019-07-01 23:32:39
答案是,关键是使用sendp而不是发送,例如IEEE1905以太网类型:
import os
from scapy.all import *
dest_MAC = aa:aa:aa:aa:aa:aa # the mac address you want to send it
interfaces = os.listdir('/sys/class/net') interface = interfaces[3] #select one interface from the array, it could be Ethernet or an existing Wireless STA connection
p = Ether(type=0x893a, dst = dest_MAC)/b"\x00\x00\x00" #we send just three "zero" bytes
sendp(p, iface=interface) #using sendp instead send, which is layer2 abstractedhttps://stackoverflow.com/questions/55386300
复制相似问题