Subject: | default prompt regex fails on default ASA 5510 prompt |
Date: | Mon, 17 Sep 2007 11:17:13 -0400 |
To: | bug-Net-Telnet-Cisco [...] rt.cpan.org |
From: | William Faulk <wfaulk [...] cortina-systems.com> |
A tcpdump of my ASA5510 shows this as the prompt string:
Show quoted text
> 0x0030: 656c 7020 6f72 2027 3f27 2066 6f72 2061 elp.or.'?'.for.a
> 0x0040: 206c 6973 7420 6f66 2061 7661 696c 6162 .list.of.availab
> 0x0050: 6c65 2063 6f6d 6d61 6e64 732e 0d0a 0d00 le.commands.....
> 0x0060: 6369 7363 6f61 7361 3e20 ciscoasa>.
As you can see, after the newline (0x0a), there is a carriage return
(0x0d) and a null (0x00) before the prompt starts. This is making the
default regex:
Show quoted text> /(?m:^[\w.-]+\s?(?:\(config[^\)]*\))?\s?[\$#>]\s?(?:\(enable\))?\s*$)/
fail due to the beginning-of-line marker (^). This is soluble by
getting rid of that, which is probably not ideal, or adding the CR and
NUL as optional characters, like this:
Show quoted text> /(?m:^\x0d?\x00?[\w.-]+\s?(?:\(config[^\)]*\))?\s?[\$#>]\s?(?:\(enable\))?\s*$)/
Obviously, I can do that myself, but it would be nice if it was the
default for future users.
-William Faulk