} elsif ( $buff =~ m/Password:/ ) {
send_pty "$passwd\n";
$buff = '';
- } elsif ( $buff =~ m/[\n\r]([\w\-\(\)]+)#$/ ) {
+ } elsif ( $buff =~ m/[\n\r\b]([\w\-\(\)\/]+)#\s*$/ ) {
+ # config interface needs / in prompt
my $hostname = $1;
if ( $buff ) {
save_log $ip, $hostname, $command, $buff;
}
} elsif ( $buff =~ m/% Unrecognized command/ ) {
exit 1;
+ } elsif ( $buff =~ m/% Invalid input detected at .* marker/ ) {
+
+ # try to rewrite command differences
+
+ if ( $command =~ m/show lldp neighbors/ ) {
+ unshift @commands_while, 'show lldp remote-device all';
+ undef $command; # don't save this command
+ $buff = '';
+ }
+
+ warn "# commands_while = ",dump( \@commands_while );
+
} elsif ( $buff =~ s{More: <space>, Quit: q.*One line: <return>\s*}{} ) {
send_pty " ";
} elsif ( $buff =~ s{\Q--More-- or (q)uit\E}{} ) {
send_pty " ";
+ } elsif ( $buff =~ s{\r\s{18}\r}{} ) {
+ # strip spaces delete after more prompt
} elsif ( $buff =~ s{\e\[0m\s*\r\s+\r}{} ) {
# nop
} elsif ( $buff =~ m/^[\r\n]+[\w\-]+>$/ ) {
show running-config
show bridge address
show interfaces status
-