Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread john heasley
Wed, Jul 03, 2019 at 02:53:14PM -0600, Kevin Morales:
> Yes, my Router is ZTE and I am using CISCO type, because the command is the
> same to see the configuration..show running-config

I have no idea what ZTE is; does it behave *exactly* the same as IOS?
It seems not.

> > > > found end means that it found the end of the config; for type cisco,
> > > > that means "^end".

Does it's config end with:

"
end
"?

> > > > clean run means that it found the cli logout; for type cisco, that
> > > > means "prompt[>#] exit$"

in your .raw file, does the last prompt where clogin exited the cli, match
the regex

"prompt[>#] exit$"
?

clearly these sanity checks are not working with your ZTE device.  You
need to figure-out why and correct it, likely by creating your own
rancid module for ZTE with a customized inloop() function.  you can
probably use the parsing functions from the ios module, like the
'ciscoshtech' example that comes with rancid uses 2 modules.

> On Wed, Jul 3, 2019 at 2:52 PM Piegorsch, Weylin William 
> wrote:
> 
> > Hi Kevin,
> >
> > I think you said this is a ZTE device, but that you’re using -t cisco. is
> > ZTE a cisco device?
> >
> > weylin
> >
> >
> >
> > *From: *Kevin Morales 
> > *Date: *Wednesday, July 3, 2019 at 3:18 PM
> > *To: *john heasley 
> > *Cc: *Weylin Piegorsch , Nick Nauwelaerts <
> > nick.nauwelae...@aquafin.be>, "rancid-discuss@shrubbery.net" <
> > rancid-discuss@shrubbery.net>
> > *Subject: *Re: [rancid] Unable to figure out "end of run not found"
> >
> >
> >
> > I am sorry, I dont get you, What do you want I do?
> >
> >
> >
> > on my Rancid Server I execute:
> >
> > [rancid@localhost bin]$ NOPIPE=yes ./rancid -d -t  cisco 172.17.1.6
> >
> >
> >
> > On Wed, Jul 3, 2019 at 12:43 PM john heasley  wrote:
> >
> > Wed, Jul 03, 2019 at 11:33:08AM -0600, Kevin Morales:
> > > Thanks Piegorsh,
> > >
> > > I did it..
> > >
> > > NOPIPE=yes ./rancid -d -t cisco 172.17.1.6
> > >
> > > but in the two file 172.17.1.6.new and 172.17.1.6.raw don't see anything
> > > about this error. both show the correct command output.
> >
> > correct command output and matching the criteria that i described below
> > for type cisco are not necessarily the same thing.  read it again.
> >
> > > On Wed, Jul 3, 2019 at 11:29 AM Piegorsch, Weylin William  > >
> > > wrote:
> > > > > *172.17.1.6 : End of run not found*
> > > > > 172.17.1.6: clean_run is false
> > > > > 172.17.1.6: found_end is false
> > > > > !
> > > >
> > > > found end means that it found the end of the config; for type cisco,
> > > > that means "^end".
> > > >
> > > > clean run means that it found the cli logout; for type cisco, that
> > > > means "prompt[>#] exit$"

___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread Kevin Morales
Yes, my Router is ZTE and I am using CISCO type, because the command is the
same to see the configuration..show running-config

On Wed, Jul 3, 2019 at 2:52 PM Piegorsch, Weylin William 
wrote:

