| version 1.4, 2005/12/30 20:26:41 |
version 1.5, 2006/01/03 00:22:19 |
|
|
| package Net::Telnet::Trango;
|
package Net::Telnet::Trango;
|
| # $RedRiver: Trango.pm,v 1.3 2005/12/30 19:26:06 andrew Exp $
|
# $RedRiver: Trango.pm,v 1.4 2005/12/30 20:26:41 andrew Exp $
|
| use strict;
|
use strict;
|
| use warnings;
|
use warnings;
|
| use base 'Net::Telnet';
|
use base 'Net::Telnet';
|
|
|
| sysinfo => { decode => 'all', expect => $success },
|
sysinfo => { decode => 'all', expect => $success },
|
| updateflash => { decode => 'all', expect => $success },
|
updateflash => { decode => 'all', expect => $success },
|
| sulog => { decode => 'sulog', expect => $success },
|
sulog => { decode => 'sulog', expect => $success },
|
| 'exit' => { Prompt => '//', cmd_disconnects => 1 },
|
'exit' => { no_prompt => 1, cmd_disconnects => 1 },
|
| reboot => { Prompt => '//', cmd_disconnects => 1 },
|
reboot => { no_prompt => 1, cmd_disconnects => 1 },
|
| #su password???
|
#su password???
|
| #_bootloader
|
#_bootloader
|
| #temp
|
#temp
|
|
|
| login_banner
|
login_banner
|
| Timeout
|
Timeout
|
| last_lines
|
last_lines
|
| |
last_vals
|
| );
|
);
|
|
|
|
| sub AUTOLOAD
|
sub AUTOLOAD
|
|
|
|
|
|
| =pod
|
=pod
|
|
|
|
| |
=item su_password
|
| |
|
| |
C<su_password('all'|suid, 'new_password')>
|
| |
|
| |
=cut
|
| |
|
| |
sub su_password
|
| |
{
|
| |
my $self = shift;
|
| |
my $su = shift || '!';
|
| |
my $new_pass = shift || '';
|
| |
|
| |
unless (defined $su) {
|
| |
warn "No su passed!"
|
| |
#return undef;
|
| |
}
|
| |
|
| |
unless (defined $new_pass) {
|
| |
warn "No new password!"
|
| |
#return undef;
|
| |
}
|
| |
|
| |
return $self->cmd(String => 'su password ' .
|
| |
$su . ' ' .
|
| |
$new_pass . ' ' .
|
| |
$new_pass,
|
| |
expect => $success,
|
| |
);
|
| |
}
|
| |
|
| |
|
| |
=pod
|
| |
|
| |
=item sudb_view
|
| |
|
| |
returns a reference to an array of hashes each containing:
|
| |
|
| |
suid
|
| |
type
|
| |
cir
|
| |
mir
|
| |
mac
|
| |
|
| |
=cut
|
| |
|
| |
sub sudb_view
|
| |
{
|
| |
my $self = shift;
|
| |
|
| |
my @lines = $self->cmd( String => 'sudb view', expect => $success );
|
| |
|
| |
return undef unless @lines;
|
| |
|
| |
my @sus;
|
| |
foreach (@lines) {
|
| |
if (/^\[(\d+)\]\s+(\d+)\s+(\d+)\s+(\d+)\s+([0-9a-fA-F]+)/) {
|
| |
my %s = (
|
| |
suid => $1,
|
| |
type => $2,
|
| |
cir => $3,
|
| |
mir => $4,
|
| |
mac => $5,
|
| |
);
|
| |
push @sus, \%s;
|
| |
}
|
| |
}
|
| |
|
| |
return \@sus;
|
| |
}
|
| |
|
| |
=pod
|
| |
|
| =item enable_tftpd
|
=item enable_tftpd
|
|
|
|
| runs C<tftpd(args =E<gt> 'on')> and makes sure that Tftpd is now 'listen'ing
|
runs C<tftpd(args =E<gt> 'on')> and makes sure that Tftpd is now 'listen'ing
|
|
|
| if ($cfg{'args'}) {
|
if ($cfg{'args'}) {
|
| $cmd{'String'} .= ' ' . $cfg{'args'};
|
$cmd{'String'} .= ' ' . $cfg{'args'};
|
| }
|
}
|
| my @lines = $self->SUPER::cmd(%cmd);
|
my @lines;
|
| |
unless ($cfg{'no_prompt'}) {
|
| |
@lines = $self->SUPER::cmd(%cmd);
|
| |
} else {
|
| |
$self->print($cmd{'String'});
|
| |
@lines = $self->lastline;
|
| |
}
|
|
|
|
| $self->last_lines(\@lines);
|
$self->last_lines(\@lines);
|
|
|
|
|
|
| $vals = _decode_lines(@lines);
|
$vals = _decode_lines(@lines);
|
| }
|
}
|
| }
|
}
|
| |
|
| |
$self->last_vals($vals);
|
|
|
|
|
|
|
| my $last = $self->lastline;
|
my $last = $self->lastline;
|