[rancid] Re: How do i downgrade from 2.3.2a9 to 2.3.2a8

Mina Eskander meskander at perimeterwatch.com
Fri Feb 27 18:15:48 UTC 2009


So it looks like the problem is with the regular expression matching, can anybody help me as to why and how to fix it?
Here is where it fails, it doesn't know it is in enable mode

expect: does "<switch>> (enable) " (spawn_id exp6) match regular expression "<switch>> \\(enable\\)"? no
"[\n\r]+"? no
expect: timed out

Error: TIMEOUT reached
write() failed to write anything - will sleep(1) and retry...
[rancid at pwsecLX ~]$


Mina Eskander
Perimeterwatch Technologies
Direct:   +1 (347) 448-2845
Mobile:   +1 (347) 510-4102
meskander at perimeterwatch.com

Network Security | Disaster Recovery | Business Continuity | IT Projects | Application Development
_____________________________________________________________________
New York: (347) 448-2845 - 34-12 36th Street - 2nd Floor - Astoria, NY 11106


-----Original Message-----
From: rancid-discuss-bounces at shrubbery.net [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Mina Eskander
Sent: Thursday, February 26, 2009 2:16 PM
To: john heasley; Lance Vermilion
Cc: rancid-discuss at shrubbery.net
Subject: [rancid] Re: How do i downgrade from 2.3.2a9 to 2.3.2a8

I don't really understand regex,  but here is the output


[rancid at pwsecLX ~]$ clogin -d -c 'show time' <switch>
<switch>
spawn telnet <switch>
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {28516}

expect: does "" (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does "" (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does "" (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? no
"([Pp]assword|passwd):"? no
">"? no
"Login invalid"? no
Trying <ipadd>...
Connected to <switch>.
Escape character is '^]'.

expect: does "Trying <ipadd>...\r\r\nConnected to <switch>.\r\r\nEscape character is '^]'.\r\r\n" (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does "Trying <ipadd>...\r\r\nConnected to <switch>.\r\r\nEscape character is '^]'.\r\r\n" (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does "Trying <ipadd>...\r\r\nConnected to <switch>.\r\r\nEscape character is '^]'.\r\r\n" (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? no
"([Pp]assword|passwd):"? no
">"? no
"Login invalid"? no


Cisco Systems Console


WARNING!!!
This system is solely for the use of authorized users for official purposes.
You have no expectation of privacy in its use and to ensure that the system
is functioning properly, individuals using this computer system are subject
to having all of their activities monitored and recorded by system
personnel. Use of this system evidences an express consent to such
monitoring and agreement that if such monitoring reveals evidence of
possible abuse or criminal activity, system personnel may provide the results
of such monitoring to appropriate officials.



Username:
expect: does "Trying <ipadd>...\r\r\nConnected to <switch>.\r\r\nEscape character is '^]'.\r\r\n\r\n\r\nCisco Systems Console\r\n\r\n\r\nWARNING!!!\r\nThis system is solely for the use of authorized users for official purposes.\r\nYou have no expectation of privacy in its use and to ensure that the system\r\nis functioning properly, individuals using this computer system are subject\r\nto having all of their activities monitored and recorded by system\r\npersonnel. Use of this system evidences an express consent to such\r\nmonitoring and agreement that if such monitoring reveals evidence of\r\npossible abuse or criminal activity, system personnel may provide the results\r\nof such monitoring to appropriate officials.\r\n\r\n\r\n\r\nUsername: " (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does "Trying <ipadd>...\r\r\nConnected to <switch>.\r\r\nEscape character is '^]'.\r\r\n\r\n\r\nCisco Systems Console\r\n\r\n\r\nWARNING!!!\r\nThis system is solely for the use of authorized users for official purposes.\r\nYou have no expectation of privacy in its use and to ensure that the system\r\nis functioning properly, individuals using this computer system are subject\r\nto having all of their activities monitored and recorded by system\r\npersonnel. Use of this system evidences an express consent to such\r\nmonitoring and agreement that if such monitoring reveals evidence of\r\npossible abuse or criminal activity, system personnel may provide the results\r\nof such monitoring to appropriate officials.\r\n\r\n\r\n\r\nUsername: " (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does "Trying <ipadd>...\r\r\nConnected to <switch>.\r\r\nEscape character is '^]'.\r\r\n\r\n\r\nCisco Systems Console\r\n\r\n\r\nWARNING!!!\r\nThis system is solely for the use of authorized users for official purposes.\r\nYou have no expectation of privacy in its use and to ensure that the system\r\nis functioning properly, individuals using this computer system are subject\r\nto having all of their activities monitored and recorded by system\r\npersonnel. Use of this system evidences an express consent to such\r\nmonitoring and agreement that if such monitoring reveals evidence of\r\npossible abuse or criminal activity, system personnel may provide the results\r\nof such monitoring to appropriate officials.\r\n\r\n\r\n\r\nUsername: " (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? yes
expect: set expect_out(0,string) "Username:"
expect: set expect_out(1,string) "Username"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "Trying <ipadd>...\r\r\nConnected to <switch>.\r\r\nEscape character is '^]'.\r\r\n\r\n\r\nCisco Systems Console\r\n\r\n\r\nWARNING!!!\r\nThis system is solely for the use of authorized users for official purposes.\r\nYou have no expectation of privacy in its use and to ensure that the system\r\nis functioning properly, individuals using this computer system are subject\r\nto having all of their activities monitored and recorded by system\r\npersonnel. Use of this system evidences an express consent to such\r\nmonitoring and agreement that if such monitoring reveals evidence of\r\npossible abuse or criminal activity, system personnel may provide the results\r\nof such monitoring to appropriate officials.\r\n\r\n\r\n\r\nUsername:"
send: sending "<username>\r" to { exp6 }
expect: continuing expect

expect: does " " (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does " " (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does " " (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? no
"([Pp]assword|passwd):"? no
">"? no
"Login invalid"? no
<username>

Password:
expect: does " <username>\r\r\n\r\nPassword: " (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does " <username>\r\r\n\r\nPassword: " (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does " <username>\r\r\n\r\nPassword: " (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? no
"([Pp]assword|passwd):"? yes
expect: set expect_out(0,string) "Password:"
expect: set expect_out(1,string) "Password"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) " <username>\r\r\n\r\nPassword:"
send: sending "<password>\r" to { exp6 }
expect: continuing expect

expect: does " " (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does " " (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does " " (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? no
"([Pp]assword|passwd):"? no
">"? no
"Login invalid"? no

expect: does " \r" (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does " \r" (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does " \r" (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? no
"([Pp]assword|passwd):"? no
">"? no
"Login invalid"? no


expect: does " \r\r\n" (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does " \r\r\n" (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does " \r\r\n" (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? no
"([Pp]assword|passwd):"? no
">"? no
"Login invalid"? no
N
expect: does " \r\r\nN" (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does " \r\r\nN" (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does " \r\r\nN" (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? no
"([Pp]assword|passwd):"? no
">"? no
"Login invalid"? no
YSWT09A>
expect: does " \r\r\n<switch>> " (spawn_id exp6) match regular expression "(Connection refused|Secure connection [^\n\r]+ refused)"? no
"(Connection closed by|Connection to [^\n\r]+ closed)"? no

expect: does " \r\r\n<switch>> " (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does " \r\r\n<switch>> " (spawn_id exp6) match glob pattern "Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).*(yes/no)?"? no
"HOST IDENTIFICATION HAS CHANGED.* (yes/no)?"? no
"Offending key for .* (yes/no)?"? no
"(denied|Sorry)"? no
"Login failed"? no
"% (Bad passwords|Authentication failed)"? no
"Press any key to continue"? no
"Enter Selection: "? no
"Last login:"? no
"@[^\r\n]+ ([Pp]assword|passwd):"? no
"(Username|Login|login|user name|User):"? no
"([Pp]assword|passwd):"? no
">"? yes
expect: set expect_out(0,string) ">"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) " \r\r\n<switch>>"
send: sending "enable\r" to { exp6 }

expect: does " " (spawn_id exp6) match regular expression "(Username|Login|login|user name|User):"? no
"[Pp]assword:"? no
"#"? no
"(enable)"? no
"(denied|Sorry|Incorrect)"? no
"% Error in authentication"? no
"% Bad passwords"? no
enable

Enter password:
expect: does " enable\r\r\n\r\nEnter password: " (spawn_id exp6) match regular expression "(Username|Login|login|user name|User):"? no
"[Pp]assword:"? yes
expect: set expect_out(0,string) "password:"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) " enable\r\r\n\r\nEnter password:"
send: sending "<enablePassword>\r" to { exp6 }
expect: continuing expect

expect: does " " (spawn_id exp6) match regular expression "(Username|Login|login|user name|User):"? no
"[Pp]assword:"? no
"#"? no
"(enable)"? no
"(denied|Sorry|Incorrect)"? no
"% Error in authentication"? no
"% Bad passwords"? no

expect: does " \r" (spawn_id exp6) match regular expression "(Username|Login|login|user name|User):"? no
"[Pp]assword:"? no
"#"? no
"(enable)"? no
"(denied|Sorry|Incorrect)"? no
"% Error in authentication"? no
"% Bad passwords"? no


expect: does " \r\r\n" (spawn_id exp6) match regular expression "(Username|Login|login|user name|User):"? no
"[Pp]assword:"? no
"#"? no
"(enable)"? no
"(denied|Sorry|Incorrect)"? no
"% Error in authentication"? no
"% Bad passwords"? no
<switch>> (enable)
expect: does " \r\r\n<switch>> (enable) " (spawn_id exp6) match regular expression "(Username|Login|login|user name|User):"? no
"[Pp]assword:"? no
"#"? no
"(enable)"? yes
expect: set expect_out(0,string) "(enable)"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) " \r\r\n<switch>> (enable)"
send: sending "\r" to { exp6 }

expect: does " " (spawn_id exp6) match regular expression "[\r\n]+"? no
"^(.+[:.])1 (> (enable) )"? no
"^.+> (enable) "? no
"^.+> \(enable\)"? no

expect: does " \r" (spawn_id exp6) match regular expression "[\r\n]+"? yes
expect: set expect_out(0,string) "\r"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) " \r"
expect: continuing expect

expect: does "" (spawn_id exp6) match regular expression "[\r\n]+"? no
"^(.+[:.])1 (> (enable) )"? no
"^.+> (enable) "? no
"^.+> \(enable\)"? no

<switch>> (enable)
expect: does "\r\n<switch>> (enable) " (spawn_id exp6) match regular expression "[\r\n]+"? yes
expect: set expect_out(0,string) "\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "\r\n"
expect: continuing expect

expect: does "<switch>> (enable) " (spawn_id exp6) match regular expression "[\r\n]+"? no
"^(.+[:.])1 (> (enable) )"? no
"^.+> (enable) "? no
"^.+> \(enable\)"? yes
expect: set expect_out(0,string) "<switch>> (enable)"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "<switch>> (enable)"
send: sending "set length 0\r" to { exp6 }

expect: does " " (spawn_id exp6) match regular expression "<switch>> \\(enable\\)"? no
"[\n\r]+"? no
s
expect: does " s" (spawn_id exp6) match regular expression "<switch>> \\(enable\\)"? no
"[\n\r]+"? no
et length 0
Screen length for this session set to 0.
<switch>> (enable)
expect: does " set length 0\r\r\nScreen length for this session set to 0.\r\n<switch>> (enable) " (spawn_id exp6) match regular expression "<switch>> \\(enable\\)"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) " set length 0\r\r\n"
expect: continuing expect

expect: does "Screen length for this session set to 0.\r\n<switch>> (enable) " (spawn_id exp6) match regular expression "<switch>> \\(enable\\)"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "Screen length for this session set to 0.\r\n"
expect: continuing expect

expect: does "<switch>> (enable) " (spawn_id exp6) match regular expression "<switch>> \\(enable\\)"? no
"[\n\r]+"? no
expect: timed out

Error: TIMEOUT reached
write() failed to write anything - will sleep(1) and retry...
[rancid at pwsecLX ~]$


Mina Eskander
Perimeterwatch Technologies
Direct:   +1 (347) 448-2845
Mobile:   +1 (347) 510-4102
meskander at perimeterwatch.com

Network Security | Disaster Recovery | Business Continuity | IT Projects | Application Development
_____________________________________________________________________
New York: (347) 448-2845 - 34-12 36th Street - 2nd Floor - Astoria, NY 11106


-----Original Message-----
From: rancid-discuss-bounces at shrubbery.net [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of john heasley
Sent: Thursday, February 26, 2009 1:43 PM
To: Lance Vermilion
Cc: rancid-discuss at shrubbery.net
Subject: [rancid] Re: How do i downgrade from 2.3.2a9 to 2.3.2a8

Thu, Feb 26, 2009 at 10:40:11AM -0800, john heasley:
> Thu, Feb 26, 2009 at 10:14:11AM -0700, Lance Vermilion:
> > Mina,
> >
> > I am assuming with user interaction it works just fine versus running
> > the command as a passed in argument.
> >
> > John,
> >
> > Any idea why it would recognize the prompt enough to send set term
> > length 0 but not recognize it afterwards?
>
> Maybe its running on freebsd?  Or someone has altered the script?  or

Sorry, to explain the freebsd comment; at one point they imported a
version of expect or patched it or whatever in/into frebssd-ports and
a few things were broken, globs among them and regexes were acting
funny.
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss at shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss at shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss


More information about the Rancid-discuss mailing list