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 | #!/usr/bin/python
""" =============================================================== ++++++++++++++++++++++++ READ ME ++++++++++++++++++++++++++++++ ===============================================================
Author :
Suraj Singh surajsinghbisht054@gmail.com www.bitforestinfo.com
""" # Required Data Feild Feild = { # Key Value Required 'count' : (5, False) , 'iface' : (None, True), 'timeout' : (None, False), }
# Import Module import sys import scapy.all as scapy
# Main Class For Finding Deauthentication Packets class DeauthenticationDetector: def __init__(self, *args, **kwargs): """ All Arguments And Keywords Will Directly Passed To Python Scapy Sniff Function.
""" self.args = args self.kwargs = kwargs self.data={} self.Sniffing_Start()
def extract_packets(self, pkt): """ Function For Extracting Packets. This Function Is Specially Created For Filtering Deauthentication Packets. """ if pkt.haslayer(scapy.Dot11Deauth): victim1 = pkt.addr2 victim2 = pkt.addr1 if str([victim1, victim2]) in self.data.keys(): self.data[str([victim1, victim2])]=self.data[str([victim1, victim2])]+1 else: self.data[str([victim1, victim2])]=1 self.print_values() return
def print_values(self): """ Function For Printing Values """ line = 0 for a,b in self.data.iteritems(): v1, v2 = eval(a) print "\t[#] Deauthentication Packet : {} <---> {} | Packets : {}".format(v1,v2,b) line+=1
# Backspace Trick sys.stdout.write("\033[{}A".format(line)) return
def Sniffing_Start(self): ''' Function For Creating Python Scapy.sniff Function ''' scapy.sniff(prn=self.extract_packets, *self.args, **self.kwargs) return
# Main Function def main(*args, **kwargs): DeauthenticationDetector(*args, **kwargs) return
# Main Trigger if __name__=='__main__': if len(sys.argv)==2: main(iface=sys.argv[1]) else: print " [ Error ] Please Provide Monitor Mode Interface Name ALso \n\n\t:~# sudo {} mon0 ".format(sys.argv[0])
|