I've made a brute force password cracker which works, but I also made a string combining generator which would be better as the brute force string generator; however I can't figure out how to combine the two.
Brute force code:
import random
characters = "ABCDE"
length = 5
while True:
pw = ""
#Generating Section
for i in range(length):
next_index = random.randrange(len(characters))
pw = pw + characters[next_index]
if pw == "ABCDE":
print()
print()
print("Password acquired.")
break
Character generator code:
import itertools
res = itertools.permutations(test ,length)
for i in res:
print(''.join(i))
I would like to replace the "Generating" section from the brute force code with the improved generator code but I can't do this. Please help.