- Community Home
- >
- Networking
- >
- Legacy
- >
- Switches, Hubs, Modems
- >
- Re: Script SSH Connection to Procurve Switches
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-20-2010 11:24 AM
тАО10-20-2010 11:24 AM
---------------------------
Script
---------------------------
#!/bin/perl
use Net::SSH::Perl;
$host = "IP";
my $ssh = Net::SSH::Perl->new($host, protocol => 2, debug => 1, use_pty => 1);
$ssh->login("admin","passwordomitted");
$ssh->sock->print("\n");
sleep(2);
my ($stdout, $stderr) = $ssh->cmd("sh ver\n");
print "Output: $out\n";
-----------------------------
Debug Output
-----------------------------
debian: Reading configuration data /home/timothy/.ssh/config
debian: Reading configuration data /etc/ssh_config
debian: Connecting to ip, port 22.
debian: Remote protocol version 1.99, remote software version OpenSSH_3.4p1
debian: Net::SSH::Perl Version 1.34, protocol version 2.0.
debian: No compat match: OpenSSH_3.4p1.
debian: Connection established.
debian: Sent key-exchange init (KEXINIT), wait response.
debian: Algorithms, c->s: 3des-cbc hmac-sha1 none
debian: Algorithms, s->c: 3des-cbc hmac-sha1 none
debian: Entering Diffie-Hellman Group 1 key exchange.
debian: Sent DH public key, waiting for reply.
debian: Received host key, type 'ssh-rsa'.
debian: Host 'ip' is known and matches the host key.
debian: Computing shared secret key.
debian: Verifying server signature.
debian: Waiting for NEWKEYS message.
debian: Send NEWKEYS.
debian: Enabling encryption/MAC/compression.
debian: Sending request for user-authentication service.
debian: Service accepted: ssh-userauth.
debian: Trying empty user-authentication request.
debian: Authentication methods that can continue: password.
debian: Next method to try is password.
debian: Trying password authentication.
debian: Login completed, opening dummy shell channel.
debian: channel 0: new [client-session]
debian: Requesting channel_open for channel 0.
debian: channel 0: open confirm rwindow 0 rmax 32768
debian: Got channel open confirmation, requesting shell.
debian: Requesting service shell on channel 0.
debian: channel 1: new [client-session]
debian: Requesting channel_open for channel 1.
I am also open to writing the script in another language, as long as it will work.
Thanks,
Tim Stella
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2010 01:46 AM
тАО10-21-2010 01:46 AM
Re: Script SSH Connection to Procurve Switches
That's about as far as I got using Net::SSH on a Windows host. There was no way of getting the session to complete and I couldn't find anyone else that had managed it.
Even passing commands directly using plink fails to work.
A colleague had it working using a horrible method of auto-pasting commands into an open putty window.
In the end I decided all we needed from the scripts was a copy of the configs so I use SCP to pull that down and we use PCM+ for anything that requires us to send batches of commands.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2010 01:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2010 08:11 AM
тАО10-21-2010 08:11 AM
Re: Script SSH Connection to Procurve Switches
I've been looking into ttmacro/tera term. Looks pretty good. Would it be possible for you to post of one of your scripts? I seem to be having some problems getting mine to connect correctly.
Thank you,
Tim Stella
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2010 09:03 PM
тАО10-21-2010 09:03 PM
Re: Script SSH Connection to Procurve Switches
here is a place for a lot of informations and scripts for tterm and ttmacro:
http://logmett.com/forum/index.php
there u can as well find a script to connect via ssh.
for example:
connect 'xxxx.xxx.xxx.xx:22 /ssh /auth=password /user=net/passwd=xxxxx'
ShowRun = 'show run'
mpause 3000
sendln ShowRun#
hth
alex