> Hi Kevin,
>
> I think you said this is a ZTE device, but that you’re using -t cisco. is
> ZTE a cisco device?
>
> weylin
>
>
>
> *From: *Kevin Morales 
> *Date: *Wednesday, July 3, 2019 at 3:18 PM
> *To: *john heasley 
> *Cc: *Weylin Piegorsch , Nick Nauwelaerts <
> nick.nauwelae...@aquafin.be>, "rancid-discuss@shrubbery.net" <
> rancid-discuss@shrubbery.net>
> *Subject: *Re: [rancid] Unable to figure out "end of run not found"
>
>
>
> I am sorry, I dont get you, What do you want I do?
>
>
>
> on my Rancid Server I execute:
>
> [rancid@localhost bin]$ NOPIPE=yes ./rancid -d -t  cisco 172.17.1.6
>
>
>
> On Wed, Jul 3, 2019 at 12:43 PM john heasley  wrote:
>
> Wed, Jul 03, 2019 at 11:33:08AM -0600, Kevin Morales:
> > Thanks Piegorsh,
> >
> > I did it..
> >
> > NOPIPE=yes ./rancid -d -t cisco 172.17.1.6
> >
> > but in the two file 172.17.1.6.new and 172.17.1.6.raw don't see anything
> > about this error. both show the correct command output.
>
> correct command output and matching the criteria that i described below
> for type cisco are not necessarily the same thing.  read it again.
>
> > On Wed, Jul 3, 2019 at 11:29 AM Piegorsch, Weylin William  >
> > wrote:
> > > > *172.17.1.6 : End of run not found*
> > > > 172.17.1.6: clean_run is false
> > > > 172.17.1.6: found_end is false
> > > > !
> > >
> > > found end means that it found the end of the config; for type cisco,
> > > that means "^end".
> > >
> > > clean run means that it found the cli logout; for type cisco, that
> > > means "prompt[>#] exit$"
>
>
>
>
> --
>
> *Kevin Morales*
>


-- 
*Kevin Morales*
___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread Piegorsch, Weylin William
Hi Kevin,
I think you said this is a ZTE device, but that you’re using -t cisco. is ZTE a 
cisco device?
weylin

From: Kevin Morales 
Date: Wednesday, July 3, 2019 at 3:18 PM
To: john heasley 
Cc: Weylin Piegorsch , Nick Nauwelaerts 
, "rancid-discuss@shrubbery.net" 

Subject: Re: [rancid] Unable to figure out "end of run not found"

I am sorry, I dont get you, What do you want I do?

on my Rancid Server I execute:
[rancid@localhost bin]$ NOPIPE=yes ./rancid -d -t  cisco 172.17.1.6

On Wed, Jul 3, 2019 at 12:43 PM john heasley 
mailto:h...@shrubbery.net>> wrote:
Wed, Jul 03, 2019 at 11:33:08AM -0600, Kevin Morales:
> Thanks Piegorsh,
>
> I did it..
>
> NOPIPE=yes ./rancid -d -t cisco 172.17.1.6
>
> but in the two file 172.17.1.6.new and 172.17.1.6.raw don't see anything
> about this error. both show the correct command output.

correct command output and matching the criteria that i described below
for type cisco are not necessarily the same thing.  read it again.

> On Wed, Jul 3, 2019 at 11:29 AM Piegorsch, Weylin William 
> mailto:wey...@bu.edu>>
> wrote:
> > > *172.17.1.6 : End of run not found*
> > > 172.17.1.6: clean_run is false
> > > 172.17.1.6: found_end is false
> > > !
> >
> > found end means that it found the end of the config; for type cisco,
> > that means "^end".
> >
> > clean run means that it found the cli logout; for type cisco, that
> > means "prompt[>#] exit$"


--
Kevin Morales
___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


[rancid] Rancid.Conf Disappeared on Ubuntu Update

2019-07-03 Thread Sheeter, Kyle
Hey all,

I was doing some Ubuntu upgrades on my server, and just noticed that RANCID 
stop sending me updates.  Ran the rancid-run command and then found out that my 
rancid.conf file disappeared.  Anyone know the best way to recreate the conf 
file?  All of my other information is still there it seems, and the DB is still 
populated with my old network data.

Thanks!
Kyle James Sheeter


Please be advised that this email may contain confidential information. If you 
are not the intended recipient, please notify us by email by replying to the 
sender and delete this message. The sender disclaims that the content of this 
email constitutes an offer to enter into, or the acceptance of, any agreement; 
provided that the foregoing does not invalidate the binding effect of any 
digital or other electronic reproduction of a manual signature that is included 
in any attachment.
___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread Kevin Morales
I am sorry, I dont get you, What do you want I do?

on my Rancid Server I execute:
[rancid@localhost bin]$ NOPIPE=yes ./rancid -d -t  cisco 172.17.1.6

On Wed, Jul 3, 2019 at 12:43 PM john heasley  wrote:

