Skip to content

Instantly share code, notes, and snippets.

@wray
Last active January 28, 2018 21:28
Show Gist options
  • Save wray/e1f9466d890de119f689aee88ffdbd51 to your computer and use it in GitHub Desktop.
Save wray/e1f9466d890de119f689aee88ffdbd51 to your computer and use it in GitHub Desktop.
Now on to passwords
import time
import itertools
chars = "abcdefghijklmnopqrstuvwxyziABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890^?!?$%&/()=?`'+#*'~';:_,.-<>|"
def brute_force_chars(pin):
""" Uses itertools to create a cartesian product of the possible passwords """
for guess in list(itertools.product(list(chars),repeat=len(pin))):
if pin == len(pin)*'%c' % (guess):
return guess
if __name__ == '__main__':
""" Starts breaking down with a password of size 4 (i7 16GB) """
print('Provide a pword to be brute-forced guessed')
pin = input()
t1 = time.time()
guess = brute_force_chars(pin)
print('Found: ' + str(guess))
t2 = time.time()
print('Elapsed time was ' + str(t2-t1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment