PaulCara

Pw_crack_CS_pcarabas_py

Oct 27th, 2020
1,261
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import itertools as it
  2. import string
  3. from passlib.hash import sha512_crypt
  4. import multiprocessing
  5. from multiprocessing import Pool
  6.  
  7. enc_pas = '$6$XPmWkpus$jZiSDOKdMMRZQhaCLULUO9baoau4D3Vot7tKNFqJQkStExZp9afA9rHnZ6iih8khjfkZLUbgKWIvIKQUKr7dL1'
  8.  
  9. # create the list of used characters
  10. in_list = list(string.ascii_lowercase)
  11. in_list += ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
  12. in_list += ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')']
  13.  
  14. # function to encrypt(sha512) a possible password and verify if it matches the real one
  15. def try_pass(s):
  16.     dec_pas = ">>>:::sec20f:::<<<" + "".join(s) + "@x(h"
  17.     res = sha512_crypt.using(rounds=5000, salt="XPmWkpus").verify(dec_pas, enc_pas)
  18.     if(res):
  19.         print(dec_pas)
  20.         return dec_pas
  21.     else:
  22.         return None
  23.  
  24.  
  25. if __name__ == '__main__':
  26.     # create processes that each run the try_pass() function
  27.     with Pool(processes=multiprocessing.cpu_count()) as pool:
  28.         # create a generator that that gives a character combination to the trypass() function
  29.         for i in pool.imap_unordered(try_pass, it.product(in_list, repeat=5)):
  30.             if i:
  31.                 with open("cracked_pass.txt", "w") as file:
  32.                     file.write(i)
  33.                 quit()
RAW Paste Data