> Wed, Jul 03, 2019 at 11:33:08AM -0600, Kevin Morales:
> > Thanks Piegorsh,
> >
> > I did it..
> >
> > NOPIPE=yes ./rancid -d -t cisco 172.17.1.6
> >
> > but in the two file 172.17.1.6.new and 172.17.1.6.raw don't see anything
> > about this error. both show the correct command output.
>
> correct command output and matching the criteria that i described below
> for type cisco are not necessarily the same thing.  read it again.
>
> > On Wed, Jul 3, 2019 at 11:29 AM Piegorsch, Weylin William  >
> > wrote:
> > > > *172.17.1.6 : End of run not found*
> > > > 172.17.1.6: clean_run is false
> > > > 172.17.1.6: found_end is false
> > > > !
> > >
> > > found end means that it found the end of the config; for type cisco,
> > > that means "^end".
> > >
> > > clean run means that it found the cli logout; for type cisco, that
> > > means "prompt[>#] exit$"
>


-- 
*Kevin Morales*
___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Watchguard xml file

2019-07-03 Thread Wayne Eisenberg
-Original Message-
From: 'john heasley'  
Sent: Wednesday, July 03, 2019 1:41 PM
To: Wayne Eisenberg 
Cc: 'john heasley' ; '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


Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread john heasley
Wed, Jul 03, 2019 at 11:33:08AM -0600, Kevin Morales:
> Thanks Piegorsh,
> 
> I did it..
> 
> NOPIPE=yes ./rancid -d -t cisco 172.17.1.6
> 
> but in the two file 172.17.1.6.new and 172.17.1.6.raw don't see anything
> about this error. both show the correct command output.

correct command output and matching the criteria that i described below
for type cisco are not necessarily the same thing.  read it again.

> On Wed, Jul 3, 2019 at 11:29 AM Piegorsch, Weylin William 
> wrote:
> > > *172.17.1.6 : End of run not found*
> > > 172.17.1.6: clean_run is false
> > > 172.17.1.6: found_end is false
> > > !
> >
> > found end means that it found the end of the config; for type cisco,
> > that means "^end".
> >
> > clean run means that it found the cli logout; for type cisco, that
> > means "prompt[>#] exit$"

___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Watchguard xml file

2019-07-03 Thread 'john heasley'
Wed, Jul 03, 2019 at 04:18:25PM +, Wayne Eisenberg:
> If I run the export command manually, it just dumps the whole thing to the 
> screen without any breaks or requests to 'hit space to continue' or things 
> like that, so I don't *think* it's a page length type setting?
> 
> Actually, I just did another review and I'm thinking that it has something to 
> do with the prompt definition. Just so we're looking at the same thing, the 
> files are here: https://github.com/hillscott/rancid-watchguard. Forked from 
> https://bitbucket.org/aquerubin/rancid-vyatta. 
> 
> In the xtmlogin file, it sets the prompt (line 436) to something I don't see. 
> In this original state, xtmlogin never recognized it finished the login. When 
> I changed that line to
> set prompt ">>|#"
> then xtmlogin completes successfully. (The prompt for this watchguard 
> firewall is "WG#")
> 

> 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.

> ---
> 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);
>   }
>   print STDERR ("HIT COMMAND:$_") if ($debug);
>   if (! defined($commands{$cmd})) {
>   print STDERR "$host: found unexpected command - \"$cmd\"\n";
>   $clean_run = 0;
>   last TOP;
>   }
>   $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
>   delete($commands{$cmd});
>   if ($rval == -1) {
>   $clean_run = 0;
>   last TOP;
>   }
>   }
> ---
> 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 ">>".

> ---
> 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.
.
> Wayne
> 
> 
> 
> -Original Message-
> From: john heasley  
> Sent: Tuesday, July 02, 2019 7:48 PM
> To: Wayne Eisenberg 
> Cc: 'rancid-discuss@shrubbery.net' 
> Subject: Re: [rancid] Watchguard xml file
> 
> Sat, Jun 29, 2019 at 11:46:23AM +, Wayne Eisenberg:
> > Hi,
> > 
> > OK, so I can get into the firewall and pull the config with "export config 
> > to console". However, the config file is a very large xml file, this one is 
> > about 2MB in size. However, it seems like it only recorded the first 388KB 
> > of data. Is there a size limit on what rancid can process, or maybe there 
> > was a character in the xml that rancid didn't like and it just aborted 
> > processing it? How would I go about troubleshooting this?
> > 
> 
> there is no such limit.  I would suspect a PAGER is involved, causing the 
> output to cease.
> 

