title: Adding pause and resume feature in a Wordlist Generator program
body: <p>I am creating a Wordlist for 8 character password using 13 types of characters.<br>
  My code is:</p>
  
  <pre><code>import itertools
  import pickle
  import pathlib
  import time
  from typing import TextIO, Tuple
  
  path = pathlib.Path('backup1.pkl')
  if path.exists():
  inputfile = open("backup1.pkl", "rb")
  val_comb = pickle.load(inputfile)
  
  print( val_comb  )
  time.sleep(3)
  
  f: TextIO=open("all_pass_combo_8_(3).txt","w")
  
  res = itertools.product('abcdefghjklm', repeat=8) .
  for i in res:
          print( val_comb  )
          f.write(val_comb)
          val_comb = (''.join(i) + "\n")
          output = open("backup1.pkl", 'wb')
          pickle.dump(val_comb, output)
  
  output.close()
  inputfile.close()
  f.close()
  </code></pre>
  
  <p>So, it will take several hours for me to complete the execution of the code. But, the problem is I can't keep my computer turned on for this long. And if I close/interrupt the process at any instance, I'll have the combinations saved till that instance only and then, whenever I'll try to run the execution again it will start from its very initial state.</p>
  
  <p>Some seniors told me to get my desired job done using "<code>pickle()</code>" and provided me the official link of the "<code>pickle()</code> Project Description". I read the article and jumped to YouTube for further help. Then I tried to edit my code in the format that you may see above, but I failed to perform the thing I was willing to do.  </p>
  
  <p>So, exactly what I want to do is:<br>
  I will run my program. It will run and generate a wordlist. Now, I have to shutdown my PC. So, I'll have to terminate the execution. Now, I want to preserve (or pickle) my progress in the process and when I start the execution of the program again, then it should resume from the same stage where I had left it; e.g. If I had terminated it on <code>'aaaafhgj'</code>. Then, it should start joining permutations and combination right from <code>'aaaafhgk'</code> and it should not repeat <code>'aaaaaaaa'</code> and so on, again. But my code is doing the same which I don't want to be done.</p>