Skip to content

Instantly share code, notes, and snippets.

@Serpens
Last active May 29, 2018 16:01
Show Gist options
  • Save Serpens/116ed1586ade90d51d9305a7cb77772a to your computer and use it in GitHub Desktop.
Save Serpens/116ed1586ade90d51d9305a7cb77772a to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
import requests
from hashlib import sha1
checked_hash = sha1(sys.argv[1].encode()).hexdigest().upper()
prefix, suffix = checked_hash[:5], checked_hash[5:]
r = requests.get('https://api.pwnedpasswords.com/range/' + prefix)
if r.text.find(suffix) == -1:
print('strong password')
else:
print('weak password')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment