I'm looking at the windows credential manager. Just wrote a tiny bit of code to naively dump the contents of the credential store.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
976B

  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. #include <sstream>
  5. #include <windows.h>
  6. #include <wincred.h>
  7. #include <conio.h>
  8. void print_bytes(const DWORD length, const LPBYTE bytes) {
  9. if (length == 0)
  10. return;
  11. std::cout << "\t";
  12. std::stringstream ss;
  13. for (DWORD i = 0; i < length; ++i)
  14. ss << bytes[i];
  15. auto s = ss.str();
  16. if (s.c_str()[1] == '\0')
  17. for (size_t i = 0; i < s.length(); i += 2)
  18. std::cout << s.at(i);
  19. else
  20. std::cout << ss.str();
  21. std::cout << std::endl;
  22. }
  23. int main(int argc, char* argv[])
  24. {
  25. DWORD count;
  26. PCREDENTIAL *creds = 0x0;
  27. CredEnumerate(0x0,
  28. CRED_ENUMERATE_ALL_CREDENTIALS,
  29. &count,
  30. &creds);
  31. for (auto cred = creds; *cred != nullptr; ++cred) {
  32. std::wcout << (*cred)->TargetName << L":" << std::endl;
  33. print_bytes((*cred)->CredentialBlobSize, (*cred)->CredentialBlob);
  34. }
  35. CredFree(creds);
  36. std::cout << "Press any key to continue..." << std::endl;
  37. std::cout.flush();
  38. _getch();
  39. return 0;
  40. }