Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. def brute_force_crack(hashed_pass):
  2. char_list = create_possible_chars()
  3.  
  4. # Store all string combinations
  5. password = ""
  6.  
  7. # Build the combos adding each letter to each prefix and then to combos.
  8. def build_combos(curr_str):
  9.  
  10. nonlocal password
  11.  
  12. # Check password to return early
  13. if password != "":
  14. return
  15. if len(curr_str) == 4:
  16. return
  17.  
  18. for letter in char_list:
  19. # Add letter to curr_str to build up the combo
  20. curr_str += letter
  21.  
  22. if is_password(curr_str, hashed_pass):
  23. password = curr_str
  24. break
  25.  
  26. build_combos(curr_str)
  27. # Reset curr_str to be used again in this iteration without the added letter
  28. curr_str = curr_str[:-1]
  29.  
  30. build_combos("")
  31. return password
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement