Use this dialog to compose a dial in script for your ISP dialup connection. Use the mini-terminal and the information supplied by your ISP to understand which sequence of actions needs to be executed.
Expect: kppp will wait for the specified string to be received.
Send: kppp will send the specified string.
Scan: kppp will scan the the input stream for the specified string and store any character after the string up to the first newline in an internal buffer. Trailing and leading whitespace will be stripped off.
Save: permanently store the previously scanned string in the specified register. So far, the only valid register is 'password'.
Pause: pause for the specified number of seconds
Hangup: kppp will send the hangup command to the modem
Answer: kppp will set the modem into answer mode
Timeout: change the default timeout to the specified number of seconds dynamically during script execution. 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.
PWPrompt: Prompt the kppp user to enter a string, given the specified string as a hint. An asterisk will be printed for each character typed.
ID: If the ID field on kppp's main dialog is filled in, send that ID. If the 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 the second iteration, a prompt will be displayed, given the specified string as a hint.
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 given 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 the second iteration, a prompt will be displayed, given the specified string as a hint.
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 the LoopStart, enabling repetition of username/password style paired dialogs.
Here is a simple 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. |
Here a script for the same account with ID and password prompt: This script will prompt for ID and password each time, no matter what is typed into the ID and password field on kppp's main dialog. This script also illustrated the use of the LoopStart/LoopEnd structure. If something goes wrong during the login procedure, for example if 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 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 |
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 |
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 dialling 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 |
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 do that 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 a combination of the Scan/Save keywords:
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 |