如果运行这段代码会发生什么(违规紫衫)
  • 板块灌水区
  • 楼主HenryLin11
  • 当前回复33
  • 已保存回复33
  • 发布时间2024/7/30 15:04
  • 上次更新2024/7/30 15:28:45
查看原帖
如果运行这段代码会发生什么(违规紫衫)
987047
HenryLin11楼主2024/7/30 15:04
(违规紫衫)
#include <bits/stdc++.h>
#include <windows.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x80000) ? 1:0)
#define showwarning(x,y) MessageBox(NULL, TEXT(x), TEXT(y), MB_OKCANCEL | MB_ICONINFORMATION)
#define ak() moux(400)
using namespace std;
int a;
string user;
POINT p;

BOOL StringToClipBoard(char* srcString);

POINT getmou();

inline void movmou(int x, int y);

void moux(int v);

void rod(int d){
	int v=d/10;
	for(int i=0;i<=10;i++){
		movmou(v,0);
		Sleep(min(50,max(5,v/5)));
		moux(65);
	}
	for(int i=0;i<=10;i++){
		movmou(0,v);
		Sleep(min(50,max(5,v/5)));
		moux(65);
	}
	for(int i=0;i<=10;i++){
		movmou(-v,0);
		Sleep(min(50,max(5,v/5)));
		moux(65);
	}
	for(int i=0;i<=10;i++){
		movmou(0,-v);
		Sleep(min(50,max(5,v/5)));
		moux(65);
	}
}

void vrod(int d){
	int v=d/10;
	int t=max(5,500/d);
	for(int i=0;i<=10;i++){
		movmou(v,0);
		Sleep(t);
		moux(65);
	}
	for(int i=0;i<=10;i++){
		movmou(0,v);
		Sleep(t);
		moux(65);
	}
	for(int i=0;i<=10;i++){
		movmou(-v,0);
		Sleep(t);
		moux(65);
	}
	for(int i=0;i<=10;i++){
		movmou(0,-v);
		Sleep(t);
		moux(65);
	}
}

void vvrod(int d){
	int v=d/3;
	for(int i=0;i<=3;i++){
		movmou(v,0);
		Sleep(1);
		moux(65);
	}
	for(int i=0;i<=3;i++){
		movmou(0,v);
		Sleep(1);
		moux(65);
	}
	for(int i=0;i<=3;i++){
		movmou(-v,0);
		Sleep(1);
		moux(65);
	}
	for(int i=0;i<=3;i++){
		movmou(0,-v);
		Sleep(1);
		moux(65);
	}
}

inline void moupos(int x, int y) {
	SetCursorPos(x, y);
	return;
}

inline void movmou(int x, int y) {
	getmou();
	moupos(p.x+x,p.y+y);
	return;
}

void moux(int v){
	getmou();
	moupos(p.x+((rand()%(v*2))-v),p.y+((rand()%(v*2))-v));
}

POINT getmou() {
	POINT cursor;
	HWND hwnd = GetForegroundWindow();
	HDC hdc = GetWindowDC(hwnd);
	GetCursorPos(&cursor);
	p.x = cursor.x;
	p.y = cursor.y;
	return cursor;
}

void paste();


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);
}
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 paste() {
	down(VK_CONTROL);
	Sleep(10);
	press(86);
	Sleep(10);
	up(VK_CONTROL);
	return;
}
void sleepx(int t){
	if(t<100){
		Sleep(100);
		return;
	}
	int v=t/100;
	for(int i=0;i<v;i++){
		Sleep(100);
		moux(65);
	}
}
void sleepxx(int t){
	if(t<100){
		Sleep(100);
		return;
	}
	int v=t/100;
	for(int i=0;i<v;i++){
		Sleep(100);
		moux(100);
	}
}
int main() {
	HWND hwnd = GetForegroundWindow();
	a = showwarning("这是一个假电脑病毒!\n\n你确定要运行此程序吗?", "警告");
	if (a == 1) {
		a = showwarning("这可不是闹着玩的!\n虽然这是一个这是一个假电脑病毒,\n但如果你运行此程序,\n那么你的电脑虽然不会损坏,\n但会很麻烦!\n\n你还有机会取消!\n确定还要运行吗?", "警告!");
		if (a == 1) {
			a = showwarning("最后一次警告!!!\n如果你运行了此程序,创建者不会负任何责任!\n\n你确定还要运行吗?!", "最后一次警告!!!");
			if (a == 1) {
				MessageBox(NULL, "既然你这么想运行我,\n那我就不客气了。", "提示", MB_OK | MB_ICONINFORMATION | MB_SYSTEMMODAL);
			} else {
				a = 3;
			}
		} else {
			a = 0;
		}
	}
	else{
		a=0;
	}
	if (a == 3) {
		MessageBox(NULL, "看来你终于醒悟了啊,\n请立马删除此病毒。", "提示", MB_OK | MB_ICONINFORMATION | MB_SYSTEMMODAL);
		return 0;
	} else if (a == 0) {
		MessageBox(NULL, "既然你不想运行我,\n请立马删除我。", "提示", MB_OK | MB_ICONINFORMATION | MB_SYSTEMMODAL);
		return 0;
	}
	ofstream out;
	out.open("Node.txt");
	out << "这是一个假电脑病毒\n";
	out << "你的电脑不会损坏,但我会炫技,你将会很麻烦!\n";
	out << "下面请欣赏我的表演!\n";
	out.close();
	system("start Node.txt");
	Sleep(3000);
	srand(time(0));
	for(int i=1;i<=50;i++){
		moux(min(i,20));
		if((rand()%50)==1){
			moux(100);
			cout<<"AK!!!\n";
		}
		Sleep(50);
	}
	for(int i=50;i<=100;i++){
		moux(min(65,i));
		if((rand()%40)==1){
			moux(200);
			cout<<"AK2!!!\n";
		}
		Sleep(50);
	}
	rod(10);
	sleepx(2000);
	rod(20);
	sleepx(1000);
	rod(40);
	sleepx(500);
	rod(50);
	for(int i=1;i<=5;i++){
		Sleep(100);
		vrod(i*100);
	}
	for(int i=5;i<=10;i++){
		Sleep(100);
		vvrod(i*100);
	}
	for(int i=0;i<=50;i++){
		Sleep(100);
		ak();
	}
	for(int i=0;i<=100;i++){
		Sleep(50);
		moupos(rand()%1000,rand()%600);
	}
}
2024/7/30 15:04
加载中...