Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hashlib, base64
- import re, sys
- def main():
- if len(sys.argv) != 2:
- print("Give a regular expression as a command-line argument")
- return
- matcher = re.compile(sys.argv[1])
- with open("/dev/urandom", "rb") as f:
- for i in xrange(0, 1000000000): # 10000000
- passpfx = base64.b64encode(f.read(5))[:-2]
- for sfx in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789":
- password = passpfx + sfx
- trip = base64.b64encode(hashlib.sha256(password).digest())[0:6]
- if matcher.match(trip):
- print((password, trip))
- main()
Add Comment
Please, Sign In to add comment