So basically I am doing a brute-forcing script to guess a User's password, and I need to iterate through passwords and then use each password in the loop. So basically something like this:
for password in passwords_list:
do_something_with_the_password({'Username': 'Joe', 'Password': password})
however since I will be getting the dictionary (e.g.: {'Username': 'Joe', 'Password': password}
) from user input I will need to use the password
variable before actually declaring it in my for loop. I tried using placeholders like password = None
and then declaring it in the for loop like this:
password = None
data = {'Username': 'Joe', 'Password': password} ## Got from user input
for password in passwords_list:
data['Password'] = password
do_something_with_the_password(data)
but this would be inconsistent because the for loop is actually a huge loop and I am also using multiprocessing so accessing the the dictionary would be troubling. I also tried using the eval()
command but when I tested it, it significantly slowed my program. So is there anyway to do something like this successfully?
data = {'Username': 'Joe', 'Password': password}
for password in passwords_list:
do_something_with_the_password(data) ## With it actually using the password, for that specific loop, in the dictionary