Hi monks,
I tried to execute some commands on firewall using ssh.
Following is my script

#!/usr/bin/perl -w # $Id: cmd.pl,v 1.4 2001/02/22 00:14:48 btrott Exp $ + use strict; + use Net::SSH::Perl; use Net::SSH::Perl::Cipher; + chomp(my $this_host = `hostname`); print "Enter a host name to connect to: [$this_host] "; chomp(my $host = <STDIN>); print "\n"; + print "Enter the port number of the remote sshd: [ssh] "; chomp(my $port = <STDIN>); print "\n"; + print "Choose a cipher from the list:\n"; my $supp = Net::SSH::Perl::Cipher::supported(); for my $ciph (sort @$supp) { printf " [%d] %s\n", $ciph, Net::SSH::Perl::Cipher::name($ciph) +; } printf "Enter a number: [%d] ", Net::SSH::Perl::Cipher::id('IDEA'); chomp(my $c = <STDIN>); print "\n"; my $ssh = Net::SSH::Perl->new($host || $this_host, port => $port || 'ssh', cipher => Net::SSH::Perl::Cipher::name($c), debug => 1); + my $this_user = scalar getpwuid($<); print "Enter your username on that host: [$this_user] "; chomp(my $user = <STDIN>); + use Term::ReadKey; + print "And your password: "; ReadMode('noecho'); chomp(my $pass = ReadLine(0)); ReadMode('restore'); print "\n"; + $ssh->login($user || $this_user, $pass); + print "Enter a command to execute: [ls -l] "; chomp(my $cmd = <STDIN>); my($out, $err) = $ssh->cmd($cmd || "ls -l"); print $out;

the cipher selected is 'DES'. With debug=1, after line 'Linux: Received encryption confirmation.' I got an error saying 'input must be 8 bytes long at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Crypt/DES.pm line 57.'

How do i correct this?

Thanks
Nalina

20040611 Edit by Corion: Added code tags, reformatted

20040611 Edit by Corion: Changed title from 'Please help me'


In reply to Net::SSH::Perl Error: 'input must be 8 bytes long' by Nalina

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.