Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Threading;
- using System.Management;
- using System;
- using System.Diagnostics;
- using System.IO;
- using System.Reflection;
- namespace ConsoleApplication1
- {
- class Program
- {
- static int Main(string[] args)
- {
- Console.WriteLine(@"
- _____ _ _ _____ _____ ______ _ _ _____ ______ _____
- / ____| | | | __ \| __ \| ____| \ | | __ \| ____| __ \
- | (___ | | | | |__) | |__) | |__ | \| | | | | |__ | |__) |
- \___ \| | | | _ /| _ /| __| | . ` | | | | __| | _ /
- ____) | |__| | | \ \| | \ \| |____| |\ | |__| | |____| | \ \
- |_____/ \____/|_| _\_\_|__\_\______|_|_\_|_____/|______|_| \_\
- / ____/ __ \| \ | |__ __| __ \ / __ \| |
- | | | | | | \| | | | | |__) | | | | |
- | | | | | | . ` | | | | _ /| | | | |
- | |___| |__| | |\ | | | | | \ \| |__| | |____
- \_____\____/|_| \_| |_| |_| \_\\____/|______|
- ");
- Console.WriteLine("Please get rid of mouses and keyboards.");
- while (true)
- {
- BaseGame:
- int score = CountDevices();
- Console.WriteLine($"You have approximately {score} control devices.");
- if (score == 0)
- {
- int time = 15;
- for (int i = 0; i < time; ++i)
- {
- Console.WriteLine($"Thanks. We will be deleted in {time - i}s, press <Enter> to cancel.");
- score = CountDevices();
- Thread.Sleep(1000);
- if (score > 0)
- {
- goto BaseGame;
- }
- }
- SelfDestruct();
- return 4577;
- }
- Thread.Sleep(1000);
- }
- }
- static int CountDevices()
- {
- int count = 0;
- using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_PointingDevice"))
- using (ManagementObjectCollection collection = searcher.Get())
- count += collection.Count;
- using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_Keyboard"))
- using (ManagementObjectCollection collection = searcher.Get())
- count += collection.Count;
- return count;
- }
- static void SelfDestruct()
- {
- Process procDestruct = new Process();
- string strName = "destruct.bat";
- string strPath = Path.Combine(Directory
- .GetCurrentDirectory(), strName);
- string strExe = Process.GetCurrentProcess().MainModule.FileName;
- StreamWriter swDestruct = new StreamWriter(strPath);
- swDestruct.WriteLine("attrib \"" + strExe + "\"" +
- " -a -s -r -h");
- swDestruct.WriteLine(":Repeat");
- swDestruct.WriteLine("del " + "\"" + strExe + "\"");
- swDestruct.WriteLine("if exist \"" + strExe + "\"" +
- " goto Repeat");
- swDestruct.WriteLine("del \"" + strExe.Replace("exe", "zip") + "\"");
- swDestruct.WriteLine("del \"" + strName + "\"");
- swDestruct.Close();
- procDestruct.StartInfo.FileName = "destruct.bat";
- procDestruct.StartInfo.CreateNoWindow = true;
- procDestruct.StartInfo.UseShellExecute = false;
- try
- {
- procDestruct.Start();
- }
- catch (Exception)
- {
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement