MCPcopy Index your code
hub / github.com/bytecode77/r77-rootkit / GetRandomBytes

Function GetRandomBytes

r77api/r77win.c:7–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <wchar.h>
6
7BOOL GetRandomBytes(LPVOID buffer, DWORD size)
8{
9 BOOL result = FALSE;
10
11 HCRYPTPROV cryptProvider;
12 if (CryptAcquireContextW(&cryptProvider, NULL, L"Microsoft Base Cryptographic Provider v1.0", PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
13 {
14 if (CryptGenRandom(cryptProvider, size, buffer))
15 {
16 result = TRUE;
17 }
18
19 CryptReleaseContext(cryptProvider, 0);
20 }
21
22 return result;
23}
24BOOL GetRandomString(PWCHAR str, DWORD length)
25{
26 WCHAR characters[] = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

Callers 4

GetRandomStringFunction · 0.85
ObfuscateStringLiteralsFunction · 0.85
WriteDummyShellCodeBytesFunction · 0.85
WriteObfuscatedNumberFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected