Hi
Im trying the following:
I have a workling connection via SSH to a server and now i want to the next hop via Telnet...i want to do this with the module Net::Telnet...
My problem is: How can I put the functions of the Telnet module through the channel?
My code so far:
use strict;
use Net::SSH2;
use Net::Telnet;
my $ssh1= Net::SSH2-> new();
if($ssh1-> connect('204.230.74.17', '22')){print "connect1 ok \n";} #
+or die "conncet to SSH1 failed";
if($ssh1-> auth_password('ddd', 'pass')){print "auth1 ok \n";} # or di
+e "auth1 failed";
if($ssh1-> tcpip('134.46.156.237:22', '127.0.0.1:22')){print "tunnel o
+k \n";}
my $ssh2= Net::SSH2-> new();
if($ssh2-> connect('127.0.0.1', '22')){print "connect2 ok \n";}# or di
+e "conncet to SSH2 failed";
if($ssh2-> auth_password('ddd','pass')){print "auth2 ok \n";}# or die
+"auth2 failed";
my $chan1= $ssh2-> channel();
my $telnet = Net::Telnet-> new ();
if($telnet-> open(Host=> '127.0.0.1', Port=> '22')){print "telnet ok";
+}#;
$telnet-> login(Name=> 'ddd', Password=> 'pass');
$a= $telnet-> get();
regards from germany
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.