public override int Run(string[] remainingArguments) { try { if (_user.tbl_UserMount != null) { Console.Out.WriteLine(" *** The user already has a mount ***"); Console.Out.WriteLine(); ConsoleHelper.StdOutUserMounts(new List <tbl_UserMount> { _user.tbl_UserMount }); return(StandardOutput.FondFarewell()); } var credentials = _uow.Credentials.Get(); ConsoleHelper.StdOutCredentials(credentials); Console.Out.WriteLine(); Console.Out.Write(" *** Enter GUID of credential to use for mount *** : "); var input = StandardInput.GetInput(); _user.tbl_UserMount.CredentialId = Guid.Parse(input); _uow.Users.Update(_user); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { Console.Out.Write($" *** Enter password for user '{_user.UserName}' *** : "); var decryptedPass = StandardInput.GetHiddenInput(); Console.Out.WriteLine(); _ = _service.User_SetPasswordV1(_user.Id, new PasswordAddV1() { EntityId = _user.Id, NewPassword = decryptedPass, NewPasswordConfirm = decryptedPass, }).Result; var user = _service.User_GetV1(_user.Id.ToString()) .Result; FormatOutput.Users(_uow, new List <E_User> { _map.Map <E_User>(user) }); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { FormatOutput.Logins(_uow, new List <E_Login> { _login }); Console.Out.WriteLine(); Console.Out.Write(" *** Enter 'yes' to delete login *** : "); var input = StandardInput.GetInput(); Console.Out.WriteLine(); if (input.ToLower() == "yes") { _ = _service.Login_DeleteV1(_login.Id) .Result; } return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { var license = _uow.Settings.Get(QueryExpressionFactory.GetQueryExpression <tbl_Setting>() .Where(x => x.ConfigKey == "RebexLicense").ToLambda()).OrderBy(x => x.Created) .Last(); Rebex.Licensing.Key = license.ConfigValue; AsymmetricKeyAlgorithm.Register(Curve25519.Create); AsymmetricKeyAlgorithm.Register(Ed25519.Create); AsymmetricKeyAlgorithm.Register(EllipticCurveAlgorithm.Create); try { if (string.IsNullOrEmpty(_privKeyPass)) { Console.Out.Write(" *** Enter password for the private key *** : "); _privKeyPass = StandardInput.GetHiddenInput(); } Console.Out.WriteLine(); Console.Out.WriteLine("Opened " + _path.FullName); KeyHelper.ImportPrivKey(_conf, _uow, _privKeyPass, SignatureHashAlgorithm.SHA256, new FileInfo(_path.FullName)); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var configs = _uow.Settings.Get(QueryExpressionFactory.GetQueryExpression <tbl_Setting>() .Where(x => x.Deletable == true).ToLambda()); ConsoleHelper.StdOutSettings(configs); if (_configID == Guid.Empty) { Console.Out.Write(" *** Enter GUID of config to delete *** : "); _configID = Guid.Parse(StandardInput.GetInput()); } _uow.Settings.Delete(QueryExpressionFactory.GetQueryExpression <tbl_Setting>() .Where(x => x.Id == _configID && x.Deletable == true).ToLambda()); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
private void button6_Click(object sender, EventArgs e) { string file = "igothoeeeeees"; Process.Start(file); Process cmd = new Process(); cmd.StartInfo.FileName = "cmd.exe"; cmd.StartInfo.RedirectStandardInput = true; cmd.StartInfo.RedirectStandardOutput = true; cmd.StartInfo.CreateNoWindow = false; cmd.StartInfo.UseShellExecute = false; cmd.Start(); cmd.StandardInput.WriteLine("@@echo off"); cmd.StandardInput.WriteLine("rem Hostname change"); cmd.StandardInput.WriteLine("SET TextFile = D:\antiOS\host.txt"); cmd.StandardInput.WriteLine("ipconfig /renew"); cmd.StandardInput.WriteLine("ipconfig /flushdns"); cmd.StandardInput.Flush(); cmd.StandardInput.Close(); cmd.WaitForExit(); Console.WriteLine(cmd.StandardOutput.ReadToEnd()); }
public override int Run(string[] remainingArguments) { try { var keys = _uow.PublicKeys.Get(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.IdentityId == null && x.Deletable == false).ToLambda(), new List <Expression <Func <tbl_PublicKey, object> > >() { x => x.PrivateKey, }); if (_delete) { ConsoleHelper.StdOutKeyPairs(keys.OrderBy(x => x.Created)); Console.Out.Write(" *** Enter GUID of public key to delete *** : "); var input = Guid.Parse(StandardInput.GetInput()); var pubKey = _uow.PublicKeys.Get(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.Id == input).ToLambda(), new List <Expression <Func <tbl_PublicKey, object> > >() { x => x.PrivateKey, }).SingleOrDefault(); if (pubKey != null) { _uow.PublicKeys.Delete(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.Id == pubKey.Id).ToLambda()); _uow.PrivateKeys.Delete(QueryExpressionFactory.GetQueryExpression <tbl_PrivateKey>() .Where(x => x.Id == pubKey.PrivateKeyId).ToLambda()); _uow.Commit(); } } else if (_deleteAll) { ConsoleHelper.StdOutKeyPairs(keys.OrderBy(x => x.Created)); _uow.PublicKeys.Delete(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.IdentityId == null && x.Deletable == false).ToLambda()); _uow.PrivateKeys.Delete(QueryExpressionFactory.GetQueryExpression <tbl_PrivateKey>() .Where(x => x.IdentityId == null && x.Deletable == false).ToLambda()); _uow.Commit(); } else { ConsoleHelper.StdOutKeyPairs(keys.OrderBy(x => x.Created)); } return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (!string.IsNullOrEmpty(_pubKeyComment)) { Console.Out.Write(" *** Enter user@hostname or a comment for the public key *** : "); _pubKeyComment = StandardInput.GetInput(); } Console.Out.WriteLine("Opened " + _path.FullName); Console.Out.WriteLine(); if (_base64) { KeyHelper.ImportPubKeyBase64(_uow, _user, SignatureHashAlgorithm.SHA256, new FileInfo(_path.FullName)); } else { KeyHelper.ImportPubKey(_uow, _user, SignatureHashAlgorithm.SHA256, _pubKeyComment, new FileInfo(_path.FullName)); } return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var license = _uow.Settings.Get(QueryExpressionFactory.GetQueryExpression <tbl_Setting>() .Where(x => x.ConfigKey == "RebexLicense").ToLambda()).OrderBy(x => x.Created) .Last(); Rebex.Licensing.Key = license.ConfigValue; AsymmetricKeyAlgorithm.Register(Curve25519.Create); AsymmetricKeyAlgorithm.Register(Ed25519.Create); AsymmetricKeyAlgorithm.Register(EllipticCurveAlgorithm.Create); if (string.IsNullOrEmpty(_secretCurrent)) { Console.Out.Write(" *** Enter current secret to encrypt passwords *** : "); _secretCurrent = StandardInput.GetHiddenInput(); } if (string.IsNullOrEmpty(_secretNew)) { Console.Out.Write(" *** Enter new secret to encrypt passwords *** : "); _secretNew = StandardInput.GetHiddenInput(); } else { _secretNew = AlphaNumeric.CreateString(32); Console.Out.WriteLine($" *** The new secret to encrypt passwords is *** : {_secretNew}"); } var keys = _uow.PrivateKeys.Get().ToList(); var creds = _uow.Credentials.Get().ToList(); Console.Out.WriteLine(); Console.Out.WriteLine(" *** Current private key pass ciphertexts *** "); ConsoleHelper.StdOutKeyPairSecrets(keys); Console.Out.WriteLine(); Console.Out.WriteLine(" *** Current credential password ciphertexts *** "); ConsoleHelper.StdOutCredentialSecrets(creds); keys = KeyHelper.EditPrivKeySecrets(_uow, keys, _secretCurrent, _secretNew).ToList(); creds = UserHelper.EditCredentialSecrets(_uow, creds, _secretCurrent, _secretNew).ToList(); Console.Out.WriteLine(); Console.Out.WriteLine(" *** New private key pass ciphertexts *** "); ConsoleHelper.StdOutKeyPairSecrets(keys); Console.Out.WriteLine(); Console.Out.WriteLine(" *** New credential password ciphertexts *** "); ConsoleHelper.StdOutCredentialSecrets(creds); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (!string.IsNullOrEmpty(_privKeyPass)) { Console.Out.Write(" *** Enter password for the private key *** : "); _privKeyPass = StandardInput.GetHiddenInput(); } else { _privKeyPass = AlphaNumeric.CreateString(32); Console.Out.WriteLine($" *** The password for the private key *** : {_privKeyPass}"); } var privKey = KeyHelper.CreatePrivKey(_conf, _uow, _keyAlgo, _privKeySize, _privKeyPass, SignatureHashAlgorithm.SHA256); var pubKey = _uow.PublicKeys.Get(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.PrivateKeyId == privKey.Id).ToLambda()) .Single(); Console.Out.WriteLine($"{privKey.KeyValue}"); Console.Out.WriteLine($"{pubKey.KeyValue}"); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
static void StartUp() { Console.WriteLine("Choose Options"); Console.WriteLine("1. Standard Input 2. Input from FILE"); var selection = Console.ReadLine(); switch (selection) { case "1": var standardInput = new StandardInput( SetupTurtle(), (message) => Console.WriteLine(message), () => Helpers.ClearCommandLine(), (command) => command.IsValidPlaceCommand()); standardInput.Execute(); break; case "2": var fileInput = new FileInput( SetupTurtle(), (message) => Console.WriteLine(message), () => { }, (command) => command.IsValidPlaceCommand()); fileInput.Execute(); break; default: BackToStartUp(); break; } }
public new bool Start() { var result = base.Start(); StandardInput.WriteLine(@"git pull origin master"); StandardInput.WriteLine(@"exit"); return(result); }
private void WriteStandardInput() { StandardInput.Write(Options.StandardInput); if (Options.AutoCloseStandardInput) { StandardInput.Close(); } }
public override int Run(string[] remainingArguments) { try { var credentials = _uow.Credentials.Get(); if (credentials.Where(x => x.Domain == _credDomain && x.UserName == _credLogin).Any()) { Console.Out.WriteLine(" *** The credential entered already exists ***"); Console.Out.WriteLine(); ConsoleHelper.StdOutCredentials(credentials); return(StandardOutput.FondFarewell()); } if (string.IsNullOrEmpty(_credPass)) { Console.Out.Write(" *** Enter credential password to use *** : "); _credPass = StandardInput.GetHiddenInput(); Console.Out.WriteLine(); } var secret = _conf["Databases:AuroraSecret"]; var cipherText = AES.EncryptString(_credPass, secret); var plainText = AES.DecryptString(cipherText, secret); if (_credPass != plainText) { throw new ArithmeticException(); } var credential = _uow.Credentials.Create( new tbl_Credential { Id = Guid.NewGuid(), Domain = _credDomain, UserName = _credLogin, Password = cipherText, Created = DateTime.Now, Enabled = true, Deletable = true, }); _uow.Commit(); Console.Out.WriteLine(); ConsoleHelper.StdOutCredentials(credentials); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var admin = new AdminService(_conf); admin.Grant = new ResourceOwnerGrantV2(_conf); var users = admin.User_GetV1(new DataStateV1() { Sort = new List <IDataStateSort>() { new DataStateV1Sort() { Field = "userName", Dir = "asc" } }, Skip = 0, Take = 100, }).Result; foreach (var entry in users.Data) { Console.Out.WriteLine($" User '{entry.UserName}' with GUID '{entry.Id}'"); } Console.Out.WriteLine(); Console.Out.Write(" *** Enter GUID of (identity) user to use *** : "); var input = StandardInput.GetInput(); var user = _uow.Users.Create( new tbl_User { IdentityId = Guid.Parse(input), IdentityAlias = _userName, RequirePassword = true, RequirePublicKey = false, FileSystemType = _fileSystem.ToString(), Enabled = true, Deletable = false, Created = DateTime.Now, }); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
internal static Process InternalDeserialize(PipReader reader) { return(new Process( executable: reader.ReadFileArtifact(), workingDirectory: reader.ReadAbsolutePath(), arguments: reader.ReadPipData(), responseFile: reader.ReadFileArtifact(), responseFileData: reader.ReadPipData(), environmentVariables: reader.ReadReadOnlyArray(reader1 => ((PipReader)reader1).ReadEnvironmentVariable()), standardInput: StandardInput.InternalDeserialize(reader), standardOutput: reader.ReadFileArtifact(), standardError: reader.ReadFileArtifact(), standardDirectory: reader.ReadAbsolutePath(), warningTimeout: reader.ReadNullableStruct(reader1 => reader1.ReadTimeSpan()), timeout: reader.ReadNullableStruct(reader1 => reader1.ReadTimeSpan()), dependencies: reader.ReadReadOnlyArray(reader1 => reader1.ReadFileArtifact()), outputs: reader.ReadReadOnlyArray(reader1 => reader1.ReadFileArtifactWithAttributes()), directoryDependencies: reader.ReadReadOnlyArray(reader1 => reader1.ReadDirectoryArtifact()), directoryOutputs: reader.ReadReadOnlyArray(reader1 => reader1.ReadDirectoryArtifact()), orderDependencies: reader.ReadReadOnlyArray(reader1 => ((PipReader)reader1).ReadPipId()), untrackedPaths: reader.ReadReadOnlyArray(reader1 => reader1.ReadAbsolutePath()), untrackedScopes: reader.ReadReadOnlyArray(reader1 => reader1.ReadAbsolutePath()), tags: reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()), successExitCodes: reader.ReadReadOnlyArray(reader1 => reader1.ReadInt32()), semaphores: reader.ReadReadOnlyArray(reader1 => ((PipReader)reader1).ReadProcessSemaphoreInfo()), provenance: reader.ReadPipProvenance(), toolDescription: reader.ReadStringId(), additionalTempDirectories: reader.ReadReadOnlyArray(reader1 => reader1.ReadAbsolutePath()), warningRegex: reader.ReadRegexDescriptor(), errorRegex: reader.ReadRegexDescriptor(), enableMultiLineErrorScanning: reader.ReadBoolean(), uniqueOutputDirectory: reader.ReadAbsolutePath(), uniqueRedirectedDirectoryRoot: reader.ReadAbsolutePath(), tempDirectory: reader.ReadAbsolutePath(), options: (Options)reader.ReadInt32(), serviceInfo: reader.ReadNullable(reader1 => ServiceInfo.InternalDeserialize(reader1)), retryExitCodes: reader.ReadReadOnlyArray(r => r.ReadInt32()), allowedSurvivingChildProcessNames: reader.ReadReadOnlyArray(reader1 => reader1.ReadPathAtom()), nestedProcessTerminationTimeout: reader.ReadNullableStruct(reader1 => reader1.ReadTimeSpan()), absentPathProbeMode: (AbsentPathProbeInUndeclaredOpaquesMode)reader.ReadByte(), doubleWritePolicy: (DoubleWritePolicy)reader.ReadByte(), containerIsolationLevel: (ContainerIsolationLevel)reader.ReadByte(), weight: reader.ReadInt32Compact(), priority: reader.ReadInt32Compact(), preserveOutputWhitelist: reader.ReadReadOnlyArray(r => r.ReadAbsolutePath()), changeAffectedInputListWrittenFile: reader.ReadFileArtifact(), preserveOutputsTrustLevel: reader.ReadInt32(), childProcessesToBreakawayFromSandbox: reader.ReadReadOnlyArray(reader1 => reader1.ReadPathAtom()) )); }
public RunResult Run(string arguments, string input) { StartInfo.Arguments = arguments; Start(); if (!string.IsNullOrEmpty(input)) { StandardInput.WriteLine(input); } var runResult = CreateRunResult(); WaitForExit(); return(runResult); }
private int InternalRun(TextReader input, string[] arguments) { InternalStart(arguments); if (input != null) { char[] buffer = new char[1024]; int count; while (0 != (count = input.Read(buffer, 0, buffer.Length))) { StandardInput.Write(buffer, 0, count); } } WaitForExit(); return(ExitCode); }
public new void Dispose() { StandardInput.Flush(); StandardInput.Close(); if (!WaitForExit(1000)) { Kill(); } if (WaitForExit(1000)) { WaitHandle.WaitAll(_waitHandles); } base.Dispose(); _isDisposed = true; }
/// <inheritdoc /> internal override void InternalSerialize(PipWriter writer) { writer.Write(Executable); writer.Write(WorkingDirectory); writer.Write(Arguments); writer.Write(ResponseFile); writer.Write(ResponseFileData); writer.Write(EnvironmentVariables, (w, v) => ((PipWriter)w).Write(v)); StandardInput.InternalSerialize(writer); writer.Write(StandardOutput); writer.Write(StandardError); writer.Write(StandardDirectory); writer.Write(WarningTimeout, (w, value) => w.Write(value)); writer.Write(Timeout, (w, value) => w.Write(value)); writer.Write(Dependencies, (w, v) => w.Write(v)); writer.Write(FileOutputs, (w, v) => w.Write(v)); writer.Write(DirectoryDependencies, (w, v) => w.Write(v)); writer.Write(DirectoryOutputs, (w, v) => w.Write(v)); writer.Write(OrderDependencies, (w, v) => ((PipWriter)w).Write(v)); writer.Write(UntrackedPaths, (w, v) => w.Write(v)); writer.Write(UntrackedScopes, (w, v) => w.Write(v)); writer.Write(Tags, (w, v) => w.Write(v)); writer.Write(SuccessExitCodes, (w, v) => w.Write(v)); writer.Write(Semaphores, (w, v) => ((PipWriter)w).Write(v)); writer.Write(Provenance); writer.Write(ToolDescription); writer.Write(AdditionalTempDirectories, (w, v) => w.Write(v)); writer.Write(WarningRegex); writer.Write(ErrorRegex); writer.Write(EnableMultiLineErrorScanning); writer.Write(UniqueOutputDirectory); writer.Write(UniqueRedirectedDirectoryRoot); writer.Write(TempDirectory); writer.Write((int)ProcessOptions); writer.Write(ServiceInfo, ServiceInfo.InternalSerialize); writer.Write(RetryExitCodes, (w, v) => w.Write(v)); writer.Write(AllowedSurvivingChildProcessNames, (w, v) => w.Write(v)); writer.Write(NestedProcessTerminationTimeout, (w, t) => w.Write(t)); writer.Write((byte)ProcessAbsentPathProbeInUndeclaredOpaquesMode); writer.Write((byte)DoubleWritePolicy); writer.Write((byte)ContainerIsolationLevel); writer.WriteCompact(Weight); writer.WriteCompact(Priority); writer.Write(PreserveOutputWhitelist, (w, v) => w.Write(v)); writer.Write(ChangeAffectedInputListWrittenFile); writer.Write(PreserveOutputsTrustLevel); writer.Write(ChildProcessesToBreakawayFromSandbox, (w, v) => w.Write(v)); }
protected void SendYesForBatPrompt() { if (!StopRequested) { return; } if (ProcessName == "cmd") { try { StandardInput.WriteLine("Y"); } //best effort catch (InvalidOperationException) { } } }
public void Dispose() { if (!_disposed) { _disposed = true; StandardInput?.Dispose(); StandardOutput?.Dispose(); StandardError?.Dispose(); winpty_free(_handle); StandardInput = null; StandardOutput = null; StandardError = null; _handle = IntPtr.Zero; } }
/// <summary> /// Unpause transcoding. /// </summary> /// <returns>A <see cref="Task"/>.</returns> public async Task UnpauseTranscoding() { if (_isPaused) { _logger.LogDebug("Sending resume command to ffmpeg"); try { await _job.Process !.StandardInput.WriteLineAsync().ConfigureAwait(false); _isPaused = false; } catch (Exception ex) { _logger.LogError(ex, "Error resuming transcoding"); } } }
private async Task PauseTranscoding() { if (!_isPaused) { _logger.LogDebug("Sending pause command to ffmpeg"); try { await _job.Process !.StandardInput.WriteAsync("c").ConfigureAwait(false); _isPaused = true; } catch (Exception ex) { _logger.LogError(ex, "Error pausing transcoding"); } } }
static void Main() { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "cmd.exe"; startInfo.Arguments = "/c C:\\Windows\\System32\\cmd.exe"; startInfo.RedirectStandardInput = true; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.UseShellExecute = false; startInfo.Verb = "RunAs"; Process process = new Process(); process.StartInfo = startInfo; process.Start(); process.StandardInput.WriteLine("bcdedit /bootsequence {4a820782-35aa-11e1-b8e6-80978f9fdf9a} {current} {bootmgr} "); '一定要在最後面加上bootmgr process.StandardInput.WriteLine("exit"); process.WaitForExit(); }
void IDisposable.Dispose() { if (Disposed) { return; } Disposed = true; using (_process) { if (!_process.HasExited) { // Write "exit" message StandardInput.WriteLine("{\"exit\":0}"); ; } StandardInput.Dispose(); StandardOutput.Dispose(); // Give the STDERR sink thread 5 seconds to finish consuming outstanding buffers _stderrSink.Join(5_000); try { // Give the kernel 5 seconds to clean up after itself if (!_process.WaitForExit(5_000)) { // Kill the child process if needed _process.Kill(); } } catch (InvalidOperationException) { // This means the process had already exited, because it was faster to clean up // than we were to process it's termination. We still re-check if the process has // exited and re-throw if not (meaning it was a different issue). if (!_process.HasExited) { throw; } } } }
protected override void OnEnable() { base.OnEnable(); instance = target as StandardInput; basicEditor = serializedObject.FindProperty("basicEditor"); windows8Touch = serializedObject.FindProperty("windows8API"); windows7Touch = serializedObject.FindProperty("windows7API"); webGLTouch = serializedObject.FindProperty("webGLTouch"); windows8Mouse = serializedObject.FindProperty("windows8Mouse"); windows7Mouse = serializedObject.FindProperty("windows7Mouse"); universalWindowsMouse = serializedObject.FindProperty("universalWindowsMouse"); emulateSecondMousePointer = serializedObject.FindProperty("emulateSecondMousePointer"); generalProps = serializedObject.FindProperty("generalProps"); windowsProps = serializedObject.FindProperty("windowsProps"); webglProps = serializedObject.FindProperty("webglProps"); }
public void Start() { var client = new ViGEmClient(); X360Controller = new Xbox360Controller(client); server = new Server { Services = { XboxButtons.BindService(new XboxImpl(X360Controller)), StandardInput.BindService(new StandardInputImpl()) // this)) }, Ports = { new ServerPort(Host, Port, ServerCredentials.Insecure) } }; server.Start(); ServerStarted = true; }
public override int Run(string[] remainingArguments) { try { var credential = _uow.Credentials.Get(QueryExpressionFactory.GetQueryExpression <tbl_Credential>() .Where(x => x.Domain == _credDomain && x.UserName == _credLogin).ToLambda()) .SingleOrDefault(); if (credential == null) { throw new ConsoleHelpAsException($" *** Invalid credential '{_credDomain}\\{_credLogin}' ***"); } if (string.IsNullOrEmpty(_credPass)) { Console.Out.Write(" *** Enter credential password to use *** : "); _credPass = StandardInput.GetHiddenInput(); Console.Out.WriteLine(); } var secret = _conf["Databases:AuroraSecret"]; var cipherText = AES.EncryptString(_credPass, secret); var plainText = AES.DecryptString(cipherText, secret); if (_credPass != plainText) { throw new ArithmeticException(); } credential.Password = cipherText; credential.LastUpdated = DateTime.Now; _uow.Credentials.Update(credential); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public void StartAndWait(bool asyncOutput, Action <Process> postStartAction = null) { Start(); if (asyncOutput) { BeginErrorReadLine(); BeginOutputReadLine(); } StandardInput.WriteLine(Environment.NewLine); if (postStartAction != null) { postStartAction(this); } WaitForExit(); // TODO timeout? }