Thread: RE: [Ssh-sftp-perl-users] Interfacing with network appliance through ssh
Brought to you by:
dbrobins
From: Matthew J. S. <vag...@ya...> - 2006-03-22 19:08:42
|
If I make the suggested changes, I get the same results. The $str still prints out the same thing at the password prompt. Logging In STR: Welcome to Raritan Dominion Server Username: END USER2 STR: Password: Could not read password. Authenticating []..... Authentication Failed. Good bye. [0x9] END PASSWORD2 I'm happy to try any other suggestions. Thanks, Matt --- Eric Langheinrich <er...@er...> wrote: > What happens if instead of: > > $ssh->register_handler("stdout", sub { > my($channel, $buffer) = @_; > my $str = $buffer->bytes; > print "\nSTR: $str\nEND\n\n"; > > if ($str =~ /Username: $/) { > print "USER2\n"; > $channel->send_data("$user\n$pw\n"); > } > > elsif ($str =~ /Password/i) { > print "\nPASSWORD2\n"; > $channel->send_data($pw,"\n"); > } > > You use: > > $ssh->register_handler("stdout", sub { > my($channel, $buffer) = @_; > my $str = $buffer->bytes; > print "\nSTR: $str\nEND\n\n"; > > if ($str =~ /Username: $/) { > print "USER2\n"; > $channel->send_data("$user"); > } > > elsif ($str =~ /Password/i) { > print "\nPASSWORD2\n"; > $channel->send_data($pw,"\n"); > } > > > -----Original Message----- > > From: > ssh...@li... > > > [mailto:ssh...@li...] > On > > Behalf Of Matthew J. Salerno > > Sent: Wednesday, March 22, 2006 10:24 AM > > To: Eric Langheinrich; > ssh...@li... > > Subject: RE: [Ssh-sftp-perl-users] Interfacing > with network > > appliance through ssh > > > > What really confuses me, is when I am printing my > $str = > > $buffer->bytes; > > > > When I print print "STR: $str\nEND"; looking for > the username > > prompt, it looks normal, I get: > > > > STR: Welcome to Raritan Dominion Server > > > > Username: > > END > > > > > > But when I print "STR: $str\nEND"; looking for the > password > > prompt, I get: > > > > STR: Password: > > Could not read password. > > Authenticating []..... > > Authentication Failed. Good bye. [0x9] > > > > END > > > > > > I'm not sure why the buffer would contain failed > attempts. > > Shouldn't it just contain the Passowrd: > > line? > > > > > > > > --- Eric Langheinrich <net...@er...> > > wrote: > > > > > Wouldn't it just be simpler to use public key > auth? > > > Do you really want to > > > have scripts with your passwords hard coded? > > > > > > Have you tried doing the login as a single step, > like so: > > > $ssh->login($user, $pass); > > > > > > Here's a sample of one I have working using > public > > > key: > > > > > > #!/usr/bin/perl > > > > > > Use strict; > > > Use Net::SSH::Perl; > > > My @ident = ("/home/user/.ssh/id_dsa"); my > %params = ( > > > protocol => 2, > > > interactive => 0, > > > identity_files => [@ident], > > > debug => 0, > > > options => [ > > > "BatchMode yes", > > > "AuthenticationSuccessMsg no", > > > "ForwardX11 no", > > > "ForwardAgent no" > > > ] > > > ); > > > > > > my $server = $ARGV[0]; > > > &sshconnect($server); > > > > > > my ($stdout, $stderr, $exit) = $ssh->cmd("ls"); > > > > > > print "$stdout\n"; > > > > > > if (! $ssh) { > > > print "Unable to establish ssh > connection > > > to: $server\n"; > > > } else { > > > print "Successfully established ssh > connection to: > > $server\n"; > > > } > > > > > > sub sshconnect { > > > my $server = $_[0]; > > > our $ssh = > Net::SSH::Perl->new("$server", %params); > > > $ssh->login("user"); > > > } > > > > > > Here is an example using username/password > login: > > > > > > #/usr/bin/perl > > > > > > use strict; > > > use Net::SSH::Perl; > > > use vars qw($ssh); > > > > > > > > > my %params = ( > > > protocol => 2, > > > interactive => 0, > > > debug => 0, > > > options => [ > > > "BatchMode yes", > > > "AuthenticationSuccessMsg no", > > > "ForwardX11 no", > > > "ForwardAgent no" > > > ] > > > ); > > > > > > my $pass = "password"; > > > > > > my $server = $ARGV[0]; > > > &sshconnect($server); > > > my ($stdout, $stderr, $exit) = $ssh->cmd("ls"); > print > > "$stdout\n"; if > > > (! $ssh) { > > > print "Unable to establish ssh > connection > > > to: $server\n"; > > > } else { > > > print "Successfully established ssh > connection to: > > $server\n"; > > > } > > > > > > sub sshconnect { > > > my $server = $_[0]; > > > our $ssh = > Net::SSH::Perl->new("$server", %params); > > > $ssh->login("user", $pass); > > > } > > > > > > > > > Hope this helps. > > > > > > > > > > -----Original Message----- > > > > From: > > > ssh...@li... > > > > > > > > > > [mailto:ssh...@li...] > > > On > > > > Behalf Of Matthew J. Salerno > > > > Sent: Wednesday, March 22, 2006 8:55 AM > > > > To: ssh...@li... > > > > Subject: [Ssh-sftp-perl-users] Interfacing > with > > > network > > > > appliance through ssh > > > > > > > > I have been going nuts trying to get this to > work. > > > > > > > Any help is appreciated. > > > > > > > > > > > > I need to automate the process of logging in > to a > > > network > > > > appliance and executing a few commands. The > > > network > > > > appliance uses: OpenSSH 3.8.1 > > > > > > > > The system I am executing from is using: > > > > Redhat Linux > > > > Net::SSH::Perl 1.30 > > > > Perl 5.8.5 > > > > > > > > Here is the login process, step-by-step: > > > > # ssh username1@10.10.10.15 > > > > > > > > Then I get prompted for another username as > > > expected. > > > > > > > > Welcome to Webstream Server > > > > > > > > Username: <Enter Username> > > > > > > > > Get prompted for > > > > Password: <Enter Password> > > > > > > > > This is where I am stuck. I have been working > on > > > the login > > > > process for a few days now, and I still cant > pass > > > the server > > > > the password. I can easily get to the point > where > > > it prompts > > > > for the password, but it does not work. Any > help > > > would be > > > > greatly appreciated. > > > > Here is what I have so far: > > > > > > > > #!/usr/bin/perl -w > > > > use strict; > > > > use Net::SSH::Perl; > > > > > > > > my %params; > > > > $params{"debug"} = 0; > > > > $params{"port"} = 22; > > > > $params{"protocol"} = 2; > > > > $params{"interactive"} = 0; > > > > $params{"compression"} = 0; > > > > $params{"PreferredAuthentications"} = > 'password'; > > > > $params{"PubkeyAuthentication"} = 'no'; > > $params{"RSAAuthentication"} > > > > = 'no'; > > > $params{"use_pty"} = 0; > > > > > > > > my $host = "10.10.10.15"; > > > > my $ruser = "username1"; > > > > my $user = 'username2'; > > > > my $pw = 'mypassword'; > > > > > > > > my $ssh = new Net::SSH::Perl($host, %params) > || > > > > die "Cannot Connect to system $! > $@\n"; > > > > > > > > print "Logging In\n"; > > > > $ssh->login($ruser) || die "Cannot Login $! > $@\n"; > > > > > > > > $ssh->register_handler("stdout", sub { > > > > my($channel, $buffer) = @_; > > > > my $str = $buffer->bytes; > > > > print "\nSTR: $str\nEND\n\n"; > > > > > > > > if ($str =~ /Username: $/) { > > > > print "USER2\n"; > > > > $channel->send_data("$user\n$pw\n"); > > > > } > > > > > > > > elsif ($str =~ /Password/i) { > > > > print "\nPASSWORD2\n"; > > > > $channel->send_data($pw,"\n"); > > > > } > > > > }); > > > > > > > > my ($stdout, $stderr, $exit) = > $ssh->cmd($user); > > > > > > > > print "\n\nSTDOUT - $stdout\n" if $stdout; > print > > > "STDERR - > > > > $stderr\n" if $stderr; print "EXIT $exit\n" if > > > $exit; > > > > > > > > exit; > > > > > > > > ---------- > > > > The results are: > > > > > > > > Logging In > > > > > > > > STR: Welcome to Webstream Server > > > > > > > > Username: > > > > END > > > > > > > > USER2 > > > > > > > > STR: Password: > > > > Could not read password. > > > > Authenticating [username2]..... > > > > Authentication Failed. Good bye. [0x9] > > > > > > > > END > > > > > > > > PASSWORD2 > > > > EXIT 255 > > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Tired of spam? Yahoo! Mail has the best spam > > > protection > > > > around http://mail.yahoo.com > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.Net email is sponsored by xPML, a > > > groundbreaking > > > > scripting language > > > > that extends applications into web and mobile > > > media. Attend > > > > the live webcast > > > > and join the prime developer group breaking > into > > > this new > > > > coding territory! > > > > > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720& > > > dat=121642 > > > > > _______________________________________________ > > > > Ssh-sftp-perl-users mailing list > > > > Ssh...@li... > > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > > > > > > > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection > > around http://mail.yahoo.com > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a > groundbreaking > > scripting language > > that extends applications into web and mobile > media. Attend > > the live webcast > > and join the prime developer group breaking into > this new > > coding territory! > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720& > dat=121642 > > _______________________________________________ > > Ssh-sftp-perl-users mailing list > > Ssh...@li... > > > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Matthew J. S. <vag...@ya...> - 2006-03-23 14:52:40
|
If I use Data::Dumper to view the buffer, I see that what gets returned is an already failed authentication attempt. Is there anything else I should check? Thanks, Matt my $i = 0; $ssh->register_handler("stdout", sub { $i++; my($channel, $buffer) = @_; print Dumper $buffer; my $str = $buffer->bytes; my $getsrt = $buffer->get_str; print "\nSTR $i: $str\nEND\n\n"; if ($str =~ /Username: $/) { print "USER $i\n"; $channel->send_data("$user\n"); } elsif ($str =~ /Password/i) { print "\nPASSWORD $i\n"; $channel->send_data("$pw"); } }); my ($stdout, $stderr, $exit) = $ssh->cmd($user); Output: Logging In $VAR1 = bless( { '_get_mp_int' => sub { "DUMMY" }, '_put_mp_int' => sub { "DUMMY" }, 'buf' => 'Welcome to Webstream Server Username: ', 'offset' => 0 }, 'Net::SSH::Perl::Buffer' ); STR 1: Welcome to Webstream Server Username: END USER 1 $VAR1 = bless( { '_get_mp_int' => sub { "DUMMY" }, '_put_mp_int' => sub { "DUMMY" }, 'buf' => 'Password: Could not read password. Authenticating [username2]..... Authentication Failed. Good bye. [0x9] ', 'offset' => 0 }, 'Net::SSH::Perl::Buffer' ); STR 2: Password: Could not read password. Authenticating [username2]..... Authentication Failed. Good bye. [0x9] END PASSWORD 2 EXIT 255 --- Eric Langheinrich <er...@er...> wrote: > What happens if instead of: > > $ssh->register_handler("stdout", sub { > my($channel, $buffer) = @_; > my $str = $buffer->bytes; > print "\nSTR: $str\nEND\n\n"; > > if ($str =~ /Username: $/) { > print "USER2\n"; > $channel->send_data("$user\n$pw\n"); > } > > elsif ($str =~ /Password/i) { > print "\nPASSWORD2\n"; > $channel->send_data($pw,"\n"); > } > > You use: > > $ssh->register_handler("stdout", sub { > my($channel, $buffer) = @_; > my $str = $buffer->bytes; > print "\nSTR: $str\nEND\n\n"; > > if ($str =~ /Username: $/) { > print "USER2\n"; > $channel->send_data("$user"); > } > > elsif ($str =~ /Password/i) { > print "\nPASSWORD2\n"; > $channel->send_data($pw,"\n"); > } > > > -----Original Message----- > > From: > ssh...@li... > > > [mailto:ssh...@li...] > On > > Behalf Of Matthew J. Salerno > > Sent: Wednesday, March 22, 2006 10:24 AM > > To: Eric Langheinrich; > ssh...@li... > > Subject: RE: [Ssh-sftp-perl-users] Interfacing > with network > > appliance through ssh > > > > What really confuses me, is when I am printing my > $str = > > $buffer->bytes; > > > > When I print print "STR: $str\nEND"; looking for > the username > > prompt, it looks normal, I get: > > > > STR: Welcome to Raritan Dominion Server > > > > Username: > > END > > > > > > But when I print "STR: $str\nEND"; looking for the > password > > prompt, I get: > > > > STR: Password: > > Could not read password. > > Authenticating []..... > > Authentication Failed. Good bye. [0x9] > > > > END > > > > > > I'm not sure why the buffer would contain failed > attempts. > > Shouldn't it just contain the Passowrd: > > line? > > > > > > > > --- Eric Langheinrich <net...@er...> > > wrote: > > > > > Wouldn't it just be simpler to use public key > auth? > > > Do you really want to > > > have scripts with your passwords hard coded? > > > > > > Have you tried doing the login as a single step, > like so: > > > $ssh->login($user, $pass); > > > > > > Here's a sample of one I have working using > public > > > key: > > > > > > #!/usr/bin/perl > > > > > > Use strict; > > > Use Net::SSH::Perl; > > > My @ident = ("/home/user/.ssh/id_dsa"); my > %params = ( > > > protocol => 2, > > > interactive => 0, > > > identity_files => [@ident], > > > debug => 0, > > > options => [ > > > "BatchMode yes", > > > "AuthenticationSuccessMsg no", > > > "ForwardX11 no", > > > "ForwardAgent no" > > > ] > > > ); > > > > > > my $server = $ARGV[0]; > > > &sshconnect($server); > > > > > > my ($stdout, $stderr, $exit) = $ssh->cmd("ls"); > > > > > > print "$stdout\n"; > > > > > > if (! $ssh) { > > > print "Unable to establish ssh > connection > > > to: $server\n"; > > > } else { > > > print "Successfully established ssh > connection to: > > $server\n"; > > > } > > > > > > sub sshconnect { > > > my $server = $_[0]; > > > our $ssh = > Net::SSH::Perl->new("$server", %params); > > > $ssh->login("user"); > > > } > > > > > > Here is an example using username/password > login: > > > > > > #/usr/bin/perl > > > > > > use strict; > > > use Net::SSH::Perl; > > > use vars qw($ssh); > > > > > > > > > my %params = ( > > > protocol => 2, > > > interactive => 0, > > > debug => 0, > > > options => [ > > > "BatchMode yes", > > > "AuthenticationSuccessMsg no", > > > "ForwardX11 no", > > > "ForwardAgent no" > > > ] > > > ); > > > > > > my $pass = "password"; > > > > > > my $server = $ARGV[0]; > > > &sshconnect($server); > > > my ($stdout, $stderr, $exit) = $ssh->cmd("ls"); > print > > "$stdout\n"; if > > > (! $ssh) { > > > print "Unable to establish ssh > connection > > > to: $server\n"; > > > } else { > > > print "Successfully established ssh > connection to: > > $server\n"; > > > } > > > > > > sub sshconnect { > > > my $server = $_[0]; > > > our $ssh = > Net::SSH::Perl->new("$server", %params); > > > $ssh->login("user", $pass); > > > } > > > > > > > > > Hope this helps. > > > > > > > > > > -----Original Message----- > > > > From: > > > ssh...@li... > > > > > > > > > > [mailto:ssh...@li...] > > > On > > > > Behalf Of Matthew J. Salerno > > > > Sent: Wednesday, March 22, 2006 8:55 AM > > > > To: ssh...@li... > > > > Subject: [Ssh-sftp-perl-users] Interfacing > with > > > network > > > > appliance through ssh > > > > > > > > I have been going nuts trying to get this to > work. > > > > > > > Any help is appreciated. > > > > > > > > > > > > I need to automate the process of logging in > to a > > > network > > > > appliance and executing a few commands. The > > > network > > > > appliance uses: OpenSSH 3.8.1 > > > > > > > > The system I am executing from is using: > > > > Redhat Linux > > > > Net::SSH::Perl 1.30 > > > > Perl 5.8.5 > > > > > > > > Here is the login process, step-by-step: > > > > # ssh username1@10.10.10.15 > > > > > > > > Then I get prompted for another username as > > > expected. > > > > > > > > Welcome to Webstream Server > > > > > > > > Username: <Enter Username> > > > > > > > > Get prompted for > > > > Password: <Enter Password> > > > > > > > > This is where I am stuck. I have been working > on > > > the login > > > > process for a few days now, and I still cant > pass > > > the server > > > > the password. I can easily get to the point > where > > > it prompts > > > > for the password, but it does not work. Any > help > > > would be > > > > greatly appreciated. > > > > Here is what I have so far: > > > > > > > > #!/usr/bin/perl -w > > > > use strict; > > > > use Net::SSH::Perl; > > > > > > > > my %params; > > > > $params{"debug"} = 0; > > > > $params{"port"} = 22; > > > > $params{"protocol"} = 2; > > > > $params{"interactive"} = 0; > > > > $params{"compression"} = 0; > > > > $params{"PreferredAuthentications"} = > 'password'; > > > > $params{"PubkeyAuthentication"} = 'no'; > > $params{"RSAAuthentication"} > > > > = 'no'; > > > $params{"use_pty"} = 0; > > > > > > > > my $host = "10.10.10.15"; > > > > my $ruser = "username1"; > > > > my $user = 'username2'; > > > > my $pw = 'mypassword'; > > > > > > > > my $ssh = new Net::SSH::Perl($host, %params) > || > > > > die "Cannot Connect to system $! > $@\n"; > > > > > > > > print "Logging In\n"; > > > > $ssh->login($ruser) || die "Cannot Login $! > $@\n"; > > > > > > > > $ssh->register_handler("stdout", sub { > > > > my($channel, $buffer) = @_; > > > > my $str = $buffer->bytes; > > > > print "\nSTR: $str\nEND\n\n"; > > > > > > > > if ($str =~ /Username: $/) { > > > > print "USER2\n"; > > > > $channel->send_data("$user\n$pw\n"); > > > > } > > > > > > > > elsif ($str =~ /Password/i) { > > > > print "\nPASSWORD2\n"; > > > > $channel->send_data($pw,"\n"); > > > > } > > > > }); > > > > > > > > my ($stdout, $stderr, $exit) = > $ssh->cmd($user); > > > > > > > > print "\n\nSTDOUT - $stdout\n" if $stdout; > print > > > "STDERR - > > > > $stderr\n" if $stderr; print "EXIT $exit\n" if > > > $exit; > > > > > > > > exit; > > > > > > > > ---------- > > > > The results are: > > > > > > > > Logging In > > > > > > > > STR: Welcome to Webstream Server > > > > > > > > Username: > > > > END > > > > > > > > USER2 > > > > > > > > STR: Password: > > > > Could not read password. > > > > Authenticating [username2]..... > > > > Authentication Failed. Good bye. [0x9] > > > > > > > > END > > > > > > > > PASSWORD2 > > > > EXIT 255 > > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Tired of spam? Yahoo! Mail has the best spam > > > protection > > > > around http://mail.yahoo.com > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.Net email is sponsored by xPML, a > > > groundbreaking > > > > scripting language > > > > that extends applications into web and mobile > > > media. Attend > > > > the live webcast > > > > and join the prime developer group breaking > into > > > this new > > > > coding territory! > > > > > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720& > > > dat=121642 > > > > > _______________________________________________ > > > > Ssh-sftp-perl-users mailing list > > > > Ssh...@li... > > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > > > > > > > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection > > around http://mail.yahoo.com > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a > groundbreaking > > scripting language > > that extends applications into web and mobile > media. Attend > > the live webcast > > and join the prime developer group breaking into > this new > > coding territory! > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720& > dat=121642 > > _______________________________________________ > > Ssh-sftp-perl-users mailing list > > Ssh...@li... > > > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Matthew J. S. <vag...@ya...> - 2006-03-23 23:23:00
|
I think I might have found part of the problem, maybe... When you call: $ssh->cmd("$cmd"); I believe that it waits for an exit code from whatever it is executing. In my case, I am not executing anything, therefore I wont receive an exit code. I guess that I need to setup my own channel and not use $ssh->cmd. I can't be the only preson who has come across a situation like this. Anyone have any suggestions? Here is what the putty logs look like: <Just hit enter after entering username> Outgoing packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) ..........Password: Outgoing packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) Incoming packet type 2 / 0x02 (SSH2_MSG_IGNORE) --- "Matthew J. Salerno" <vag...@ya...> wrote: > If I use Data::Dumper to view the buffer, I see that > what gets returned is an already failed > authentication > attempt. Is there anything else I should check? > > Thanks, > > Matt > > my $i = 0; > > $ssh->register_handler("stdout", sub { > $i++; > my($channel, $buffer) = @_; > print Dumper $buffer; > my $str = $buffer->bytes; > my $getsrt = $buffer->get_str; > print "\nSTR $i: $str\nEND\n\n"; > > if ($str =~ /Username: $/) { > print "USER $i\n"; > $channel->send_data("$user\n"); > } > > elsif ($str =~ /Password/i) { > print "\nPASSWORD $i\n"; > $channel->send_data("$pw"); > } > }); > > my ($stdout, $stderr, $exit) = $ssh->cmd($user); > > Output: > > > Logging In > $VAR1 = bless( { > '_get_mp_int' => sub { "DUMMY" }, > '_put_mp_int' => sub { "DUMMY" }, > 'buf' => 'Welcome to Webstream > Server > > Username: ', > 'offset' => 0 > }, 'Net::SSH::Perl::Buffer' ); > > STR 1: Welcome to Webstream Server > > Username: > END > > USER 1 > $VAR1 = bless( { > '_get_mp_int' => sub { "DUMMY" }, > '_put_mp_int' => sub { "DUMMY" }, > 'buf' => 'Password: > Could not read password. > Authenticating [username2]..... > Authentication Failed. Good bye. [0x9] > ', > 'offset' => 0 > }, 'Net::SSH::Perl::Buffer' ); > > STR 2: Password: > Could not read password. > Authenticating [username2]..... > Authentication Failed. Good bye. [0x9] > > END > > > PASSWORD 2 > EXIT 255 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Eric L. <net...@er...> - 2006-03-25 22:56:32
|
> > I think I might have found part of the problem, maybe... > > When you call: $ssh->cmd("$cmd"); > > I believe that it waits for an exit code from whatever it is > executing. In my case, I am not executing anything, > therefore I wont receive an exit code. > > I guess that I need to setup my own channel and not use $ssh->cmd. > I was looking at this again today and at the Net::SSH::Perl docs. A couple of things came to mind. First, you may want to try enabling interactive. I believe to interact with a prompt you do not want to be running in batch mode. You may also have to allocate a tty depending on the requirements of your program. |
From: Matthew J. S. <vag...@ya...> - 2006-03-27 15:05:10
|
Thanks for the suggestion, I tried it, but I get the same results. --- Eric Langheinrich <net...@er...> wrote: > > > > > I think I might have found part of the problem, > maybe... > > > > When you call: $ssh->cmd("$cmd"); > > > > I believe that it waits for an exit code from > whatever it is > > executing. In my case, I am not executing > anything, > > therefore I wont receive an exit code. > > > > I guess that I need to setup my own channel and > not use $ssh->cmd. > > > > I was looking at this again today and at the > Net::SSH::Perl docs. > > A couple of things came to mind. > > First, you may want to try enabling interactive. I > believe to interact with > a prompt you do not want to be running in batch > mode. You may also have to > allocate a tty depending on the requirements of your > program. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Eric L. <net...@er...> - 2006-03-27 16:26:13
|
I looked through the example some more and compared it to what you are doing. If I understand how your system works correctly, after logging in through ssh, you are immediately prompted for a login to whatever subsystem you are trying to access. You don't have to issue a command to initiate the second login sequence right? You might want to try breaking up the username password stuff from line 31. Just send username at that prompt rather than sending both. Also may want to try removing the new lines. Probably not the problem, but it's worth a shot. Also worth looking into how you are doing the send data steps since between lines 31 and 36 you are building them differently. > -----Original Message----- > From: ssh...@li... > [mailto:ssh...@li...] On > Behalf Of Matthew J. Salerno > Sent: Monday, March 27, 2006 8:05 AM > To: Eric Langheinrich; Vag...@ya...; > ssh...@li... > Subject: RE: [Ssh-sftp-perl-users] Interfacing with network > appliance through ssh > > Thanks for the suggestion, I tried it, but I get the same results. > > --- Eric Langheinrich <net...@er...> > wrote: > > > > > > > > > I think I might have found part of the problem, > > maybe... > > > > > > When you call: $ssh->cmd("$cmd"); > > > > > > I believe that it waits for an exit code from > > whatever it is > > > executing. In my case, I am not executing > > anything, > > > therefore I wont receive an exit code. > > > > > > I guess that I need to setup my own channel and > > not use $ssh->cmd. > > > > > > > I was looking at this again today and at the Net::SSH::Perl docs. > > > > A couple of things came to mind. > > > > First, you may want to try enabling interactive. I believe > to interact > > with a prompt you do not want to be running in batch mode. You may > > also have to allocate a tty depending on the requirements of your > > program. > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection > around http://mail.yahoo.com > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking > scripting language > that extends applications into web and mobile media. Attend > the live webcast > and join the prime developer group breaking into this new > coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720& dat=121642 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > |