Subject: | FW: Net::SSH::Expect not working to Cisco 4948 Switch |
Date: | Fri, 24 Feb 2012 17:14:18 +0000 |
To: | "bug-Net-SSH-Expect [...] rt.cpan.org" <bug-Net-SSH-Expect [...] rt.cpan.org> |
From: | Hamish Marson <Hamish.Marson [...] lchclearnet.com> |
Net::SSH::Expect code v1.09 (The latest on CPAN)? I'm using it to talk to various Cisco switches. It works mostly, but when trying to connect to a couple of Cisco 4948 switches, it doesn't manage to login. Enabling the exp_debug and exp_internal flags it looks like the code forgets the patterns it's trying to match. E.g.
Spawned 'ssh -e none NMS_Admin@10.1.10.8<mailto:NMS_Admin@10.1.10.8>'
spawn id(4)
Pid: 18687
Tty: /dev/pts/5
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 181
Expect::spawn('Expect=GLOB(0xd285700)', 'ssh -e none NMS_Admin@10.1.10.8<mailto:NMS_Admin@10.1.10.8>') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 133
Net::SSH::Expect::run_ssh('Net::SSH::Expect=ARRAY(0xd285500)') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 196
Net::SSH::Expect::login('Net::SSH::Expect=ARRAY(0xd285500)') called at ./pollDevices line 239
main::doBackups() called at ./pollDevices line 398
timeout 1 password_prompt is [(?-xism:[Pp]assword.*?:|[Pp]assphrase.*?:)]
Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0xd285700)', 1, 'ARRAY(0xd2b7fd0)', 'ARRAY(0xd2b8070)', 'ARRAY(0xd2b8140)', 'ARRAY(0xd2b81b0)', 'ARRAY(0xd2b8280)') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 584
Net::SSH::Expect::_sec_expect('Net::SSH::Expect=ARRAY(0xd285500)', 1, 'ARRAY(0xd2b7fd0)', 'ARRAY(0xd2b8070)', 'ARRAY(0xd2b8140)', 'ARRAY(0xd2b81b0)', 'ARRAY(0xd2b8280)') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 217
Net::SSH::Expect::login('Net::SSH::Expect=ARRAY(0xd285500)') called at ./pollDevices line 239
main::doBackups() called at ./pollDevices line 398
spawn id(4): list of patterns:
#1: -re `(?-xism:\(yes/no\)\?\s*$)'
#2: -re `(?-xism:[Pp]assword.*?:|[Pp]assphrase.*?:)'
#3: -re `(?-xism:ogin:\s*$)'
#4: -re `(?-xism:REMOTE HOST IDEN)'
spawn id(4): Does `'
match:
pattern #1: -re `(?-xism:\(yes/no\)\?\s*$)'? No.
pattern #2: -re `(?-xism:[Pp]assword.*?:|[Pp]assphrase.*?:)'? No.
pattern #3: -re `(?-xism:ogin:\s*$)'? No.
pattern #4: -re `(?-xism:REMOTE HOST IDEN)'? No.
Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0xd285700)', 1) called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 584
Net::SSH::Expect::_sec_expect('Net::SSH::Expect=ARRAY(0xd285500)', 1) called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 347
Net::SSH::Expect::peek('Net::SSH::Expect=ARRAY(0xd285500)') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 213
Net::SSH::Expect::__ANON__('ARRAY(0xd2b83a0)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 828
Expect::_multi_expect(1, 'ARRAY(0xd2b8560)', 'ARRAY(0xd2b83c0)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 565
Expect::expect('Expect=GLOB(0xd285700)', 1, 'ARRAY(0xd2b7fd0)', 'ARRAY(0xd2b8070)', 'ARRAY(0xd2b8140)', 'ARRAY(0xd2b81b0)', 'ARRAY(0xd2b8280)') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 584
Net::SSH::Expect::_sec_expect('Net::SSH::Expect=ARRAY(0xd285500)', 1, 'ARRAY(0xd2b7fd0)', 'ARRAY(0xd2b8070)', 'ARRAY(0xd2b8140)', 'ARRAY(0xd2b81b0)', 'ARRAY(0xd2b8280)') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 217
Net::SSH::Expect::login('Net::SSH::Expect=ARRAY(0xd285500)') called at ./pollDevices line 239
main::doBackups() called at ./pollDevices line 398
spawn id(4): list of patterns:
spawn id(4): Does `'
match:
NMS_Admin@10.1.10.8's<mailto:NMS_Admin@10.1.10.8's> password:
spawn id(4): Does `NMS_Admin@10.1.10.8\'s password: '
match:
SSHAuthenticationError Login timed out. The input stream currently has the contents bellow: NMS_Admin@10.1.10.8's<mailto:NMS_Admin@10.1.10.8's> password: at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 828
Closing spawn id(4).
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431
Expect::hard_close('Expect=GLOB(0xd285700)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621
Expect::DESTROY('Expect=GLOB(0xd285700)') called at ./pollDevices line 0
eval {...} called at ./pollDevices line 0
spawn id(4) closed.
Pid 18687 of spawn id(4) terminated, Status: 0x01
When the password prompt is actually received, the match list is empty. Whereas it did have the usual contents the run though immediately preceeding that... It works fine to any other host (But is consistely failing to Cisco 4948 switches. I can't find anything in the return that's unusual though). Is there something in there that clears out the patterns for some reason? Any ideas?
A switch that does work (Cisco 3750E) for example gets
Spawned 'ssh -e none -T NMS_Admin@192.168.250.4'
spawn id(4)
Pid: 31013
Tty: /dev/pts/5
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 181
Expect::spawn('Expect=GLOB(0x186a2c30)', 'ssh -e none -T NMS_Admin@192.168.250.4') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 133
Net::SSH::Expect::run_ssh('Net::SSH::Expect=ARRAY(0x186a2a40)') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 196
Net::SSH::Expect::login('Net::SSH::Expect=ARRAY(0x186a2a40)') called at ./pollDevices line 242
main::doBackups() called at ./pollDevices line 401
timeout 1 password_prompt is [(?-xism:[Pp]assword.*?:|[Pp]assphrase.*?:)]
Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x186a2c30)', 1, 'ARRAY(0x186c3a80)', 'ARRAY(0x186c3b20)', 'ARRAY(0x186c3bf0)', 'ARRAY(0x186c3c60)', 'ARRAY(0x186c3d30)') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 584
Net::SSH::Expect::_sec_expect('Net::SSH::Expect=ARRAY(0x186a2a40)', 1, 'ARRAY(0x186c3a80)', 'ARRAY(0x186c3b20)', 'ARRAY(0x186c3bf0)', 'ARRAY(0x186c3c60)', 'ARRAY(0x186c3d30)') called at /usr/lib/perl5/site_perl/5.8.8/Net/SSH/Expect.pm line 217
Net::SSH::Expect::login('Net::SSH::Expect=ARRAY(0x186a2a40)') called at ./pollDevices line 242
main::doBackups() called at ./pollDevices line 401
spawn id(4): list of patterns:
#1: -re `(?-xism:\(yes/no\)\?\s*$)'
#2: -re `(?-xism:[Pp]assword.*?:|[Pp]assphrase.*?:)'
#3: -re `(?-xism:ogin:\s*$)'
#4: -re `(?-xism:REMOTE HOST IDEN)'
spawn id(4): Does `'
match:
pattern #1: -re `(?-xism:\(yes/no\)\?\s*$)'? No.
pattern #2: -re `(?-xism:[Pp]assword.*?:|[Pp]assphrase.*?:)'? No.
pattern #3: -re `(?-xism:ogin:\s*$)'? No.
pattern #4: -re `(?-xism:REMOTE HOST IDEN)'? No.
Password:
spawn id(4): Does `Password: '
match:
pattern #1: -re `(?-xism:\(yes/no\)\?\s*$)'? No.
pattern #2: -re `(?-xism:[Pp]assword.*?:|[Pp]assphrase.*?:)'? YES!!
Before match string: `'
Match string: `Password:'
After match string: ` '
Matchlist: ()
Calling hook CODE(0x186c3b70)...
H
*************************************************************************************************
This email is intended for the named recipient(s) only. Its contents are confidential and may only be retained by the named recipient(s) and may only be copied or disclosed with the consent of LCH.Clearnet Limited and/or LCH.Clearnet SA. If you are not an intended recipient please delete this e-mail and notify postmaster@lchclearnet.com.
LCH.Clearnet Limited, LCH.Clearnet SA and each other member of the LCH.Clearnet Group accept no liability, including liability for negligence, in respect of any statement in this email.
The contents of this email are subject to contract in all cases, and LCH.Clearnet Limited and/or LCH.Clearnet SA makes no contractual commitment save where confirmed by hard copy.
Cet e-mail et toutes les pièces jointes (ci-après le "message") sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou toute publication, est interdite, sauf autorisation expresse de LCH.Clearnet Limited et/ou LCH.Clearnet SA. Si ce message vous a été adressé par erreur, merci de le détruire et d'en avertir immédiatement postmaster@lchclearnet.com.
LCH.Clearnet Limited, LCH.Clearnet SA et les autres entités du groupe LCH.Clearnet Group, ne peuvent en aucun cas être tenues responsables au titre de ce message à moins qu’il n’ait fait l’objet d’un contrat signé.
LCH.Clearnet Limited, Registered Office: Aldgate House, 33 Aldgate High Street, London EC3N 1EA. Recognised as a Clearing House under the Financial Services & Markets Act 2000. Reg in England No.25932
Telephone: +44 20 7426 7000 Internet: http://www.lchclearnet.com
LCH.Clearnet SA, Siège Social, 18 rue du Quatre Septembre, 75002 Paris, Chambre de Compensation conformément au Code Monétaire et Financier.
*************************************************************************************************
Message body is not shown because it is too large.