[rancid] #' in my login banner
Alan McKinnon
alan.mckinnon at gmail.com
Thu Dec 19 09:48:57 UTC 2013
One possibility is to ignore any line with 2 or more #, and assume that
it's a banner. This is the command case.
Login and command prompts contain ">" or "#", but always only one.
This way, code can discard lines that are known to NOT be the prompt.
It's not 100% failproof but it is an improvement over the blind match we
currently have.
On 19/12/2013 10:26, Jan Dahl wrote:
> Maybe if we could somehow define an "ignored" string? I have a couple
> of thousand switches with this in the login banner, which I won't be
> allowed to change any time soon:
>
> ###### ###### # #
> # # # # #
> # # ###### # #
> # # # # #
> ###### ###### #
>
> Is it un-clever? Indeed! But it has been rolled out world wide before
> I started here and now I can't use rancid.
>
> The really weird thing for me is that somehow, terminal length and
> width are set at the right time, but none of my commands are pushed
> after that.
>
> Kind regards,
>
> Jan
>
> On Wed Dec 11 18:24:32 UTC 2013, Allan McKinnon wrote:
>
> On 11/12/2013 20:14, Per-Olof Olsson wrote:
>> Hello
>>
>>
>>
>>
>> On 12/11/2013 06:51 PM, Alan McKinnon wrote:
>>> I see no-one has responded with an answer to your question.
>>>
>>> I think the reason is that code cannot deal with ">" and "#" characters
>>> in a banner in any sane way that gives consistent results. For rancid to
>>> function properly, it has to know what the shell prompt is exactly for a
>>> given device, and to do that it has to parse the entire text output.
>>>
>>> The only tool available to detect the prompt is pattern matching which
>>> inevitably means a regex. As a perl regex this is
>>>
>>> ^[-a-zA-Z0-9]*[>#]
>>>
>>> and that's assuming the prompt is the hostname.
>>
>> In hlogin I added
>>
>> -re "\[#>]+.*\[\n\r]+" {
>> exp_continue
>> }
>>
>> to just pass over none prompter # and >.
>> Banner "#" and ">" is followed by CR or NL!
>
>
>
> Only if the banner has a surrounding box made of > or #
>
> One can always come up with a scheme that just happens to work for
> oneself because local rules specify some exact format where you can get
> a regex to work for you.
>
> That's a lot of work though. I find it easier to just change the banner.
>
>
>
>
>>
>> Works for HPs
>>
>> /Peo
>> ----------------------------------------------------------
>> Per-Olof Olsson Email: peo at chalmers.se
>> Chalmers tekniska högskola IT-service
>> Hörsalsvägen 5 412 96 Göteborg
>> Tel: 031/772 6738 Fax: 031/772 8660
>> ----------------------------------------------------------
>> _______________________________________________
>> Rancid-discuss mailing list
>> Rancid-discuss at shrubbery.net
>> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>>
>>
>
>
--
Alan McKinnon
alan.mckinnon at gmail.com
More information about the Rancid-discuss
mailing list