Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How do we convert this code from Perl to Java????
- for(my $i = 0; $i < scalar(@hosts); $i = $i + 1){
- my $ssh_true = eval {
- Net::SSH::Perl->new($hosts[$i])
- };
- # $success = $ssh;
- # print "ssh=".$sucess;
- if($ssh_true){
- $Lsmr_IP = $hosts[$i];
- print "Lsmr_IP=".$Lsmr_IP."n";
- last;
- }else{
- $Lsmr_IP = $hosts[$i];
- print "Ip ".$Lsmr_IP." Is not connecting; trying next";
- }
- }
- print "Lsmr_IP=".$Lsmr_IP."n";
- }
- my $ssh_lsm = new Control::CLI(Use => 'SSH',
- Prompt => ']',
- Errmode=> 'return',
- Timeout=> '30',
- Dump_log => "ts.dump.log");
- my $Lsmr_Connect = $ssh_lsm->connect(Host => $Lsmr_IP,
- Username => $user,
- Password => $pass,
- PrivateKey => '.ssh/id_dsa');
- print "user=".$user."n";
- print "pswd".$pass."n";
- if ($Lsmr_Connect)
- { //#start if connected
- print "st3"."n";
- if (!$checkIVR){ //###jumpbox
- $ssh_lsm->waitfor('>');
- $ssh_lsm->print("001");
- # $ssh_lsm->print("002");
- $ssh_lsm->waitfor('Enter.');
- $ssh_lsm->print($userSane);
- $ssh_lsm->print("n");
- $ssh_lsm->waitfor('Password:');
- $ssh_lsm->print($passSane);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement