Leser: 3
|< 1 2 >| | 12 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use warnings;
use Net::Telnet();
my $host = '10.10.1.5';
my $t = new Net::Telnet (Timeout => 10,
Input_log => *STDOUT,
Prompt => '/bash\$ $/'
);
$t->open("$host");
print STDERR "connected...\n";
my @lines = $t->cmd("help");
print @lines;
@lines = $t->cmd("cli help");
print @lines;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use strict;
use warnings;
use Net::Telnet();
my $host = '10.10.11.5';
my $t = Net::Telnet->new(Host => $host,
Timeout => 10,
Input_log => *STDOUT,
Output_log => *STDOUT,
) or die Net::Telnet::error();
$t->cmd("help") or die $t->error; #das ist Zeile 15
$t->waitfor('/SW2K-FRAFAC-P4_4750>/') or die $t->error;
$t->cmd("cli help") or die $t->error;
$t->waitfor('/SW2K-FRAFAC-P4_4750>/') or die $t->error;
1
2
3
4
5
6
$input = lc $input;
if ($input ne "")
{
$t->print("$input");
$line = $t->getline;
}
1
2
3
4
5
6
7
8
9
10
use strict;
use warnings;
my $input = "";
while ( $input eq "" ) {
print "input: ";
$input = <STDIN>;
chomp $input;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use strict;
use warnings;
use Net::Telnet();
my $host = '10.10.1.5';
my $input = "";
my $t = Net::Telnet->new(Host => $host,
Timeout => 15,
Input_log => *STDOUT,
Output_log => *STDOUT,
) or die Net::Telnet::error();
$t->print("help");
my $line = $t->getline;
&connected;
sub connected
{
$t->waitfor(-match => '/SERVER_4711>/',
-errmode => "return",
) or die "problem connecting to host: ",
$t->lastline;
#while ($input eq "")
# {
$input = <STDIN>;
$input = lc $input;
chomp $input;
$t->print("$input");
$line = $t->getline;
$t->lastline;
# }
&connected;
}
1
2
3
4
5
my @lines;
while(my $line = $t->getline){
push(@lines,$line);
}
print $_ for(@lines);
|< 1 2 >| | 12 Einträge, 2 Seiten |