0

So im trying to make a brute force type program for reasons.. And so far i have made it work.. but only for one character, im am really unsure of how to increase it from checking "a" to "aa", "ab" "ba" etc. Here is the code i have so far

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"]

for attempt in chars :
    if(attempt == target):
        break
    else :
        print(attempt)   

print("Success! \""+ attempt + "\" was the correct password correct!")

UPDATE

My output desire would be where target = "password" and instead of only looping untill it reaches "9" or the end of the chars array continue so when it gets to "9" it would do "aa" - "a9" then start again "ba" to "b9" and so forth

  • can you show a sample input and desire output ? – Mazdak Jan 28 '15 at 19:25
  • 2
    possible duplicate of [Python Brute Force algorithm](http://stackoverflow.com/questions/11747254/python-brute-force-algorithm) – spirulence Jan 28 '15 at 19:27
  • updated it now @Kasra AD – Ashmoreinc2 Jan 28 '15 at 19:31
  • @spirulence i have not seen that -__- – Ashmoreinc2 Jan 28 '15 at 19:31
  • @Ashmoreinc2 still unclear , whats the final output for `password` ? – Mazdak Jan 28 '15 at 19:40
  • Okay so basically var target is the password and i dont want the loop to end untill it reaches the password (target), so if the password is longer than 1 character long (e.g "aaa") i would need the loop to loop after it has reached "9", so I need to somehow make the loop continue after "9" and go on to loop again but with another character infront. Like when the loop has reached "9" it would restart that character with a new character infront of it "9" (the last array value) becomes "aa" and "a9" would go onto be "ba" @KasraAD – Ashmoreinc2 Jan 28 '15 at 19:50
  • do you want something like `itertool.cycle` ? https://docs.python.org/2.7/library/itertools.html#itertools.cycle – Mazdak Jan 28 '15 at 20:01

0 Answers0