be warned! Cisco products vary greatly.
- Net::SSH::Perl + version 2 + IOS == broken.
- Net::SSH::Perl + version 1 + PIX Firewall Module == works.
- Net::SSH::Perl + version ? + PIX standalone firewall == ?????
good luck! (plain ssh + Expect is your best bet. wink wink nudge nudge)
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new( 'rtr',
protocol => '2',
debug => 1,
interactive => 0,
);
$ssh->login( 'admin', 'password' )
or die "login\n";
$ssh->shell;
__END__
version 1 -> PIX Firewall Services Module
localhost: Reading configuration data /home/username/.ssh/config
localhost: Reading configuration data /etc/ssh_config
localhost: Connecting to thertr-fw, port 22.
localhost: Remote protocol version 1.5, remote software version Cisco-
+1.25
localhost: Net::SSH::Perl Version 1.25, protocol version 1.5.
localhost: No compat match: Cisco-1.25.
localhost: Connection established.
localhost: Waiting for server public key.
localhost: Received server public key (768 bits) and host key (1024 bi
+ts).
localhost: Host 'thepix' is known and matches the host key.
localhost: Encryption type: DES3
localhost: Sent encrypted session key.
localhost: Received encryption confirmation.
localhost: Trying password authentication.
localhost: Requesting pty.
localhost: Requesting shell.
localhost: Entering interactive session.
Type help or '?' for a list of available commands.
thepix-FW>
thepix-FW> exit
version 2 -> Cisco IOS
localhost: Reading configuration data /home/username/.ssh/config
localhost: Reading configuration data /etc/ssh_config
localhost: Connecting to thertr, port 22.
localhost: Remote protocol version 2.0, remote software version Cisco-
+1.25
localhost: Net::SSH::Perl Version 1.25, protocol version 2.0.
localhost: No compat match: Cisco-1.25.
localhost: Connection established.
localhost: Sent key-exchange init (KEXINIT), wait response.
localhost: Algorithms, c->s: 3des-cbc hmac-sha1 none
localhost: Algorithms, s->c: 3des-cbc hmac-sha1 none
localhost: Entering Diffie-Hellman Group 1 key exchange.
localhost: Sent DH public key, waiting for reply.
localhost: Received host key, type 'ssh-rsa'.
localhost: Host 'thertr' is known and matches the host key.
localhost: Computing shared secret key.
localhost: Verifying server signature.
localhost: Waiting for NEWKEYS message.
localhost: Enabling incoming encryption/MAC/compression.
localhost: Send NEWKEYS, enable outgoing encryption/MAC/compression.
localhost: Sending request for user-authentication service.
localhost: Service accepted: ssh-userauth.
localhost: Trying empty user-authentication request.
localhost: Authentication methods that can continue: password.
localhost: Next method to try is password.
localhost: Trying password authentication.
localhost: Login completed, opening dummy shell channel.
localhost: channel 0: new [client-session]
localhost: Requesting channel_open for channel 0.
localhost: channel 0: open confirm rwindow 1024 rmax 4096
localhost: Got channel open confirmation, requesting shell.
localhost: Requesting service shell on channel 0.
localhost: channel 1: new [client-session]
localhost: Requesting channel_open for channel 1.
localhost: Entering interactive session.
localhost: Channel open failure: 1: reason 4:
|