Sep 30, 2017 11:48 AM
(This post was last modified: Sep 30, 2017 11:53 AM by H4cker193.)
Hello all,
I am having an issue getting my code to connect to a Cisco router. I keep getting the error "pxssh failed to login". I can login to the router from my windows machine using putty but not from my Kali machine. Both are local to the network in the same subnet. Any one might know what is causing this issue?
from pexpect import pxssh
import getpass
try:
s = pxssh.pxssh()
hostname = raw_input('hostname: ')
username = raw_input('username: ')
password = getpass.getpass('password: ')
s.login (hostname, username, password)
s.sendline ('show log') # run a command
s.prompt() # match the prompt
print s.before # print everything before the prompt.
s.sendline ('show run int gi0/0')
s.prompt()
print s.before
s.sendline ('show run int gi0/1')
s.prompt()
print s.before
s.logout()
except pxssh.ExceptionPxssh, e:
print "pxssh failed on login."
print str(e)
The error I am getting is what I put to print when the connection fails. I just do not understand what is causing the issue. Any help would be highly appreciated by me. Thanks for reading.
I ran a packet capture. It shows Cisco SSHv 1.9 and OpenSSH sshv2.0. The key exchange the Inits and after the key exchange happens my client is sending a FIN packet to the cisco router.
I am having an issue getting my code to connect to a Cisco router. I keep getting the error "pxssh failed to login". I can login to the router from my windows machine using putty but not from my Kali machine. Both are local to the network in the same subnet. Any one might know what is causing this issue?
from pexpect import pxssh
import getpass
try:
s = pxssh.pxssh()
hostname = raw_input('hostname: ')
username = raw_input('username: ')
password = getpass.getpass('password: ')
s.login (hostname, username, password)
s.sendline ('show log') # run a command
s.prompt() # match the prompt
print s.before # print everything before the prompt.
s.sendline ('show run int gi0/0')
s.prompt()
print s.before
s.sendline ('show run int gi0/1')
s.prompt()
print s.before
s.logout()
except pxssh.ExceptionPxssh, e:
print "pxssh failed on login."
print str(e)
The error I am getting is what I put to print when the connection fails. I just do not understand what is causing the issue. Any help would be highly appreciated by me. Thanks for reading.
I ran a packet capture. It shows Cisco SSHv 1.9 and OpenSSH sshv2.0. The key exchange the Inits and after the key exchange happens my client is sending a FIN packet to the cisco router.


