|
From: Thorsten H. <tho...@ar...> - 2009-10-30 14:51:46
|
Hi all,
I'm currently developing an application which configures a wireless
router via SSH.
So I stumbled upon SharpSSH and so far it worked out for me. But now I'm
getting into some problems:
I have some commands, that demand for a confirmation, e.g. "are you
really,really sure?". ;-)
I tried the following:
SshStream ssh = new SshStream(this.ssh_ip, this.ssh_user, this.ssh_pwd);
ssh.Prompt = ">";
ssh.RemoveTerminalEmulationCharacters = true;
ssh.Write("do something");
ssh.Write("y");
string response = ssh.ReadResponse();
ssh.Close();
MessageBox.Show("Yeehah:\n" + response);
and the following:
SshExec exec = new SshExec(this.ssh_ip, this.ssh_user);
exec.Password = this.ssh_pwd;
exec.Connect();
while(true)
{
result = exec.RunCommand("do something");
result += exec.RunCommand("y");
}
exec.Close();
But, so far, nothing works...
Any tipps, hints, etc. would be highly appreciated :-)
Thanks in advance,
Thorsten Harms
|