Skip to content

Instantly share code, notes, and snippets.

import pywren
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
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
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):
@wray
wray / brute-pword.py
Last active January 28, 2018 21:28
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
@wray
wray / brute-pin-pwren.py
Created January 28, 2018 21:02
Break up the problem space for parallel submission to lambda
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
@wray
wray / brute-pin-divide.py
Last active January 28, 2018 21:13
Break up the problem to reduce memory needed
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
def brute_force_split(pin,n):
@wray
wray / brute-pin-wren.py
Created January 28, 2018 20:47
Uses PyWren to submit pin guess to lambda
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
@wray
wray / brute-pin.py
Created January 28, 2018 20:45
Simple example for brute force pin guessing
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
@wray
wray / binary_adder.py
Created October 20, 2017 20:23
Binary Adder
#
# To use these functions, you can run python and then import like -
# from binary_adder import *
#
# These methods carry out binary addition via 'digital logic'
# This is really what happens at the logic circuit level.
# So, this is a pretty abstract use of programming to illustrate
# what happens on silicon using code many, many, levels above that!
#
@wray
wray / data3.py
Last active March 25, 2017 22:33
# Pre-req's : loops, conditionals, functions, lists, tuples, and dictionaries
#
# Python 2.7
#
# Objectives: Advanced dictionaries, dictionaries as list indices
# Foundational Objectives: Databases
#
# Remember in the previous lessons, we defined a contact record using the following tuple