Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ctypes
- class CREDENTIALS(ctypes.Structure):
- _fields_ = [
- ("Flags", ctypes.c_int),
- ("Type", ctypes.c_int),
- ("TargetName", ctypes.c_wchar_p),
- ("Comment", ctypes.c_wchar_p),
- ("CredentialBlobSize", ctypes.c_int),
- ("CredentialBlob", ctypes.c_wchar_p),
- ("AttributeCount", ctypes.c_int),
- ("Attributes", ctypes.c_wchar_p),
- ("TargetAlias", ctypes.c_wchar_p),
- ("UserName", ctypes.c_wchar_p)
- ]
- advapi32 = ctypes.oledll.LoadLibrary('Advapi32.dll')
- advapi32.CredReadW.restype = ctypes.c_bool
- advapi32.CredReadW.argtypes = [ctypes.c_wchar_p, ctypes.c_int, ctypes.c_int, ctypes.POINTER(CREDENTIALS)]
- target = "login.example.com"
- pcred = ctypes.pointer(CREDENTIALS())
- ok = advapi32.CredReadW(target,1,0,pcred)
- cred = pcred.contents
- print ok, pcred, cred.UserName, cred.CredentialBlob
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement