MCPcopy Create free account
hub / github.com/Yeuoly/0xUBypass / GenerateKey

Function GenerateKey

WindowsShellcodeInjector/Utils.cpp:9–33  ·  view source on GitHub ↗

I Just do not understand... there is about 1/8 probability that encrypt would fault, but... why?? signed? I tried many ways, but.. ok, I choice a more efficiency way */

Source from the content-addressed store, hash-verified

7I tried many ways, but.. ok, I choice a more efficiency way
8*/
9void GenerateKey(std::string &public_key, std::string &private_key) {
10 bool flag = false;
11 rsa::init();
12 while (!flag) {
13 flag = true;
14 public_key = "";
15 private_key = "";
16 std::GeneratePair(private_key, public_key);
17 uint8_t shellcode[] = {
18 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
19 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78
20 };
21 uint8_t encrypted_shellcode[NEEDED_ENCRYPT_LENGTH(sizeof(shellcode))] = { 0 };
22 uint8_t decrypted_shellcode[sizeof(shellcode)] = { 0 };
23
24 std::EncryptShell(shellcode, sizeof(shellcode), encrypted_shellcode, sizeof(encrypted_shellcode), public_key);
25 std::DecryptShell(encrypted_shellcode, sizeof(encrypted_shellcode), decrypted_shellcode, sizeof(decrypted_shellcode), private_key);
26
27 for (int i = 0; i < sizeof(shellcode); i++) {
28 if (shellcode[i] != decrypted_shellcode[i]) {
29 flag = false;
30 }
31 }
32 }
33}

Callers 1

enFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected