title: Python - Brute force generator
body: <p>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. </p>
  
  <p>Brute force code:</p>
  
  <pre><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
  </code></pre>
  
  <p>Character generator code:</p>
  
  <pre><code>import itertools
  
  res = itertools.permutations(test ,length)
  for i in res: 
      print(''.join(i))
  </code></pre>
  
  <p>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.</p>