public static void RunOnDevice(HashDevice device, string userName, string password) { var hasSSH = DeviceUtil.HasProgram(device, ProgramType.SSH); if (hasSSH) { if (DeviceUtil.TryLogin(device, userName, password)) { var user = DeviceUtil.FindUserByName(device, userName); DeviceUtil.ChangeDevice(device, user); var msg = string.Format("Successfully logged into '{0}'", device.DeviceName); msg = TextUtil.Success(msg); TerminalUtil.ShowText(msg); } else { var msg = "Username or password invalid."; msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } } else { var msg = "The device '{0}' is not running a SSH instance, therefore cannot be accessed using a SSH."; msg = string.Format(msg, device.IpAddress); msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } }
public static void Execute(ProgramExecutionOptions options) { if (ProgramUtil.ShowHelpIfNeeded(options)) { return; } if (CommandLineUtil.ValidateArguments(options.ParsedArguments, Validations)) { var target = CommandLineUtil.FindArgumentByName(options.ParsedArguments, TargetArgName).Value; var userName = CommandLineUtil.FindArgumentByName(options.ParsedArguments, UserNameArgName).Value; var password = CommandLineUtil.FindArgumentByName(options.ParsedArguments, PasswordArgName).Value; var device = DeviceUtil.FindDeviceByIpOrName(target); if (device == null) { var msg = string.Format("No device found with IP or Name equal to '{0}'.", target); msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } else { RunOnDevice(device, userName, password); } } else { TerminalUtil.ShowText("ERROR, PLEASE USE HELP. DUMB ASS"); } }
private void OnOpenPrivateKey(object sender, System.EventArgs e) { string fn = TerminalUtil.SelectPrivateKeyFileByDialog(this); if (fn != null) { _privateKeyBox.Text = fn; } }
private void _privateKeySelect_Click(object sender, EventArgs e) { string fn = TerminalUtil.SelectPrivateKeyFileByDialog(this.ParentForm); if (fn != null) { _privateKeyFile.Text = fn; } }
private void OpenKeyFile(object sender, EventArgs args) { string fn = TerminalUtil.SelectPrivateKeyFileByDialog(this); if (fn != null) { _tKeyFile.Text = fn; } }
private void OnOpenPrivateKey(object sender, System.EventArgs e) { string fn = TerminalUtil.SelectPrivateKeyFileByDialog(this); if (fn != null) { _privateKeyFile.Text = fn; } _privateKeySelect.Focus(); //どっちにしても次のフォーカスは鍵選択ボタンへ }
void Start() { _historyStack = usePrebuiltHistory ? TerminalUtil.PrebuiltHistory() : new Stack <string>(); _historyStack = _historyStack ?? new Stack <string>(); _passedOverStack = new Stack <string>(); _text = GetComponent <Text>(); _text.alignment = TextAnchor.LowerLeft; }
/// <summary> /// 秘密鍵ファイル選択ボタンクリックイベント /// </summary> private void _openKeyFileButton_Click(object sender, EventArgs e) { string fn = TerminalUtil.SelectPrivateKeyFileByDialog(this); if (fn != null) { _keyFileBox.Text = fn; } _keyFileBox.Focus(); }
private void OnAddButton(object sender, System.EventArgs e) { string fn = TerminalUtil.SelectPrivateKeyFileByDialog(this); if (fn != null) { AgentPrivateKey key = new AgentPrivateKey(fn); if (key.GuessValidKeyFileOrWarn(this)) { InputPassphraseDialog dlg = new InputPassphraseDialog(key); if (dlg.ShowDialog(this) == DialogResult.OK) { AddListItem(key); } } } }
void Start() { _inputManager = FindObjectOfType <TerminalInputManager>(); _terminalHistory = FindObjectOfType <TerminalHistory>(); _availableCommandList = new Dictionary <string, string>(); var commands = TerminalUtil.GetAvailableCommandList(); if (commands == null || !commands.commands.Any()) { return; } foreach (var command in commands.commands) { if (_availableCommandList.ContainsKey(command.key)) { continue; } _availableCommandList.Add(command.key, command.summary); } }
public CommandResult Exec(CID id) { switch (id) { case CID.Close: return(Close()); case CID.Reproduce: return(Reproduce()); case CID.SaveShortcut: return(SaveShortCut()); case CID.ShowServerInfo: return(ShowServerInfo()); case CID.RenameTab: return(RenameTab()); case CID.Paste: return(Paste()); case CID.PasteFromFile: return(PasteFromFile()); case CID.ClearScreen: return(ClearScreen()); case CID.ClearBuffer: return(ClearBuffer()); case CID.SelectAll: return(SelectAll()); case CID.ToggleNewLine: return(SetTransmitNewLine(TerminalUtil.NextNewLineOption(_connection.Param.TransmitNL))); case CID.ToggleLocalEcho: return(SetLocalEcho(!_connection.Param.LocalEcho)); case CID.LineFeedRule: return(ShowLineFeedRuleDialog()); case CID.ToggleLogSuspension: return(SetLogSuspended(!_connection.LogSuspended)); case CID.EditRenderProfile: return(EditRenderProfile()); case CID.ChangeLogFile: return(ChangeLogWithDialog()); case CID.CommentLog: return(CommentLog()); case CID.SendBreak: return(SendBreak()); case CID.AreYouThere: return(AreYouThere()); case CID.SerialConfig: return(SerialConfig()); case CID.ResetTerminal: return(ResetTerminal()); #if DEBUG case CID.DumpText: return(DumpText()); #endif case CID.NOP: return(CommandResult.Ignored); default: Debug.WriteLine("unknown connection command " + id); return(CommandResult.Ignored); } }
public override void TransmitLn(string data) { data += new string(TerminalUtil.NewLineChars(_tag.Connection.Param.TransmitNL)); _tag.Connection.WriteChars(data.ToCharArray()); }
public override void OnBuildDone() { foreach (var doorData in DataContext) { var doorZone = Builder.GetZone(doorData.DoorZoneLayer, doorData.DoorZoneIndex); var door = Builder.GetSpawnedDoorInZone(doorZone); if (door == null) { continue; } var doorWaveManager = new LG_DoorMultiWave(); doorWaveManager.Door = door; doorWaveManager.MessageData = doorData.Messages; RegisterUpdateEvent(doorWaveManager.OnUpdate); Replicators.Add(doorWaveManager); doorWaveManager.Setup(ReplicatorType.LevelInstance, ReplicatorCHType.GameOrderCritical, new DoorWaveState() { WaveCount = 0, PhaseStatus = PhaseType.Initialized }); var initPuzzle = ChainedPuzzleUtil.SetupDoor(doorData.ChainedPuzzleToActive, door); initPuzzle.SolvedMessageDuration = 0.0f; initPuzzle.Solved = () => { doorWaveManager.TriggerDoor(); }; var doorLock = door.m_locks.Cast <LG_SecurityDoor_Locks>(); doorLock.m_intOpenDoor.InteractionMessage = doorData.StartMessage; doorLock.m_intCustomMessage.m_message = doorData.LockdownMessage; doorLock.ChainedPuzzleToSolve = initPuzzle.Instance; var waveCount = doorData.WaveDatas.Length; doorWaveManager.WaveInfos = new WaveInfo[waveCount]; for (int i = 0; i < waveCount; i++) { var waveData = doorData.WaveDatas[i]; var waveInfo = new WaveInfo { RawData = waveData }; doorWaveManager.WaveInfos[i] = waveInfo; //Setup ChainedPuzzle ChainedPuzzleContext puzzle = null; if (ChainedPuzzleUtil.IsValidID(waveData.PuzzleID)) { puzzle = ChainedPuzzleUtil.SetupDoor(waveData.PuzzleID, door); } else if (i == 0) { puzzle = ChainedPuzzleUtil.SetupDoor(4, door); Logger.Warning("ChainedPuzzleToActive should always have ValidPuzzle ID!, Replaced with id: 4"); } //Assign Puzzle Instance if (puzzle != null) { puzzle.SolvedMessage = string.Empty; puzzle.SolvedMessageDuration = 0.0f; waveInfo.PuzzleToStart = puzzle; } else { Logger.Warning("ChainedPuzzle was null!, Wave: {0}", i + 1); } //Setup Verification Terminal if (waveData.SearchPhaseType == SearchType.SearchTerminal && Builder.TryGetZone(waveData.TerminalZoneLayer, waveData.TerminalZoneIndex, out var terminalZone)) { var terminal = Builder.GetSpawnedTerminalInZone(terminalZone, waveData.TerminalPickMode); if (terminal == null) { Logger.Warning("Unable to find Terminal Instance for Search Phase!, Wave: {0}", i + 1); continue; } //Add Local Log waveInfo.VerifyTerminal = terminal; waveInfo.ValidFileName = waveData.GeneratedFileName; terminal.AddLocalLog(new TerminalLogFileData() { FileName = waveData.GeneratedFileName, FileContent = waveData.GeneratedFileContent }); //Add Controller Command TerminalUtil.AddCommand(terminal, doorData.PushKeyCommand, doorData.PushKeyCommandDesc, (eTerm, arg1, arg2) => { DoorCommandHandler(doorWaveManager, doorData.PushKeyCommand, eTerm, arg1, arg2); }); //Has Valid ChainedPuzzle Setting for Terminal var verifyPuzzleID = waveData.TerminalChainedPuzzleToVerify; if (ChainedPuzzleUtil.TryGetBlock(verifyPuzzleID, out var block)) { var terminalPuzzle = ChainedPuzzleUtil.SetupTerminal(block, terminal); waveInfo.PuzzleToVerify = terminalPuzzle; } } } } }