-
Notifications
You must be signed in to change notification settings - Fork 68
/
wlan-client.py
executable file
·45 lines (32 loc) · 947 Bytes
/
wlan-client.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
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/python3
from scapy.all import *
station = "c0:de:de:ad:be:ef"
ssid = "LoveMe"
iface = "wlp2s0"
# probe request
pkt = RadioTap() / \
Dot11(addr1='ff:ff:ff:ff:ff:ff',
addr2=station, addr3=station) / \
Dot11ProbeReq() / \
Dot11Elt(ID='SSID', info=ssid, len=len(ssid))
print("Sending probe request")
res = srp1(pkt, iface=iface)
bssid = res.addr2
print("Got answer from " + bssid)
# authentication with open system
pkt = RadioTap() / \
Dot11(subtype=0xb,
addr1=bssid, addr2=station, addr3=bssid) / \
Dot11Auth(algo=0, seqnum=1, status=0)
print("Sending authentication")
res = srp1(pkt, iface=iface)
res.summary()
# association
pkt = RadioTap() / \
Dot11(addr1=bssid, addr2=station, addr3=bssid) / \
Dot11AssoReq() / \
Dot11Elt(ID='SSID', info=ssid) / \
Dot11Elt(ID="Rates", info="\x82\x84\x0b\x16")
print("Association request")
res = srp1(pkt, iface=iface)
res.summary()