From f258c886092b187e10e039e66126a89afb697e17 Mon Sep 17 00:00:00 2001 From: kwyjibo Date: Mon, 17 Jun 2024 13:45:15 -0400 Subject: [PATCH 1/2] fix erroneous password acceptance --- src/__main__.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/__main__.py b/src/__main__.py index 36dee97..b1981c4 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -1,4 +1,5 @@ import argparse +import subprocess import os from ssid import start import urllib.request @@ -172,19 +173,28 @@ def brute_force(selected_network, passwords, args): contain = True else: time.sleep(1) - - creds = os.popen("sudo nmcli dev wifi connect \""+ - selected_network+"\" password \""+decoded_line+"\"").read() - - # print(creds) - - if ("Error:" in creds.strip()): + + commands = [ + "sudo", + "nmcli", + "dev", + "wifi", + "connect", + selected_network, + "password", + decoded_line, + ] + + try: + process = subprocess.run(commands, capture_output=True, + text=True, check=True) + sys.exit(bcolors.OKGREEN+"** KEY FOUND! **: password '" + + decoded_line+"' succeeded."+bcolors.ENDC) + except subprocess.CalledProcessError as e: if args.verbose is True: print(bcolors.FAIL+"** TESTING **: password '" + decoded_line+"' failed."+bcolors.ENDC) - else: - sys.exit(bcolors.OKGREEN+"** KEY FOUND! **: password '" + - decoded_line+"' succeeded."+bcolors.ENDC) + else: if args.verbose is True: print(bcolors.OKCYAN+"** TESTING **: password '" + From 37128a3c64f9480a938d0508a22f0fc95d1191b4 Mon Sep 17 00:00:00 2001 From: kwyjibo Date: Mon, 17 Jun 2024 13:53:19 -0400 Subject: [PATCH 2/2] remove unused variable --- src/__main__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/__main__.py b/src/__main__.py index b1981c4..a2492df 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -186,8 +186,8 @@ def brute_force(selected_network, passwords, args): ] try: - process = subprocess.run(commands, capture_output=True, - text=True, check=True) + subprocess.run(commands, capture_output=True, text=True, + check=True) sys.exit(bcolors.OKGREEN+"** KEY FOUND! **: password '" + decoded_line+"' succeeded."+bcolors.ENDC) except subprocess.CalledProcessError as e: @@ -252,4 +252,4 @@ def main(): brute_force(target, passwords, args) -main() \ No newline at end of file +main()