CreateCommand.Execute works on Cisco but not on Ericsson (openSSH) #1471
Replies: 1 comment
-
Updated to openSSH9.1 and it worked with shellstream. IDictionary<Renci.SshNet.Common.TerminalModes, uint> modes = new Dictionary<Renci.SshNet.Common.TerminalModes, uint>(); ShellStream shellStream4 = client4.CreateShellStream("xterm", 0, 0, 0, 0, 1024, modes); var output4 = shellStream4.Expect(new Regex(@"#"));//wait for # shellStream4.WriteLine("show release"); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Worked on this for 2 weeks now and Im completely stuck.
Goal: To execute a CLI command on an Ericsson 6371 router via C# program using SSH.Net.
What is working:
What is not working:
-When I use the program on the Ericsson router, I connect and disconnect without any problems, but no commands are executed. I have tried many cli commands even the ones that restarts the node, but they are for sure not executed from the program even if they work fine from putty.
The code is: (ignore that Im returning to Immediate window :-))
SshClient client1 = new SshClient("192.168.1.25", "user", "pass");
client1.Connect();
SshCommand sc1 = client1.CreateCommand("?");
sc1.Execute();
string answer1 = sc1.Result;
System.Diagnostics.Debug.WriteLine(answer1);
if (!client1.IsConnected)
{
System.Diagnostics.Debug.WriteLine("not connected");
}
else
{
System.Diagnostics.Debug.WriteLine("connected");
}
System.Diagnostics.Debug.WriteLine(client1.ConnectionInfo.ServerVersion);
client1.Disconnect();
if (!client1.IsConnected)
{
System.Diagnostics.Debug.WriteLine("not connected");
}
else
{
System.Diagnostics.Debug.WriteLine("connected");
}
This is the output I get:
<<
connected
SSH-2.0-OpenSSH_7.5
not connected
The SSH log from the nodes shows nothing strange. The SSH session is fine and thats it.
I have tried:
ShellStream _shellStream = client1.CreateShellStream("input", 255, 50, 400, 600, 4096);
_shellStream.WriteLine("?");
but same result.
I have googled and searched in here on anything related, but itI havnt brought me any closer to an explanation or a solution.
Im there where Im considering to change the color of the router with spray-paint, just to see if that helps..
Beta Was this translation helpful? Give feedback.
All reactions