Hi Guys why is not working this script when i telnet to other remote host it does not work. you can see the output of script
#!/usr/bin/perl use 5.010; use strict; use warnings; use Net::Telnet; ## Global variables. my $Term; my $telnet; my $user = "deneme"; my $passwd = "Try123."; print "Enter your IP : "; my $host = readline STDIN; chomp $host; my $prompt = '/(?:Password: |[>])/m'; # your regexp for shell + prompt here open my $Bm_Report, "> BM_Report.txt" or die "can't open the file: + $!\n"; $telnet = new Net::Telnet (Timeout => 1000, Errmode=>'die'); $telnet->input_log($Bm_Report); $telnet->open($host); $telnet->login($user, $passwd); print $telnet->cmd("--------------- $host ----------------"); print $telnet->cmd('cat /tmp'); $telnet->cmd('telnet 100.0.2.1'); $telnet->waitfor('login:'); $telnet->print("deneme"); $telnet->waitfor('Password: '); $telnet->print("Try123."); $telnet->close;
MontaVista(R) Linux(R) Carrier Grade Edition 4.0 (0600995) Linux/ppc 2.6.10_mvlcge401-8555-cplab EC1830-81-1 login: appl Password: Last login: Fri Jul 1 04:05:01 2016 from 10.2.3.93 on pts/2 Linux EC1830-81-1 2.6.10_mvlcge401-8555-cplab #2 Sun Apr 6 12:02:41 ED +T 2014 ppc GNU/Linux Welcome to MontaVista(R) Linux(R) Carrier Grade Edition 4.0 (0600995). No directory, logging in with HOME=/ appl@EC1830-81-1-ACT:/ $ --------------- 10.2.3.55 ---------------- -sh: ---------------: command not found appl@EC1830-81-1-ACT:/ $ cat /tmp Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: SMART CF Model: Rev: 0000 Type: Direct-Access ANSI SCSI revision: 02 appl@EC1830-81-1-ACT:/ $ telnet 100.0.2.1 Trying 100.0.2.1... Connected to 100.0.2.1. Escape character is '^]'. MontaVista(R) Linux(R) Carrier Grade Edition 4.0 (0600995) Linux/ppc 2.6.10_mvlcge401-8555-cplab EC1830-2-1 login: WHY HAS NOT BEEN WRITTEN " deneme "
In reply to telnet from host to remote host by abdullahcaldir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |