-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
69 lines (51 loc) · 1.91 KB
/
Copy pathmain.cpp
File metadata and controls
69 lines (51 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//main.cpp
#include "ShadowRebirth.h"
#include <iostream>
#define XOR_KEY 0x5A // Key for XOR
int main(int argc, char* argv[]) {
std::vector<unsigned char> encryptedHex = { 0x22, 0x6C, 0x6E, 0x3E, 0x38, 0x3D, 0x74, 0x3E, 0x36, 0x36 };
// Cleartest string e.g x64dbg.dll or ida.dll
std::wstring targetDLL;
// Decryption
for (auto hexChar : encryptedHex) {
targetDLL += static_cast<wchar_t>(hexChar ^ XOR_KEY); // XOR-Operation for every byte
}
// Other option -> defining it directly (Caution: Could be detected in static analysis)
//std::wstring targetDLL = L"x64dbg.dll";
// Find current PID
DWORD currentPID = GetCurrentProcessId();
// Find parent PID -> Function is defined in ShadowRebirth.cpp
DWORD parentPID = GetParentProcessID(currentPID);
if (parentPID == 0) {
SetColor(FOREGROUND_RED);
std::cerr << "[-] No Parent found.\n";
ResetColor();
return 1;
}
SetColor(FOREGROUND_GREEN);
std::wcout << L"[+] Parent Process ID: " << parentPID << L"\n";
std::wcout << L"[+] Current Process ID: " << currentPID << L"\n";
ResetColor();
// Initialising the anti-debugging measures
if (!InitializeAntiDebugging(currentPID, parentPID, targetDLL)) {
SetColor(FOREGROUND_RED);
std::wcerr << L"[-] Error when initialising the anti-debugging measures.\n";
ResetColor();
return 1;
}
// If the DLL was not loaded, the main logic is executed here
SetColor(FOREGROUND_GREEN);
std::wcout << L"[+] Start the main logic of the programm\n";
ResetColor();
// **Main-Logic:**
// Example PPID Spoofing for another Evasion:
// To-Do
for (int i = 10; i > 0; --i) {
std::wcout << L"Countdown: " << i << L"\n";
Sleep(1000); // wait for 1 second
}
SetColor(FOREGROUND_GREEN);
std::wcout << L"Main logic finished.\n";
ResetColor();
return 0;
}