public void DownlaodSCP(string key, string folderPath, string fileName) { var configs = new SSHConfig().Load(); string scpArguments; scpArguments = "-i " + configs[key].Identityfile; scpArguments += " -P " + configs[key].Port; scpArguments += " " + configs[key].User; scpArguments += "@" + configs[key].Host; scpArguments += ":./ORE/output/" + fileName; scpArguments += " " + folderPath; var downloadSCPInfo = new ProcessStartInfo(); downloadSCPInfo.FileName = @"C:\Windows\Sysnative\OpenSSH\scp.exe"; downloadSCPInfo.Arguments = scpArguments; downloadSCPInfo.CreateNoWindow = true; downloadSCPInfo.UseShellExecute = false; downloadSCPInfo.RedirectStandardOutput = true; downloadSCPInfo.RedirectStandardInput = true; var downloadSCP = Process.Start(downloadSCPInfo); downloadSCP.WaitForExit(); Console.WriteLine(downloadSCP.ExitCode.ToString()); }
private void machineProfileChange(object sender, EventArgs e) { ComboBox machineProfile = sender as ComboBox; string key = machineProfile.SelectedItem.ToString(); /*Initialization*/ this.rmError.Text = string.Empty; this.profileLabel.ForeColor = Color.Black; this.hostLabel.ForeColor = Color.Black; this.portLabel.ForeColor = Color.Black; this.userLabel.ForeColor = Color.Black; this.passLabel.ForeColor = Color.Black; if (key == "New Profile") { this.profileName.Text = string.Empty; this.host.Text = string.Empty; this.port.Text = string.Empty; this.user.Text = string.Empty; this.port.Text = string.Empty; this.password.Text = string.Empty; this.identityFile.Text = string.Empty; this.profileRemove.Enabled = false; return; } var configs = new SSHConfig().Load(); this.profileName.Text = configs[key].HostName; this.host.Text = configs[key].Host; this.port.Text = configs[key].Port; this.user.Text = configs[key].User; this.password.Text = configs[key].Password; this.identityFile.Text = configs[key].Identityfile; this.profileRemove.Enabled = true; }
private void profileSaveClick(object sender, EventArgs e) { bool errorFlag = false; /*Initialization*/ this.rmError.Text = string.Empty; this.profileLabel.ForeColor = Color.Black; this.hostLabel.ForeColor = Color.Black; this.portLabel.ForeColor = Color.Black; this.userLabel.ForeColor = Color.Black; this.passLabel.ForeColor = Color.Black; if (this.profileName.Text == string.Empty) { this.profileLabel.ForeColor = Color.Red; errorFlag = true; } if (this.host.Text == string.Empty) { this.hostLabel.ForeColor = Color.Red; errorFlag = true; } if (this.port.Text == string.Empty) { this.portLabel.ForeColor = Color.Red; errorFlag = true; } if (this.user.Text == string.Empty) { this.userLabel.ForeColor = Color.Red; errorFlag = true; } if (this.password.Text == string.Empty) { this.passLabel.ForeColor = Color.Red; errorFlag = true; } if (errorFlag) { this.rmError.Text = "Please Enter"; return; } SSHConfig sshConfig = new SSHConfig(); var config = new SSHConfig.Config { HostName = this.profileName.Text, Host = this.host.Text, Port = this.port.Text, User = this.user.Text, Password = this.password.Text, Identityfile = this.identityFile.Text, }; sshConfig.Save(config); this.loadSSHConfig(); this.machineProfile.SelectedItem = config.HostName; }
private void profileRemoveClick(object sender, EventArgs e) { SSHConfig sshConfig = new SSHConfig(); var key = this.profileName.Text; sshConfig.Remove(key); this.loadSSHConfig(); this.machineProfile.Items.Remove(key); this.machineProfile.SelectedIndex = 0; }
private void loadSSHConfig() { SSHConfig sshConfig = new SSHConfig(); var configs = sshConfig.Load(); foreach (string key in configs.Keys) { this.machineProfile.Items.Remove(key); this.machineProfile.Items.Add(key); } }
//SSH Config Load private void loadSSHConfig() { SSHConfig sshConfig = new SSHConfig(); var configs = sshConfig.Load(); foreach (string key in configs.Keys) { this.resouceSelect.Items.Remove(key); this.resouceSelect.Items.Add(key); } }
private ProcessStartInfo sshInfo(string key) { var configs = new SSHConfig().Load(); string sshArguments; sshArguments = configs[key].User; sshArguments += "@" + configs[key].Host; sshArguments += " -p " + configs[key].Port; sshArguments += " -i " + configs[key].Identityfile; var sshInfo = new ProcessStartInfo(); sshInfo.FileName = @"C:\Windows\Sysnative\OpenSSH\ssh.exe"; sshInfo.Arguments = sshArguments; sshInfo.CreateNoWindow = true; sshInfo.UseShellExecute = false; sshInfo.RedirectStandardOutput = true; sshInfo.RedirectStandardInput = true; return(sshInfo); }
public SSHDispatcher(FastTunnelServer server, Socket client, SSHConfig config) { _server = server; _client = client; _config = config; }