___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread Kevin Morales
Thanks Piegorsh,

I did it..

NOPIPE=yes ./rancid -d -t cisco 172.17.1.6

but in the two file 172.17.1.6.new and 172.17.1.6.raw don't see anything
about this error. both show the correct command output.




On Wed, Jul 3, 2019 at 11:29 AM Piegorsch, Weylin William 
wrote:

> If you do the “NOPIPE” thing and run rancid with the -d flag, that will
> create two files: .new, and .raw.  Examine the .raw file, which is the
> byte-for-byte capture of the CLI session.
>
> weylin
>
>
>
> *From: *Kevin Morales 
> *Date: *Wednesday, July 3, 2019 at 1:24 PM
> *To: *john heasley 
> *Cc: *Nick Nauwelaerts , Weylin Piegorsch <
> wey...@bu.edu>, "rancid-discuss@shrubbery.net" <
> rancid-discuss@shrubbery.net>
> *Subject: *Re: [rancid] Unable to figure out "end of run not found"
>
>
>
> ok, but  rancid do not save the output of command.,
>
>
>
> How I can fix this problem?
>
>
>
> On Wed, Jul 3, 2019 at 11:12 AM john heasley  wrote:
>
> Wed, Jul 03, 2019 at 07:48:09AM -0600, Kevin Morales:
> > Hello!,
> >
> > How I can fix the problem when I run rancid for ZTE Router?. I get this
> > error: *End of run not found*
> >
> > the two file 172.17.1.6.new and 172.17.1.6.raw don't show any error!.
> >
> > NOPIPE=yes ./rancid -d -t cisco 172.17.1.6
> >
> > loadtype: device type cisco
> > loadtype: found device type cisco in
> /usr/local/rancid/etc/rancid.types.base
> > executing clogin -t 90 -c"show version;show install active;show vlan;show
> > running-config" 172.17.1.6
> > PROMPT MATCH: RT-ZTE#
> > HIT COMMAND: RT-ZTE  #show version
> > In ShowVersion:  RT-ZTE  #show version
> > HIT COMMAND: RT-ZTE  #show install active
> > In ShowInstallActive:  RT-ZTE  #show install active
> > HIT COMMAND: RT-ZTE  #show vlan
> > In ShowVLAN:  RT-ZTE  #show vlan
> > HIT COMMAND: RT-ZTE  #show running-config
> > In WriteTerm:  RT-ZTE  #show running-config
> > *172.17.1.6 : End of run not found*
> > 172.17.1.6: clean_run is false
> > 172.17.1.6: found_end is false
> > !
>
> found end means that it found the end of the config; for type cisco,
> that means "^end".
>
> clean run means that it found the cli logout; for type cisco, that
> means "prompt[>#] exit$"
>
>
>
>
> --
>
> *Kevin Morales*
>


-- 
*Kevin Morales*
___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread Piegorsch, Weylin William
If you do the “NOPIPE” thing and run rancid with the -d flag, that will create 
two files: .new, and .raw.  Examine the .raw file, which is the byte-for-byte 
capture of the CLI session.
weylin

From: Kevin Morales 
Date: Wednesday, July 3, 2019 at 1:24 PM
To: john heasley 
Cc: Nick Nauwelaerts , Weylin Piegorsch 
, "rancid-discuss@shrubbery.net" 
Subject: Re: [rancid] Unable to figure out "end of run not found"

ok, but  rancid do not save the output of command.,

How I can fix this problem?

