Created
January 28, 2018 20:47
-
-
Save wray/fce47e64ed00b5b0706c6a67a71d3fd6 to your computer and use it in GitHub Desktop.
Uses PyWren to submit pin guess to lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pywren | |
import time | |
import itertools | |
def brute_force_digits(pin): | |
""" Uses itertools to create a cartesian product of the possible pins """ | |
for guess in list(itertools.product(list(range(10)),repeat=len(str(pin)))): | |
if pin == int(len(str(pin))*'%d' % (guess)): | |
return guess | |
if __name__ == '__main__': | |
""" Likewise, this will start to break down on a 8 digit pin - single lambda request """ | |
print('Provide a digit-only pin to be brute-forced guessed') | |
pin = input() | |
wrenexec = pywren.default_executor() | |
t1 = time.time() | |
future = wrenexec.call_async(brute_force_digits,int(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