Last active
June 1, 2021 21:51
-
-
Save npyoung/71d18edd81dd64f113e347e18f14e6b8 to your computer and use it in GitHub Desktop.
Hashpass recovery script
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
#!/usr/bin/env python | |
import base64, getpass, hashlib, argparse, pyperclip | |
ENCODING = 'utf-8' | |
def get_pass(domain, key): | |
bits = (domain + '/' + key).encode(ENCODING) | |
for i in range(2 ** 16): | |
bits = hashlib.sha256(bits).digest() | |
password = base64.b64encode(bits)[:16].decode(ENCODING) | |
return password | |
if __name__ == "__main__": | |
ap = argparse.ArgumentParser() | |
ap.add_argument('domain', help="Domain name (i.e. www.acccounts.site.com)") | |
args = ap.parse_args() | |
domain = args.domain.strip().lower() | |
key = getpass.getpass('Key: ') | |
pyperclip.copy(get_pass(domain, key)) | |
print("Your password has been copied to your clipboard") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment