~nighthawk/wep-cracker

1b2311226b49b7b47907fb0271118323735c4201 — Frank Brodbeck 6 months ago 63db22b master
a little bit more pep8 friendly.

for better of for worse...
1 files changed, 17 insertions(+), 14 deletions(-)

M wep-cracker.py
M wep-cracker.py => wep-cracker.py +17 -14
@@ 1,4 1,9 @@
import os, re, binascii, argparse, subprocess
import os
import re
import binascii
import argparse
import subprocess


def main(args):
    wep_bucket = bits_choices


@@ 13,19 18,18 @@ def main(args):
    # if args.bits was given, don't iterate over
    # all possible choices
    if args.bits == 64:
        wep_bucket = [ 64 ]
        wep_bucket = [64]
    elif args.bits == 128:
        wep_bucket = [ 128 ]
        wep_bucket = [128]

    if not os.path.isfile(args.pcap):
        print("[!] PCAP not found: {}".format(args.pcap))
        quit()                print("[!] PCAP not found: {}".format(args.pcap))↩

        quit()

    print("[*] Starting dictionary attack on {}".format(args.pcap))
    for bits in wep_bucket:
        print("[-] Testing dictionary for {}-WEP".format(bits))
        with open(args.wordlist, "r", encoding = 'utf-8') as fp:
        with open(args.wordlist, "r", encoding='utf-8') as fp:
            for line in fp:
                passwd = line.strip()
                if len(passwd) != passlen[bits]:


@@ 39,21 43,20 @@ def main(args):
                    quit()
    print("[?] FAILED. WPA key remains a secret.")


if __name__ == '__main__':
    bits_choices = [ 128, 64 ]
    parser = argparse.ArgumentParser(description = 'nighthawk\'s WEP airdecap-ng wrapper', add_help = False)
    bits_choices = [128, 64]
    parser = argparse.ArgumentParser(description='nighthawk\'s WEP airdecap-ng wrapper', add_help=False)

    # just give me one anonymous argument group
    myargs = parser.add_argument_group()

    # optional args
    myargs.add_argument('-h', help = "show this help message", action = "help")
    myargs.add_argument('-l', help = 'WEP bits. If none given all are tried.', required = False,
        choices = bits_choices, nargs = '?', dest = 'bits', type=int)
    myargs.add_argument('-h', help="show this help message", action="help")
    myargs.add_argument('-l', help='WEP bits. If none given all are tried.', required=False,
                        choices=bits_choices, nargs='?', dest='bits', type=int)

    # required args
    myargs.add_argument('-r', help = "PCAP with WEP traffic", required = True, dest = 'pcap')
    myargs.add_argument('-w', help = "wordlist", required = True, dest = 'wordlist')
    myargs.add_argument('-r', help="PCAP with WEP traffic", required=True, dest='pcap')
    myargs.add_argument('-w', help="wordlist", required=True, dest='wordlist')

    main(parser.parse_args())