RSS

I'm a data journalist working for The News Journal in Delaware.

You'll probably find a lot of stuff about journalism, data and data visualization (nerd alert) and other random musings.

All things
Patrick Sweet

Archive

Jun
6th
Wed
permalink

LinkedIn hacked: Is your password among the stolen?

After hearing about LinkedIn being hacked, I dug around a little to find out how to check if your password was among the stolen ones. All the passwords are still stored as hashed values, but if you have a simple password, it could be easy to figure out and apparently many of the easier ones have already been cracked.

So, here’s a little python script I pulled together from a few different sources (read: more-or-less copied) to see whether yours is among the hacked passwords. The only caveat is that you’ll have to download the hacked passwords (be careful, and download at your own risk), which I found here http://www.mediafire.com/?n307hutksjstow3

from hashlib import sha1
import getpass
import sys

ifile = open("<INSERT PATH TO DOWLOADED PASSWORDS FILE HERE>")

hashes = []
for x in ifile:
    hashes.append(x[0:40])


def hashMyPassword(password, offset=5):
    hashed = sha1(password).hexdigest()
    return (hashed, '0' * offset + hashed[offset:])


def checkPassword():
    password = getpass.getpass("Enter Password:")
    myHash, myHashBroken = hashMyPassword(password)
    if myHash in hashes or myHashBroken in hashes:
        print "Your password was STOLEN."
    else:
        print "Your password was NOT STOLEN."
    
    checkAgain = raw_input("Check another password? (y/n): ")
    if checkAgain == "y":
        checkPassword()
    else:
        sys.exit()

if __name__ == '__main__':
    checkPassword()

Save the script as “linkedIn_check.py” and run it from the command line using “python linkedIn_check.py”.

Hope this helps. Let me know in the comments if there is a better way to do this or if I missed something.

Credit: User stordoff on Hacker News for the majority of the script.

blog comments powered by Disqus