Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Commented Unassigned: Issue with "enable" on Cisco devices [2578]

$
0
0
I have an issue with passing password to Cisco devices when trying to get to enable mode.
It detects prompt ">" correctly, then "enable" command is sent, but whole thing stops on sending password to device.

Same time, when user lands in enable shell with # as prompt everything works fine.

Passing password works fine on Linux when issuing "su - root". That has no problems.

Only Cisco enable mode is causing trouble.

Maybe someone had similat experience. Code I'm using is below.

```
ssh = new SshClient(this.HostName, this.UserName, this.UserPassword);
ssh.Connect();

stream = ssh.CreateShellStream("dumb", 80, 24, 800, 600, 1024);
reader = new StreamReader(stream);
writer = new StreamWriter(stream);
writer.AutoFlush = true;

stream.Expect(new ExpectAction[] {
new ExpectAction(">", (s)=>{Console.WriteLine("User mode.");
writer.WriteLine("enable");
var r = reader.ReadToEnd();
Thread.Sleep(3000);
writer.WriteLine("secret123" + "\r");
r = reader.ReadToEnd();
writer.Flush();
Thread.Sleep(3000);
writer.WriteLine("term len 0");
writer.WriteLine("sh config");
Console.Write(s);}),

new ExpectAction("#", (s)=>{Console.WriteLine("Enable mode.");
writer.WriteLine("term len 0");
writer.WriteLine("sh config");})
});

while (counter < 5)
{
Thread.Sleep(1000);
if (stream.DataAvailable)
{
commandResults += reader.ReadToEnd();
Console.Write(commandResults);
}
counter++;
}

ssh.Disconnect();
```
Comments: ** Comment from web user: qf3l3k **

I found out finally what was the problem. I was doing tests on Cisco 3745, which turns out, has an issue with automatic passing enable password.
Once I tried on different Cisco model (in that case it was 7200-series) all works fine.
Looks like that was problem with particular Cisco IOS on particular Cisco router.


Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>