public bool EditBootFileText(DtoCoreScript script) { var intercomKey = ServiceSetting.GetSettingValue(SettingStrings.IntercomKeyEncrypted); var decryptedKey = new EncryptionServices().DecryptText(intercomKey); var comServer = new ServiceClientComServer().GetServer(script.ComServerId); return(new APICall().ClientComServerApi.EditBootFileText(comServer.Url, "", decryptedKey, script)); }
public string GetBootFileText(string path, int comServerId) { var intercomKey = ServiceSetting.GetSettingValue(SettingStrings.IntercomKeyEncrypted); var decryptedKey = new EncryptionServices().DecryptText(intercomKey); var comServer = new ServiceClientComServer().GetServer(comServerId); return(new APICall().ClientComServerApi.ReadBootFileText(comServer.Url, "", decryptedKey, path)); }
public DtoActionResult Delete(int multicastId) { var multicast = _uow.ActiveMulticastSessionRepository.GetById(multicastId); if (multicast == null) { return new DtoActionResult { ErrorMessage = "Multicast Not Found", Id = 0 } } ; var computers = _uow.ActiveImagingTaskRepository.MulticastComputers(multicastId); var actionResult = new DtoActionResult(); _uow.ActiveMulticastSessionRepository.Delete(multicastId); _uow.Save(); actionResult.Id = multicast.Id; actionResult.Success = true; new ServiceActiveImagingTask().DeleteForMulticast(multicastId); if (computers != null) { foreach (var computer in computers) { if (computer != null) { new CleanTaskBootFiles().Execute(computer); } } } var comServer = new ServiceClientComServer().GetServer(multicast.ComServerId); if (comServer == null) { actionResult.Success = false; Logger.Error("Could Not find com Server With ID " + multicast.ComServerId); return(actionResult); } var intercomKey = ServiceSetting.GetSettingValue(SettingStrings.IntercomKeyEncrypted); var decryptedKey = new EncryptionServices().DecryptText(intercomKey); if (!new APICall().ClientComServerApi.TerminateMulticast(comServer.Url, "", decryptedKey, multicast)) { actionResult.Success = false; } return(actionResult); }
public DtoActionResult InitializeRemotelyServer(int comServerId) { var comServer = _uow.ClientComServerRepository.GetById(comServerId); if (comServer == null) { return(new DtoActionResult() { Success = false, ErrorMessage = "Com Server Not Found" }); } if (string.IsNullOrEmpty(comServer.RemoteAccessUrl)) { return(new DtoActionResult { Success = false, ErrorMessage = "Could Not Initialize Remote Access. The Url Was Empty" }); } var servicePassGen = new PasswordGenerator(); var remotelyUser = new RemotelyUser(); remotelyUser.Username = servicePassGen.GeneratePassword(true, true, true, false, 10); for (int i = 0; i < 1000; i++) { remotelyUser.Password = servicePassGen.GeneratePassword(true, true, true, true, 16); if (servicePassGen.ValidatePassword(remotelyUser.Password, true)) { break; } } var response = new APICall().RemoteAccessApi.CreateRemotelyFirstUser(comServer.RemoteAccessUrl, remotelyUser); if (response == null) { return(new DtoActionResult { Success = false, ErrorMessage = "Unknown Error While Initializing The Remote Access Server. Check The Logs." }); } var checkError = response; checkError = checkError.Replace("\"", ""); checkError = checkError.Replace("\\", ""); if (checkError.Equals("The Remote Access Server Has Already Been Initialized")) { return new DtoActionResult() { Success = false, ErrorMessage = "The Remote Access Server Has Already Been Initialized" } } ; try { var remotelyInfo = JsonConvert.DeserializeObject <RemotelyInfo>(response); comServer.RaUsername = remotelyUser.Username; comServer.RaPasswordEncrypted = new EncryptionServices().EncryptText(remotelyUser.Password); comServer.RaAuthHeaderEncrypted = new EncryptionServices().EncryptText(remotelyInfo.AuthHeader); comServer.RaOrganizationId = remotelyInfo.OrganizationID; } catch { return(new DtoActionResult { Success = false, ErrorMessage = "Error: Could Not Deserialize Response." }); } var result = new ServiceClientComServer().Update(comServer); if (result != null) { if (result.Success) { CopyAgentInstallerToStorage(); return(new DtoActionResult { Success = true }); } else { return new DtoActionResult { Success = false, ErrorMessage = result.ErrorMessage } }; } return(new DtoActionResult { Success = false, ErrorMessage = "Unknown Error" }); }