On Wed, Jul 3, 2019 at 11:12 AM john heasley 
mailto:h...@shrubbery.net>> wrote:
Wed, Jul 03, 2019 at 07:48:09AM -0600, Kevin Morales:
> Hello!,
>
> How I can fix the problem when I run rancid for ZTE Router?. I get this
> error: *End of run not found*
>
> the two file 172.17.1.6.new and 172.17.1.6.raw don't show any error!.
>
> NOPIPE=yes ./rancid -d -t cisco 172.17.1.6
>
> loadtype: device type cisco
> loadtype: found device type cisco in /usr/local/rancid/etc/rancid.types.base
> executing clogin -t 90 -c"show version;show install active;show vlan;show
> running-config" 172.17.1.6
> PROMPT MATCH: RT-ZTE#
> HIT COMMAND: RT-ZTE  #show version
> In ShowVersion:  RT-ZTE  #show version
> HIT COMMAND: RT-ZTE  #show install active
> In ShowInstallActive:  RT-ZTE  #show install active
> HIT COMMAND: RT-ZTE  #show vlan
> In ShowVLAN:  RT-ZTE  #show vlan
> HIT COMMAND: RT-ZTE  #show running-config
> In WriteTerm:  RT-ZTE  #show running-config
> *172.17.1.6 : End of run not found*
> 172.17.1.6: clean_run is false
> 172.17.1.6: found_end is false
> !

found end means that it found the end of the config; for type cisco,
that means "^end".

clean run means that it found the cli logout; for type cisco, that
means "prompt[>#] exit$"


--
Kevin Morales
___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread Kevin Morales
ok, but  rancid do not save the output of command.,

How I can fix this problem?

On Wed, Jul 3, 2019 at 11:12 AM john heasley  wrote:

> Wed, Jul 03, 2019 at 07:48:09AM -0600, Kevin Morales:
> > Hello!,
> >
> > How I can fix the problem when I run rancid for ZTE Router?. I get this
> > error: *End of run not found*
> >
> > the two file 172.17.1.6.new and 172.17.1.6.raw don't show any error!.
> >
> > NOPIPE=yes ./rancid -d -t cisco 172.17.1.6
> >
> > loadtype: device type cisco
> > loadtype: found device type cisco in
> /usr/local/rancid/etc/rancid.types.base
> > executing clogin -t 90 -c"show version;show install active;show vlan;show
> > running-config" 172.17.1.6
> > PROMPT MATCH: RT-ZTE#
> > HIT COMMAND: RT-ZTE  #show version
> > In ShowVersion:  RT-ZTE  #show version
> > HIT COMMAND: RT-ZTE  #show install active
> > In ShowInstallActive:  RT-ZTE  #show install active
> > HIT COMMAND: RT-ZTE  #show vlan
> > In ShowVLAN:  RT-ZTE  #show vlan
> > HIT COMMAND: RT-ZTE  #show running-config
> > In WriteTerm:  RT-ZTE  #show running-config
> > *172.17.1.6 : End of run not found*
> > 172.17.1.6: clean_run is false
> > 172.17.1.6: found_end is false
> > !
>
> found end means that it found the end of the config; for type cisco,
> that means "^end".
>
> clean run means that it found the cli logout; for type cisco, that
> means "prompt[>#] exit$"
>
>

-- 
*Kevin Morales*
___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread john heasley
Wed, Jul 03, 2019 at 07:48:09AM -0600, Kevin Morales:
> Hello!,
> 
> How I can fix the problem when I run rancid for ZTE Router?. I get this
> error: *End of run not found*
> 
> the two file 172.17.1.6.new and 172.17.1.6.raw don't show any error!.
> 
> NOPIPE=yes ./rancid -d -t cisco 172.17.1.6
> 
> loadtype: device type cisco
> loadtype: found device type cisco in /usr/local/rancid/etc/rancid.types.base
> executing clogin -t 90 -c"show version;show install active;show vlan;show
> running-config" 172.17.1.6
> PROMPT MATCH: RT-ZTE#
> HIT COMMAND: RT-ZTE  #show version
> In ShowVersion:  RT-ZTE  #show version
> HIT COMMAND: RT-ZTE  #show install active
> In ShowInstallActive:  RT-ZTE  #show install active
> HIT COMMAND: RT-ZTE  #show vlan
> In ShowVLAN:  RT-ZTE  #show vlan
> HIT COMMAND: RT-ZTE  #show running-config
> In WriteTerm:  RT-ZTE  #show running-config
> *172.17.1.6 : End of run not found*
> 172.17.1.6: clean_run is false
> 172.17.1.6: found_end is false
> !

