Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hashlib
- import binascii
- from itertools import chain, product
- from sets import Set
- def has_lower(att):
- lower = Set(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'])
- stm = False
- for i in att:
- if i in lower:
- stm = True
- break
- return stm
- def has_upper(att):
- upper = Set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
- stm = False
- for i in att:
- if i in upper:
- stm = True
- break
- return stm
- def has_digit(att):
- digit = Set(['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'])
- stm = False
- for i in att:
- if i in digit:
- stm = True
- break
- return stm
- def has_symb(att):
- symb = Set(['!', '$', '%', '^', '&', '*', '(', ')', '{', '}', ':', '@', '~', '<', '>', '?', '[', ']', ';', '#', ',', '.', '/'])
- stm = False
- for i in att:
- if i in digit:
- stm = True
- break
- return stm
- def con_passwd(key):
- m = hashlib.md5()
- m.update(key)
- key = m.hexdigest()
- return key
- def bruteforce():
- charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!$%^&*(){}:@~<>?[];#,./'
- return (''.join(candidate) for candidate in chain.from_iterable(product(charset, repeat=i) for i in range(8, 64)))
- if __name__ == "__main__":
- for attempt in bruteforce():
- if has_lower(attempt) and has_upper(attempt) and has_digit(attempt) and has_symb(attempt):
- k1 = con_passwd(attempt)
- print(attempt, k1, True)
- else:
- print(attempt, False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement