Skip to content

Instantly share code, notes, and snippets.

@wray
Created January 28, 2018 21:13
Show Gist options
  • Save wray/4c41b4620566c839bab867b85d85e695 to your computer and use it in GitHub Desktop.
Save wray/4c41b4620566c839bab867b85d85e695 to your computer and use it in GitHub Desktop.
import pywren
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! """
print('Provide a pword to be brute-forced guessed')
pin = input()
wrenexec = pywren.default_executor()
t1 = time.time()
future = wrenexec.call_async(brute_force_chars,pin)
guess = future.result()
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