-----Original Message----- From: 'john heasley' <h...@shrubbery.net> Sent: Wednesday, July 03, 2019 1:41 PM To: Wayne Eisenberg <wayne.eisenb...@carolinasit.com> Cc: 'john heasley' <h...@shrubbery.net>; 'rancid-discuss@shrubbery.net' <rancid-discuss@shrubbery.net> Subject: Re: [rancid] Watchguard xml file
>> However, in the xtm.pm module, line 102 defines it again. >i'm not familiar with this device, but redefining (or refining) the prompt is >normal. the filter functions and login scripts begin with something loose, >and once it sees the prompt, it can be refined to be more precise, and >may >later further refine it (eg: in run_commands) to match the prompt when/if it >changes in config or other modes that are platform dependent. Ah, if I only had that skill. >> ----------- >> while (/\s*($cmds_regexp)\s*$/) { >> $cmd = $1; >> $prompt = ">>"; ^^^^^^^^^^^^ this is probably a mistake; should be part of the while() regex. I suspect it might be here because the author could not make the regex below match correctly. >> if (!defined($prompt)) { >> $prompt = ($_ =~ /^([^>]+>)/)[0]; >> $prompt =~ s/([][}{)(\\])/\\$1/g; >> print STDERR ("PROMPT MATCH: $prompt\n") if ($debug); >> } >> ----------- >> Once you get to the sub ShowConfiguration section, on line 199 if it sees >> the prompt, end. Guess what? The "#" character is inside the config (there >> is some html code in one of the xml sections) and that is where the config >> ends. >seems that the prompt is ">>". Yes, in this example. I wanted to show the original file, not something that I modded. In my current version, the line is $prompt = ">>|#" which works, but causes the problem of the config getting truncated because it sees "#" as the prompt. The $prompt should either be the entire thing or some string that ends in #. >> ----------- >> sub ShowConfiguration { >> my($INPUT, $OUTPUT, $cmd) = @_; >> my($lines) = 0; >> my($snmp) = 0; >> print STDERR " In ShowConfiguration: $_" if ($debug); >> # We don't care about password filtering as passwords are hashed >> # So don't use this if you need it (or develop the functionality). >> if ($filter_pwds >= 1){ >> print STDERR "WARNING: Password filtering isn't implemented yet!\n"; >> print STDERR "Either disable password filtering in rancid.conf"; >> print STDERR " or don't use this plugin.\n"; >> } >> s/^[a-z]+@//; >> ProcessHistory("","","","# $_"); >> while (<$INPUT>) { >> tr/\015//d; >> next if (/^\s*$/); >> # end of config - hopefully. >> # end-of-config tag. appears to end with "\nPROMPT:~$". >> if (/$prompt/) { >> $found_end++; >> last; >> } >> ----------- >> >> So I'm thinking if I can figure out a different way to define the prompt to >> be more than just the # sign (at least in the xtm.pm), that should do the >> trick? Can you do something like $prompt = "#$" ? >its better to anchor it and have it be as complete as reasonable. eg: >not # >not hostname# >but ^hostname# >look at ios.pm. Looking, but I don't see anywhere that it defines the prompt. It uses it a lot, but doesn't define it. Thanks, Wayne _______________________________________________ Rancid-discuss mailing list Rancid-discuss@shrubbery.net http://www.shrubbery.net/mailman/listinfo/rancid-discuss