You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
436 B
26 lines
436 B
5 years ago
|
#!/usr/bin/perl
|
||
|
# (c) Pali 2019, Perl license
|
||
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
|
||
|
use Net::Telnet;
|
||
|
|
||
|
die "Usage: $0 host pass\n" unless @ARGV == 2;
|
||
|
my $host = $ARGV[0];
|
||
|
my $pass = $ARGV[1];
|
||
|
|
||
|
my $t = Net::Telnet->new(Timeout => 3, Prompt => '/[^\n]*> $/');
|
||
|
|
||
|
$t->open($host);
|
||
|
$t->waitfor('/Password :$/');
|
||
|
$t->print($pass);
|
||
|
$t->waitfor($t->prompt);
|
||
|
|
||
|
$t->cmd('erase protflash');
|
||
|
|
||
|
# TODO: check if erase was allowed
|
||
|
|
||
|
$t->print('exit');
|
||
|
$t->close();
|