The Login Script tab


The Accounts Login Script tab

The Accounts Login Script tab


Use this dialog to compose a dial in script for your ISP dialup connection. You can use the mini-terminal and the information supplied by your ISP to find out what sequence of actions needs to be executed.

Choose an option from the drop down box on the left, and then add any parameters for that action in the edit box on the right. Use Add to add each entry to the bottom of the script, which is displayed in the lower part of the dialog. Use Insert to insert an entry anywhere in the script, and use Remove to delete a line from the script.

The options available are:

Expect

KPPP will wait for the specified string to be received.

Send

KPPP will send the specified string.

Scan

KPPP will scan the input stream for the specified string, and will store any character from the end of the string up to the next newline, in an internal buffer. Trailing and leading whitespace will be stripped off.

Save

Permanently store the previously scanned string in the specified register. Currently the only valid register is password.

Pause (sec)

Pause for the specified number of seconds.

Hangup

KPPP will send the hangup to the modem.

Answer

KPPP will set the modem into answer mode.

Timeout (sec)

Change the default timeout to the specified number of seconds dynamically during the script. You can change the timeout several times during script execution if necessary.

Prompt

Prompt the KPPP user to enter a string, given the specified string as a hint. The user will see what is typed. If the specified string includes the mark ##, the mark will be replaced with the current content of the internal scan buffer, as previously stored with the scan command.

PWPrompt

Prompt the KPPP user to enter a string, given the specified string as a hint. An asterisk will be printed for each character the user types.

ID

If the Login ID field on KPPP's main dialog is filled in, send that ID. If the Login ID field is not filled in, prompt the KPPP user to enter an ID, given the specified string as a hint. The user will see what is typed. On a second pass, such as in a loop on a second iteration, or during callback authentication, the prompt will be displayed regardless of whether the Login ID field is filled in.

Password

If the Password field on KPPP's main dialog is filled in, send that password. If the Password field is not filled in, prompt the KPPP user to enter a password, with the specified string as a hint. An asterisk will be printed for each character typed. On a second pass, such as in a loop on a second iteration, or during callback authentication, the prompt will be displayed regardless of whether the Password field is filled in.

LoopStart

KPPP will wait for the specified string to be received. It will save the string for use by LoopEnd.

LoopEnd

KPPP will wait for the specified string to be received to exit the loop. If the string given by the corresponding LoopStart is received first, it will trigger a jump to the line after LoopStart, enabling repetition of username/password style paired dialogs.

Example Scripts

Example 4.1. A simple example login script

Here is a simple example script I could use to connect to my ISP

 Expect      ID:                        # wait for ID:
 Send        myid                       # you have to substitute myid with your id
 Expect      word:                      # wait for 'password'
 Send        4u3fjkl                    # send my password '4u3fjkl'
 Expect      granted                    # My ISP send 'Permission granted' on login success.
 Send        ppp                        # This starts a ppp connection for 
                                        # me on the ISP side.

Example 4.2. A login script that prompts for ID and password, and has loops.

Here is a script for the same account with an ID and password prompt. This script will prompt for ID and password each time, no matter what is typed into the Login ID and password fields on KPPP's main screen.

This script also illustrates the use of the LoopStart/LoopEnd structure. If something goes wrong during the login procedure, for example, I mistype the password, my ISP will print an error message and restart the id/password loop by issuing the string ID: again. If the string ID: is caught before the LoopEnd keyword was parsed, KPPP will start the script again, from the line after the LoopStart keyword.

 LoopStart   ID:                        # wait for ID:
 Prompt      Enter ID:                  # Prompt me for my ID and send it off.
 Expect      word:                      # wait for 'password'
 PWPrompt    Enter Password:            # Prompt me for my password and send it off.
 LoopEnd     granted                    # My ISP send 'Permission granted' on login success.
 Send        ppp                        # This starts a ppp connection for me

Example 4.3. Prompts for information not filled in on the main dialog.

Here is the script that I actually use to connect to my ISP. This script will prompt for ID and password only if I haven't filled in the respective fields on KPPP's main dialog.

 LoopStart   ID:                        # wait for ID:
 ID          Enter ID:                  # Prompt me for my ID and send it off.
 Expect      word:                      # wait for 'password'
 Password    Enter Password             # Prompt me for my password and send it off.
 LoopEnd     granted                    # My ISP send 'Permission granted' on login success.
 Send        ppp                        # This starts a ppp connection for me
                                        # on the ISP side

Example 4.4. A script for an ISP using challenge/response authentication.

Here is a script that I use to connect to an ISP which is using some sort of challenge/response authentication. Usually you got a hardware token (a smart card with a display and calculator like keypad) from the ISP. You have to know a password to use the token. After dialing in your ISP displays your challenge. You have to type in the challenge to your token and get a dynamic password as a response. Then you have to enter that password.

 LoopStart   ID:                        # wait for ID:
 ID          Enter ID:                  # Prompt me for my ID and send it off.
 Scan        Challenge:                 # Scan for 'Challenge' and store everything behind up to the next newline.
 Expect      Password:                  # wait for 'password'
 Prompt      Your token is ## - Enter Password  # Prompt me for my password and send it off.
 LoopEnd     granted                    # My ISP sends 'Permission granted' on login success.
 Send        ppp                        # This starts a ppp connection for me
                                        # on the ISP side

Example 4.5. Using Scan and Save in scripts

The following log shows the login procedure of a fictitious ISP that provides a new password on each login. The new password has to be verified and recorded for the next session.

 University of Lummerland
 
 Login:mylogin
 Password: 
 The password for your next session is: YLeLfkZb
 Please record and enter it for verification.
 Verification:YLeLfkZb
 
 1 = telnet
 2 = SLIP
 3 = PPP
 
 Your choice:

KPPP can be used to this cumbersome task for you, eliminating the risk of losing that little sheet of paper that holds your current password at the same time. The key part of the following script is the combination of Scan/Save keywords.

7 Expect      Login:                     # wait for login prompt
 ID                                     # send ID
 Expect      Password:                  # wait for password prompt
 Password                               # send password
 Scan        is:                        # wait for '... next session is:' and
                                        # scan the preceding password
 Save        password                   # save the new password for next login
 Expect      Verification:              # wait for 'Verification:'
 Password                               # send new password
 Expect      choice:                    # wait for a prompt that let's you choose
                                        # between different options (telnet, SLIP, PPP)
 Send        3                          # choose option 3, i.e. PPP