Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import ctypes
  2. class CREDENTIALS(ctypes.Structure):
  3. _fields_ = [
  4. ("Flags", ctypes.c_int),
  5. ("Type", ctypes.c_int),
  6. ("TargetName", ctypes.c_wchar_p),
  7. ("Comment", ctypes.c_wchar_p),
  8. ("CredentialBlobSize", ctypes.c_int),
  9. ("CredentialBlob", ctypes.c_wchar_p),
  10. ("AttributeCount", ctypes.c_int),
  11. ("Attributes", ctypes.c_wchar_p),
  12. ("TargetAlias", ctypes.c_wchar_p),
  13. ("UserName", ctypes.c_wchar_p)
  14. ]
  15. advapi32 = ctypes.oledll.LoadLibrary('Advapi32.dll')
  16. advapi32.CredReadW.restype = ctypes.c_bool
  17. advapi32.CredReadW.argtypes = [ctypes.c_wchar_p, ctypes.c_int, ctypes.c_int, ctypes.POINTER(CREDENTIALS)]
  18. target = "login.example.com"
  19. pcred = ctypes.pointer(CREDENTIALS())
  20. ok = advapi32.CredReadW(target,1,0,pcred)
  21. cred = pcred.contents
  22. print ok, pcred, cred.UserName, cred.CredentialBlob
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement