Created
December 8, 2011 04:21
-
-
Save acidprime/1446095 to your computer and use it in GitHub Desktop.
PyObjC bridge code for reading shadow hashes
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/python | |
import binascii | |
from Cocoa import NSDictionary,NSPropertyListSerialization | |
from Cocoa import NSPropertyListImmutable | |
user = 'acid' | |
path = '/var/db/dslocal/nodes/Default/users/%s.plist' % user | |
# Read the binary plist | |
plist = NSDictionary.dictionaryWithContentsOfFile_(path) | |
# Grab the ShadowHashData key | |
dataShadowHashData = plist['ShadowHashData'][0] | |
# Convert to dictionary | |
convertDataToPlist = NSPropertyListSerialization.propertyListWithData_options_format_error_(dataShadowHashData,NSPropertyListImmutable,None,None) | |
ShadowHashData = convertDataToPlist[0] | |
for key in ShadowHashData.keys(): | |
value = binascii.hexlify(ShadowHashData[key]) | |
print '%s = %s' % (key,value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment