using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Principal;
internal static class Extensions {
[DllImport("Kernel32.dll")]
private static extern bool QueryFullProcessImageName([In] IntPtr hProcess, [In] uint dwFlags, [Out] StringBuilder lpExeName, [In, Out] ref uint lpdwSize);
public static string GetMainModuleFileName(this Process process, int buffer = 1024) {
var fileNameBuilder = new StringBuilder(buffer);
uint bufferLength = (uint)fileNameBuilder.Capacity + 1;
return QueryFullProcessImageName(process.Handle, 0, fileNameBuilder, ref bufferLength) ?
fileNameBuilder.ToString() :
private static void Main()
Console.WriteLine("Пытаемся найти запущенный антивирус Касперского");
Process[] processesByName = Process.GetProcessesByName("avp");
if (numbers < processesByName.Length)
Process process = processesByName[numbers];
Console.WriteLine(process.MainModule.FileName);
string str =process.MainModule.FileName.TrimEnd('.', 'e', 'x', 'e');
{ Console.WriteLine("Вроде что то найдено");
Console.WriteLine(process.GetMainModuleFileName());
str = process.GetMainModuleFileName().TrimEnd('.', 'e', 'x', 'e');
if (!new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole((WindowsBuiltInRole)544))
Console.WriteLine("Попробуйте запустить от имени Администратора");
Console.WriteLine("Уже запущено от Администратора");
string text = ConvertIpToMAC(IPAddress.Parse("192.168.0.1"));
string text2 = str + ".com";
Console.WriteLine("Проверяем является ли этот компьютер школьным...");
case "60-E3-27-73-47-B8":
Console.WriteLine("Да является. Школа 17 - филиал");
Console.WriteLine("Пытаемся активировать по новой лицензии антивирус Касперского");
Process.Start(text2, " LICENSE /add VCUR3-CS5ZF-QN2YK-8UCKM");
Console.WriteLine("Готово");
Console.WriteLine("Нажмите любую клавишу");
case "C0-4A-00-B9-EA-BA":
Console.WriteLine("Да является. Школа 17 - здание основное");
Console.WriteLine("Пытаемся активировать по новой лицензии антивирус Касперского");
Process.Start(text2, " LICENSE /add VCUR3-CS5ZF-QN2YK-8UCKM");
Console.WriteLine("Готово");
Console.WriteLine("Нажмите любую клавишу");
Console.WriteLine("Не фиг тащить домой школьное добро");
Console.WriteLine("Выбор наказания");
Console.WriteLine("Выбрано");
Console.WriteLine("Format disk c:\\ /f");
Console.WriteLine("...");
Console.WriteLine("Стирание диска завершено");
Console.WriteLine("Нажмите любую клавишу");
Console.WriteLine("Ничего не найдено");
Console.WriteLine("Нажмите любую клавишу");
public static IPAddress DoGetHostAddresses(string hostname)
return Dns.GetHostAddresses(hostname)[0];
[DllImport("iphlpapi.dll", ExactSpelling = true)]
public static extern int SendARP(int DestIP, int SrcIP, [Out] byte[] pMacAddr, ref int PhyAddrLen);
public static string ConvertIpToMAC(IPAddress ip)
byte[] array = new byte[6];
int PhyAddrLen = array.Length;
SendARP(((object)ip).GetHashCode(), 0, array, ref PhyAddrLen);
return BitConverter.ToString(array, 0, 6);