In Python 3.2 I wanted to brute-force a random password like: PassWord = random.randint(0,9999) I made something that could try random passwords: import random PassWord = str(random.randint(0,9999)) Trial = ' ' while Trial != PassWord: Trial = str(random.randint(0,9999)) print(Trial) if Trial == PassWord: print('The password is: '+PassWord) input() It's trying to randomly guess a password but a brute-force attack tries all possibilities. How do I first checks all possibilities with 1 digit, in the right order (0, 1, 2, 3 and so on), then 2, 3 and 4 digits? Continue reading...