Reputation: 122
I'm trying to make a brute force type program and it gets too "b" and then just loops "b", i sort of have an idea on what is wrong but not how to fix it Here is my current code
target = input("What is the target word for you to get?\n")
chars = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "3", "4", "5", "6", "7", "8", "9"]
currPos = int()
attempt = chars[currPos]
nxt = currPos + 1
while(attempt != target):
print (attempt)
attempt = chars[nxt]
currPos += 1
currPos = int(0)
print("Success! \""+ attempt + "\" was the correct password correct!")
I know that i am going to have to change the while loop to probably a for loop maybe even containing a while loop. I'm not to sure
Upvotes: 0
Views: 38
Reputation: 26
currPos = int(0) is incorrect. Simpler to replace the loop with
for attempt in chars :
print(attempt)
Upvotes: 1