def removeSymlink(): clearTerm() modules.createNewLine() modules.printBlue(col,"This option will remove the symlink created in option [7].") modules.printBlue(col,"If you haven't used option [7], then this isn't necessary.") modules.printBlue(col,"However, this should be safe to run.") modules.printBlue(col,"Unless you already have another airscript-ng in /usr/local/bin.") modules.createNewLine() try: if modules.yesNo("Remove the symbolic link?",col): if functions.checkExistingSymlink(): modules.createNewLine() modules.printSuccess(col, "Found airscript-ng in /usr/local/bin.") if bashReturnValue("rm -f /usr/local/bin/airscript-ng") == "0": modules.printSuccess(col, "Successfully deleted the symlink.") modules.printGreen(col, "Typing 'airscript-ng' will no longer invoke it.") else: raise ValueError else: raise FileNotFoundError except(FileNotFoundError): modules.createNewLine() modules.printYellow(col, "Symlink not found. No need to remove anything.") except(ValueError): modules.createNewLine() modules.printYellow(col, "An error occured while removing the symlink.") modules.printYellow(col, "Try running this manually: unlink /usr/local/bin/airscript-ng") finally: functions.menuOrExit()
def removeResidualFiles(): clearTerm() modules.createNewLine() if modules.yesNo("Confirm delete all residual files?", col): bashRun("rm ~/.airscriptNG/ -rf 2>/dev/null") modules.printSuccess(col, "Successfully removed the files.") functions.menuOrExit()
def crackCaptureFile(): functions.getDependencies() try: capMethod = attacks.capObj(col) capMethod.showLogo() modules.createNewLine() print("{}Type [1] - Crack the WPA-HANDSHAKE with CPU".format( col.blue_deep)) print("{}Type [2] - Crack the WPA-HANDSHAKE with GPU (Much faster)".format( col.green_deep)) print("\n{}Type [99] - Return to menu {}".format( col.highlight, col.endl)) while True: modules.createNewLine() getOption = input(functions.displayCurrentPlace( "ENTER CHOICE", "PRE-EXISTING_HANDSHAKE")) if getOption.isdigit() and int(getOption) in [1,2,99]: break if int(getOption) == 1: capMethod.enumerateMissingOptions() capMethod.cpuCrack() elif int(getOption) == 2: capMethod.enumerateMissingOptions() capMethod.gpuCrack() #FINISH THIS except(KeyboardInterrupt, EOFError, Exception) as e: bashRun("killall aircrack-ng 2>/dev/null") bashRun("kill $(ps aux | grep -i hashcat |" " awk -F ' ' {'print $2'}) 2>/dev/null") finally: functions.menuOrExit()
def updateAptPackagesFull(): functions.getDependencies() modules.createNewLine() if modules.yesNo("Run apt update and full-upgrade?", col): bashRun("apt update && apt full-upgrade -y" " && apt autoremove -y && apt autoclean") modules.createNewLine() modules.stashAndPullUpdate(col)
def manualCardControl(): functions.getDependencies() try: interfaceMethod = attacks.interfaceObj(col) while True: interfaceMethod.displayMenu() except(KeyboardInterrupt, EOFError, Exception): modules.createNewLine() finally: functions.menuOrExit()
def menuOrExit(): while True: modules.createNewLine() getUserChoice = input("[{0}+{2}] Head to [{1}m{2}]enu" " or [{1}q{2}]uit? m/q >> ".format( col.green, col.red, col.endl)).lower() if getUserChoice.startswith('m'): mainMenu() elif getUserChoice.startswith('q'): functions.silentExit()
def hashcatDownloadFunction(): try: if not modules.connActive(): raise ConnectionError hashcatDownloader = attacks.capObj(col) hashcatDownloader.downloadHashcat() except(ConnectionError): clearTerm() modules.createNewLine() modules.printRed(col, "Internet connection not found!") finally: functions.menuOrExit()
def mdk4(): functions.getDependencies() try: mdkMethod = attacks.mdkObj(col) mdkMethod.showLogo() mdkMethod.selectAttackMode() except(KeyboardInterrupt, EOFError, Exception) as e: try: mdkMethod.cleanupCard() except(KeyboardInterrupt, EOFError, Exception): modules.createNewLine() finally: functions.menuOrExit()
def reaver(): functions.getDependencies() try: reaverMethod = attacks.wpsObj(col) reaverMethod.showLogo() reaverMethod.getWpsTargets() reaverMethod.parseWpsCsv() reaverMethod.pixieDust() reaverMethod.cleanupWpsFiles() except(KeyboardInterrupt, EOFError, Exception) as e: try: reaverMethod.cleanupWpsFiles() except(KeyboardInterrupt, EOFError, Exception): modules.createNewLine() finally: functions.menuOrExit()
def EvilTwinFakeAP(): functions.getDependencies() try: apMethod = attacks.apObj(col) apMethod.setInitialFiles() apMethod.showLogo() apMethod.selectOptions() apMethod.setupConfigFiles() apMethod.hostFakeAp() apMethod.cleanupFakeAp() except(KeyboardInterrupt, EOFError, Exception): try: apMethod.cleanupFakeAp() except(KeyboardInterrupt, EOFError, Exception): modules.createNewLine() finally: functions.menuOrExit()
def aircrackng(): functions.getDependencies() try: aircrackMethod = attacks.aircrackObj(col) aircrackMethod.showLogo() aircrackMethod.createTempFiles() aircrackMethod.selectInitialCard() aircrackMethod.gatherInitialData() aircrackMethod.parseCsvData() aircrackMethod.selectTargetNetwork() aircrackMethod.callCompleteCleanup() clearTerm() modules.printDeepBlue( col, "{1}Did you see WPA Handshake: {0} at the top right?".format( aircrackMethod.selectedNetworkTarget[1], col.green_deep)) modules.printDeepBlue( col, modules.returnBold( col, "If you didn't see that," "then {}cleanup with CTRL+C{} and try again.".format( col.red_deep, col.endl_deep))) decryptHandshake = attacks.capObj(col, aircrackMethod.captureFilePath) decryptHandshake.enumerateMissingOptions() clearTerm() modules.printDeepBlue( col, "Which method do you want to crack the Handshake with:\n") while True: choice_of_cpu_gpu = input( "{0}Crack using{1}: CPU-->[c] (all CPUs)|" " GPU-->[g] (GTX 9xx,10xx+/AMD ROCM GPU) {2}${1} ".format( col.blue_deep, col.endl, col.green)).lower() if choice_of_cpu_gpu.startswith(("c", "g")): break if choice_of_cpu_gpu.startswith("c"): decryptHandshake.cpuCrack() elif choice_of_cpu_gpu.startswith("g"): decryptHandshake.gpuCrack() except (KeyboardInterrupt, EOFError, Exception) as e: try: aircrackMethod.callCompleteCleanup() except (KeyboardInterrupt, EOFError, Exception): modules.createNewLine() finally: functions.menuOrExit()
def fetchGitHubDeps(): clearTerm() try: modules.createNewLine() modules.printBlue( col, "This will clone aircrack-ng, reaver, pixiewps and mdk4 from GitHub." ) modules.printBlue( col, "This is not normally required, as the script will automatically get" ) modules.printBlue( col, "any missing dependencies from git.kali.org. However, you can get them" ) modules.printBlue( col, "from GitHub instead of git.kali.org, if you want.") modules.createNewLine() modules.printYellow( col, "Warning: This may result in compatibility or instability issues!" ) modules.printYellow( col, "Warning: Compilation may take longer due to different procedures." ) modules.createNewLine() if modules.yesNo("Confirm download from GitHub?", col): modules.cloneAircrackGitHub() modules.cloneReaverGitHub() modules.clonePixiewpsGitHub() modules.cloneMDK4Deps() modules.createNewLine() modules.printSuccess(col, "Successfully built all dependencies.") except (KeyboardInterrupt, EOFError, Exception): modules.createNewLine() finally: functions.menuOrExit()
def createSymlink(): clearTerm() modules.createNewLine() modules.printBlue(col,"Creating a symbolic link allows you to run airscript-ng from anywhere.") modules.printBlue(col,"Essentially, this adds an entry in /usr/local/bin.") modules.printBlue(col,"Next time you want to run airscript-ng, just type 'airscript-ng'.") modules.printBlue(col,"You can run this from anywhere, any folder you want.") modules.printBlue(col,"If you change your mind, you can always delete this using option [8].") modules.createNewLine() try: if sys.argv[0].lower().startswith("./"): FILE_NAME = sys.argv[0][2:] elif sys.argv[0].lower().startswith("/usr/local/bin/"): raise TypeError else: FILE_NAME = sys.argv[0] if modules.yesNo("Create the symbolic link?",col): if not functions.checkExistingSymlink(): modules.createNewLine() modules.printSuccess(col, "Adding Symbolic link -> /usr/local/bin/airscript-ng") if bashReturnValue("ls /usr/local/bin") == "0": if bashReturnValue("echo $PATH | grep \"/usr/local/bin\"") == "0": if bashReturnValue("ln -sf $(find $(pwd) -name {}) /usr/local/bin/airscript-ng".format(FILE_NAME)) == "0": modules.printSuccess(col, "Successfully created the symlink.") modules.printGreen(col, "Now you can type 'airscript-ng' from anywhere.") modules.printGreen(col, "Go ahead, quit and try typing: airscript-ng") else: raise ValueError else: raise FileNotFoundError else: raise NotADirectoryError else: raise FileExistsError except(FileExistsError): modules.createNewLine() modules.printYellow(col, "Symbolic link already exists. Will not overwrite.") modules.printYellow(col, "Is this an error? You can delete the link manually.") modules.printYellow(col, "Try running this: unlink /usr/local/bin/airscript-ng") except(ValueError): modules.createNewLine() modules.printYellow(col, "An error occured while creating the symlink.") modules.printYellow(col, "Run this manually:") modules.printYellow(col, "ln -sf $(find $(pwd) -name {}) /usr/local/bin/airscript-ng".format( FILE_NAME)) except(FileNotFoundError): modules.createNewLine() modules.printYellow(col, "Unable to find /usr/local/bin in the $PATH env variable.") modules.printYellow(col, "If $PATH doesn't exist, then how are you running this?") modules.printYellow(col, "Otherwise, you can add to your $PATH variable by following this guide.") modules.printYellow(col, "Visit: https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux-unix") except(NotADirectoryError): modules.createNewLine() modules.printYellow(col, "Unable to find the /usr/local/bin directory.") modules.printYellow(col, "Please choose a linux distro that utilises this directory.") modules.printYellow(col, "Otherwise, I can't add the Symlink.") except(TypeError): modules.createNewLine() modules.printYellow(col, "Wrong method of invocation.") modules.printYellow(col, "You're probably running this using 'airscript-ng'.") modules.printYellow(col, "That won't work. You'll have to run it manually for this occasion.") modules.printYellow(col, "Please head to where Airscript-ng is stored.") modules.printYellow(col, "Then run it manually with: ./airscript-ng") modules.printYellow(col, "If you're confused, please consult the README.md file.") finally: functions.menuOrExit()