#!/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); print "$_\n" foreach grep !/^(?:Current Phone Status|--------------------|I100 No errors|)$/, map { /^[\x00-\x31\s]*(.*?)\s*$/s; $1 } $t->cmd('show status'); $t->print("exit"); $t->close();