found end means that it found the end of the config; for type cisco,
that means "^end".

clean run means that it found the cli logout; for type cisco, that
means "prompt[>#] exit$"

___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Watchguard xml file

2019-07-03 Thread Wayne Eisenberg
If I run the export command manually, it just dumps the whole thing to the 
screen without any breaks or requests to 'hit space to continue' or things like 
that, so I don't *think* it's a page length type setting?

Actually, I just did another review and I'm thinking that it has something to 
do with the prompt definition. Just so we're looking at the same thing, the 
files are here: https://github.com/hillscott/rancid-watchguard. Forked from 
https://bitbucket.org/aquerubin/rancid-vyatta. 

In the xtmlogin file, it sets the prompt (line 436) to something I don't see. 
In this original state, xtmlogin never recognized it finished the login. When I 
changed that line to
set prompt ">>|#"
then xtmlogin completes successfully. (The prompt for this watchguard firewall 
is "WG#")

---
foreach router [lrange $argv $i end] {
set router [string tolower $router]
send_user "$router\n"

# device timeout
set timeout [find timeout $router]
if { [llength $timeout] == 0 } {
set timeout $timeoutdflt
}

set prompt ">>"

# Figure out username
if {[info exists username]} {
---

However, in the xtm.pm module, line 102 defines it again. 
---
while (/\s*($cmds_regexp)\s*$/) {
$cmd = $1;
$prompt = ">>";

if (!defined($prompt)) {
$prompt = ($_ =~ /^([^>]+>)/)[0];
$prompt =~ s/([][}{)(\\])/\\$1/g;
print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
}
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
print STDERR "$host: found unexpected command - \"$cmd\"\n";
$clean_run = 0;
last TOP;
}
$rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
delete($commands{$cmd});
if ($rval == -1) {
$clean_run = 0;
last TOP;
}
}
---
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.

---
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 = "#$" ?

Wayne



-Original Message-
From: john heasley  
Sent: Tuesday, July 02, 2019 7:48 PM
To: Wayne Eisenberg 
Cc: 'rancid-discuss@shrubbery.net' 
Subject: Re: [rancid] Watchguard xml file

Sat, Jun 29, 2019 at 11:46:23AM +, Wayne Eisenberg:
> Hi,
> 
> OK, so I can get into the firewall and pull the config with "export config to 
> console". However, the config file is a very large xml file, this one is 
> about 2MB in size. However, it seems like it only recorded the first 388KB of 
> data. Is there a size limit on what rancid can process, or maybe there was a 
> character in the xml that rancid didn't like and it just aborted processing 
> it? How would I go about troubleshooting this?
> 

there is no such limit.  I would suspect a PAGER is involved, causing the 
output to cease.


___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] Unable to figure out "end of run not found"

2019-07-03 Thread Kevin Morales
Hello!,

How I can fix the problem when I run rancid for ZTE Router?. I get this
error: *End of run not found*

the two file 172.17.1.6.new and 172.17.1.6.raw don't show any error!.

NOPIPE=yes ./rancid -d -t cisco 172.17.1.6

loadtype: device type cisco
loadtype: found device type cisco in /usr/local/rancid/etc/rancid.types.base
executing clogin -t 90 -c"show version;show install active;show vlan;show
running-config" 172.17.1.6
PROMPT MATCH: RT-ZTE#
HIT COMMAND: RT-ZTE  #show version
In ShowVersion:  RT-ZTE  #show version
HIT COMMAND: RT-ZTE  #show install active
In ShowInstallActive:  RT-ZTE  #show install active
HIT COMMAND: RT-ZTE  #show vlan
In ShowVLAN:  RT-ZTE  #show vlan
HIT COMMAND: RT-ZTE  #show running-config
In WriteTerm:  RT-ZTE  #show running-config
*172.17.1.6 : End of run not found*
172.17.1.6: clean_run is false
172.17.1.6: found_end is false
!



Thanks!




On Wed, Jun 19, 2019 at 3:02 PM Nick Nauwelaerts <
nick.nauwelae...@aquafin.be> wrote:

