Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8195299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:05:28+00:00 2026-06-07T05:05:28+00:00

I am very close to finish a TCL/TK app that logs into a Cisco

  • 0

I am very close to finish a TCL/TK app that logs into a Cisco Access Point via a serial connection (RS232} and gives it an IP address (very basic)

However, I would like my script to attempt a secondary password if the first one fails

This is how the Cisco CLI behaves with a serial connection when the incorrect password is entered 3 times (No User Name is needed, only prompts for a password)

Password:
Password:
Password:
% Bad secrets

Again, if the default password of “Cisco” does not work, I need the script to try the secondary password of “Cisco2”

The following is my most recent unsuccessful attempt at this problem.

    expect "*>" {send "en\r"}

    expect {
    "Password:" {send "Cisco\r"; exp_continue}
    "Password:" {send "Cisco2\r"; exp_continue}
    }

    expect "*#" {send "config t\r"}

Thanks in advance for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:05:30+00:00Added an answer on June 7, 2026 at 5:05 am

    The simplest way is to have a list of passwords to try which you step through:

    set passwords {"Cisco" "Cisco2"}
    set idx 0
    expect "*>"
    send "en\r"
    expect {
       "Password:" {
          send "[lindex $passwords $idx]\r"
          incr idx
          exp_continue;   # Continue to wait for the "after" prompt
       }
       "*#" {send "config t\r"}
    }
    

    The trick is that you have to also expect the thing that comes after, so that you don’t fall back on timeouts or things like that. (Well, assuming you don’t want timeouts. If you do, go right ahead!) This is because expect waits for all its match clauses simultaneously. In your buggy code, you had two clauses with the same match text, so it was always picking the first of them (IIRC, if multiple clauses match at the current point, the first possible branch is the one chosen).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When multiplying a floating point number that is very close to 1 with an
We have a game that is very close to being released, but we have
I would like to make a plot with ggplot that looks very close to
I am very close to finishing this project however I have a problem that
I've found a bunch of questions that were very close to what I need.
I have two droppable divs that are very close to each other on the
My problem is that when I plot y-values that are very close, matplotlib uses
I found a tutorial that is very close to what I am looking to
I have two listboxes that are very close together, one on top and one
I feel I am very close, to my regex -9.99 through 0. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.