I have some solution based on SSH.NET library.
Now the department wants to monitor SSH sessions.
So they ask us to connect to something like 'proxy' SSH server and pass remote command to it to get redirected to destination machine.
Basically the question is how to send parameter to the session the way PuTTY does, when you specify it in the "Remote command" field:
using ssh.net ?
I have tried this:
var pk = new PrivateKeyFile("C:\\xxx.ppk");
client = new SshClient("x.x.x.x","login",pk);
client.ConnectionInfo.Timeout = TimeSpan.FromSeconds(10);
client.Connect();
SshCommand x = client.CreateCommand("user@server1");
var response = x.Execute();
shells = client.CreateShellStream("vt100", 250, 250, 800, 160, 512);
But when running it like this I get an error:
Error = "Pseudo-terminal will not be allocated because stdin is not a terminal.\r\nPermission denied, please try again.\r\nPermission denied, please try again.\r\nReceived disconnect from x.x.x.x port 22:2: Too many authentication failures for y\r\nDisconne...
If I do it from PuTTY and send user@server1
in "Remote command" then i get immediately asked for password for passwords of user@server1.