Created
May 26, 2020 11:00
-
-
Save ksaver/8042b389ec455069b7a7bf3933725051 to your computer and use it in GitHub Desktop.
Simple bruteforce a sha-1 hash
This file contains hidden or 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
# created under the alias noobcøder @sololearn | |
# https://code.sololearn.com/cpZmxS2B8657/#py | |
import hashlib | |
import string | |
import itertools | |
def bruteforce(hash_string): | |
charset = string.ascii_lowercase | |
clearpwd = '' | |
pwlen = 4 | |
for pwd in itertools.product( | |
charset, repeat=pwlen): | |
clearpwd = ''.join(pwd) | |
hashed = hashlib.sha1( | |
clearpwd.encode('utf-8')).hexdigest() | |
if hash_string == hashed: | |
print("Password Found! [{}]".format( | |
clearpwd)) | |
return | |
sha1_hash = "e6fb06210fafc02fd7479ddbed2d042cc3a5155e" | |
bruteforce(sha1_hash) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment