|
|
@@ -0,0 +1,40 @@ |
|
|
|
#include <iostream> |
|
|
|
#include <iomanip> |
|
|
|
#include <string> |
|
|
|
#include <sstream> |
|
|
|
#include <windows.h> |
|
|
|
#include <wincred.h> |
|
|
|
|
|
|
|
void print_bytes(const DWORD length, const LPBYTE bytes) { |
|
|
|
if (length == 0) |
|
|
|
return; |
|
|
|
std::cout << "\t"; |
|
|
|
std::stringstream ss; |
|
|
|
for (DWORD i = 0; i < length; ++i) |
|
|
|
ss << bytes[i]; |
|
|
|
|
|
|
|
auto s = ss.str(); |
|
|
|
if (s.c_str()[1] == '\0') |
|
|
|
for (size_t i = 0; i < s.length(); i += 2) |
|
|
|
std::cout << s.at(i); |
|
|
|
else |
|
|
|
std::cout << ss.str(); |
|
|
|
std::cout << std::endl; |
|
|
|
} |
|
|
|
|
|
|
|
int main(int argc, char* argv[]) |
|
|
|
{ |
|
|
|
DWORD count; |
|
|
|
PCREDENTIAL *creds = 0x0; |
|
|
|
CredEnumerate(0x0, |
|
|
|
CRED_ENUMERATE_ALL_CREDENTIALS, |
|
|
|
&count, |
|
|
|
&creds); |
|
|
|
for (auto cred = creds; *cred != nullptr; ++cred) { |
|
|
|
std::wcout << (*cred)->TargetName << L":" << std::endl; |
|
|
|
print_bytes((*cred)->CredentialBlobSize, (*cred)->CredentialBlob); |
|
|
|
|
|
|
|
} |
|
|
|
CredFree(creds); |
|
|
|
return 0; |
|
|
|
} |