> iirc:
>
> ; is to seperate commands and wil execute the whole command string without
> checking the return value of the previous command
>
> && will do the same, but if previous command returns not null (you can
> check the return code of the previous command with "echo $?") it will end
> the command list.
>
>
>
> the syntax is question "NOPIPE=yes" will set the environment variable
> NOPIPE but only for the context of the command that's executed.
>
> appending ; between NOPIPE=yes & the command will _NOT_ do what you
> expect; it will execute and empty cmd with nopipe env set to yes, then
> execute your command with default envvars.
>
>
>
>
>
> you can compare:
>
>
>
> AHHA=aha env | grep -i aha
>
> output -> AHHA=aha
>
> AHHA=aha; env | grep -i aha
>
> output -> nothing
>
>
>
> export with set the envvar for your current session:
>
> env  | grep -i nop
>
> -> output nothing
>
> export NOPIPE=yes
>
> env  | grep -i nop
>
> output ->NOPIPE=yes
>
>
>
> all examples done in bash instead of my preferred zsh. if you use csh/tcsh
> or fish i would guess you know what you're doing and can adapt the config
> to work.
>
>
>
> bottom line, this is correct for most bourne shell derivatives:
>
> NOPIPE=yes rancid -d -t  
>
>
>
>
>
> here's the catch, if you run rancid from cron you will either need to
> uncomment the NOPIPE line in yr rancid.conf or add them to your crontab
> entry.
>
>
>
>
>
> side note:
>
> the next rancid version will most likely change this behaviour:
>
>
> https://github.com/haussli/rancid/commit/94318333c8f0d746abdd22cf4430636a394def8f
>
>
>
>
>
>
>
> // nick
>
>
>
>
>
>
>
> *From:* Rancid-discuss [mailto:rancid-discuss-boun...@shrubbery.net] *On
> Behalf Of *Gauthier, Chris
> *Sent:* Tuesday, June 18, 2019 00:10
> *To:* Piegorsch, Weylin William ; Michael Newton <
> mnew...@pofp.com>; Vacheslav Zouhairy 
> *Cc:* rancid-discuss@shrubbery.net
> *Subject:* Re: [rancid] Unable to figure out "end of run not found"
>
>
>
> Interesting.  I thought it would get mixed up into the value of the
> variable…. I’m not an expert programmer at all, but thought I needed to use
> the ; to separate the commands appropriately.  But, my expertise on shell
> variables is a tad (understatement, really) limited.  So, I shall defer! :)
>
>
>
> Cheers,
>
> Chris
>
>
>
>
>
> *Chris**​*
>
> *Gauthier*
>
>  Senior Network Engineer
>
>  |
>
> Comscore
>
> t +1 *(503) 331-2704* <(503)%20331-2704>
>
>  |
>
> *cgauth...@comscore.com* 
>
> *comscore.com* 
>
> ​​​This e-mail (including any attachments) may contain information that is
> private, confidential, or protected by attorney-client or other privilege.
> If you received this e-mail in error, please delete it from your system and
> notify sender.
>
> *From: *"Piegorsch, Weylin William" 
> *Date: *Monday, June 17, 2019 at 2:05 PM
> *To: *"Gauthier, Chris" , Michael Newton <
> mnew...@pofp.com>, Vacheslav Zouhairy 
> *Cc: *"rancid-discuss@shrubbery.net" 
> *Subject: *Re: [rancid] Unable to figure out "end of run not found"
>
>
>
> I actually don't use the semicolon. Not sure if this is bash specific, sh
> specific, or posix general, but without the semicolon it sets the global
> environment variable only for the duration of that command following the
> variable definition, and unset it upon returning control to the cli. See
> also your "export" comment, which has correlating implications regarding
> environment vs namespace vs scope.
>
> But I'm not an experienced programmer, and don't pretend to grok the
> various nuances, benefits, and pitfalls known by those who actually know
> what they're doing, so if using the semicolon is better I all ears.
>
> weylin
>
> Sent from Outlook on my 'Droid
>
>
> --
>
> *From:* Gauthier, Chris 
> *Sent:* Monday, June 17, 2019 4:22:02 PM
> *To:* Piegorsch, Weylin William; Michael Newton; Vacheslav Zouhairy
> *Cc:* rancid-discuss@shrubbery.net
> *Subject:* Re: [rancid] Unable to figure out "en