Created
January 28, 2018 21:32
-
-
Save wray/c39770c99de035f39322d939560179c8 to your computer and use it in GitHub Desktop.
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 time | |
import itertools | |
chars = "abcdefghijklmnopqrstuvwxyziABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890^?!?$%&/()=?`'+#*'~';:_,.-<>|" | |
def brute_force_chars(pin): | |
for guess in list(itertools.product(list(chars),repeat=len(pin))): | |
if pin == len(pin)*'%c' % (guess): | |
return guess | |
def brute_force_split(pin,n): | |
split = len(pin)//n | |
l = [ pin[i*n:(i+1)*n] for i in range(split) ] | |
# Must wait for all to complete | |
return [ brute_force_chars(ppin) for ppin in l ] | |
if __name__ == '__main__': | |
""" Pword of size 1009 will return SLOWLY """ | |
print('Provide a pword whose length is divisible by 3 to be brute-force guessed') | |
pin = input() | |
t1 = time.time() | |
guess = brute_force_split(pin,3) | |
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