Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Run a script to automate PPP connections Internet
This will be of interest to those of you whose ISPs require a command line login. The login could be automated via a script in OS 7/8/9, but not in OS X prior to 10.2. Until 10.2, you had to manually enter username, password, and possibly more in a Terminal window. A number of people in several OS X forums have noticed that in the 10.2 Network preferences pane under PPP Options there is a new "Terminal Script" pop-down. Normally it is dimmed out and unusable. Trouble is, there is nothing in Mac Help or on the Apple Web site explaining how to use it. Thanks to a lead posted by Kai Kniepkamp in Apple's OS X forum, here's how:

Create a new folder in /Library/Terminal Scripts. I set the ownership and permissions on mine to match the rest of the folders in /Library: Owner "system" with Read & Write permissions, group "admin" with read & write permissions, and read only permission for Other. This may not be necessary, but I'll leave it to others to test that.

If you already have a PPP connection script (perhaps provided by your ISP or created by the OS 8/9 Remote Access control panel), copy it to the new /Library/Terminal Scripts folder.

Now open the Networks preferences pane, click the PPP tab, then click the PPP Options button. Pop down the Terminal Script menu to select your script. DO NOT enable the "Connect using terminal window" option. You don't need it with a terminal script.

If you don't already have a script, the simplest way to create one pretty much guaranteed to work with your ISP is to use the OS 9 Remote Access control panel's ability to create on for you on the fly. If you don't know how to do that, read article number 24078 in the Apple Support knowledge base.


Panther proven!
    •    
  • Currently 4.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[9,973 views]  

Run a script to automate PPP connections | 9 comments | Create New Account
Click here to return to the 'Run a script to automate PPP connections' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
good for CompuServe classic
Authored by: j-beda on Sep 04, '02 12:12:48PM

This looks like it will be good for compuserve. Currently there are some modem
scripts into which one can embed one's user id and password for Mac OS X, and a script for Mac OS 9 in order to connect via PPP. Now it looks like one can use the same script for Mac OS X 10.2 as well as 9. The scripts are availabe in the Mac help forum on CS.

Of course I have yet to try it out...



[ Reply to This | # ]
good for CompuServe classic
Authored by: bobwill on Dec 19, '02 07:12:04PM

The script idea worked fine, but there is an interesting glitch. One of my providers doesn 't use a connection script. But once you have created a Terminal Scripts file the OS seems to require one, EVEN IF YOU HAVE THE TERMINAL SCRIPT OPTION TURNED TO "NONE" in the PPP preferences file.

The work around is to rename the Terminal Scripts file XTerminal Scripts (or something) when you want to use a IP that doens't use terminal scripts. Messy but effective.

Cheers

Bob



[ Reply to This | # ]
Has potential, but...
Authored by: DavidMaxWaterman on Oct 07, '02 12:33:34PM

1) I don't have os9 (nor classic - never used them, never had to [until now]) so I cannot generate an example script (I only have OS X 10.2.1). I imagine people might find an example very useful - anyone have one they can post?
2) Most of the login procedure I have is automated (the initial login and password prompts), but the final password prompt cannot be automated. I can't help but wonder if this facility will work in my case. I can't find any documentation etc to help, so I'm SOL :(

Any clues anyone?

Max.



[ Reply to This | # ]
Run a script to automate PPP connections
Authored by: TonyB1 on Jul 18, '03 03:30:34PM

I've used this before on an OS X v10.2.x mac, so I now I'm trying to set up a script for someone else's mac, but now it won't work on mine here at work. I can connect fine going thru the terminal window but when I tell it to use the connect script it fails. I just made this script in OS 9's remote access. I'm running 10.2.6. Any ideas?
Thanks, Tony



[ Reply to This | # ]
Run a script to automate PPP connections
Authored by: LinuxZealot2003 on Oct 16, '03 08:46:57AM
Thanks kids. With this hint and some googling around on the net, I was able to connect to my compuserve account from OS 10.2. I can find no documentation for Apple's chat language, which looks way different from the unix/linux chat(8) command. But I found a couple of sample files and by examination I was able to cobble together a working ppp login chat script for compuserve's 800 number. Here's the results of my hacking:
!
@ANSWER
@HANGUP
EXIT 0
!
@ORIGINATE
!
CHRDELAY 1
!
@LABEL 10
IncTries
IfTries 5 99
PAUSE 5
WRITE "\13"
!
@LABEL 11
MATCHCLR
MATCHSTR 1 12 "Host Name:"
MATCHREAD 300
NOTE "Connect script couldn't match \34Host Name:\34.  Retrying" 3
JUMP 10
!
@LABEL 12
WRITE "+CIS\13"
!
@LABEL 13
MATCHCLR
MATCHSTR 1 14 "ID:"
MATCHREAD 300
NOTE "Connect script couldn't match \34ID:\34."
JUMP 99
!
@LABEL 14
WRITE "YOUR.ID/GO:PPPCONNECT\YOUR.PASS\13"
PAUSE 3
JUMP 90
!
@LABEL 90
PAUSE 1
EXIT 0
!
@LABEL 99
PAUSE 60
EXIT -6002 "Connection script failed."
You will, of course, have to substitute your compuserve ID for "YOUR.ID" and your password for "YOUR.PASS". Alas, if I had doc on this language, or even a few more connect script examples, I could probably make a far more elegant thing. Maybe I could even find a way to incorporate the password you enter into the 'ppp preferences' window. This sample ignores that field, and leaves your password in the clear on your hard drive. So it goes in the closed-source world, I guess. If you edit this file into a file called "Compuserve", add your ID information, and place it in the directory mentioned in the other comments, you'll be able to automatically log in to compuserve's ppp server. If you have trouble, there's a 'verbose logging' option in the ppp options page which may give you enough information to debug the script in /var/log/syslog. Anyway, my wife is now reasonably happy with my computing prowess.

[ Reply to This | # ]
Run a script to automate PPP connections
Authored by: LinuxZealot2003 on Oct 16, '03 09:37:12AM

Argh. Betrayed by the evil html.

This is the correct script. Note the backslash ("\") characters.

!
@ANSWER
@HANGUP
EXIT 0
!
@ORIGINATE
!
CHRDELAY 1
!
@LABEL 10
IncTries
IfTries 5 99
PAUSE 5
WRITE "\13"
!
@LABEL 11
MATCHCLR
MATCHSTR 1 12 "Host Name:"
MATCHREAD 300
NOTE "Connect script couldn't match \34Host Name:\34. Retrying" 3
JUMP 10
!
@LABEL 12
WRITE "+CIS\13"
!
@LABEL 13
MATCHCLR
MATCHSTR 1 14 "ID:"
MATCHREAD 300
NOTE "Connect script couldn't match \34ID:\34."
JUMP 99
!
@LABEL 14
WRITE "YOUR.COMPUSERVEID/GO:PPPCONNECT\\YOUR.PASSWORD\13"
PAUSE 3
JUMP 90
!
@LABEL 90
PAUSE 1
EXIT 0
!
@LABEL 99
PAUSE 60
EXIT -6002 "Connection script failed."



[ Reply to This | # ]
Wait for Callback?
Authored by: Anonymous on Dec 15, '03 03:52:05AM

I've searched in vain for a "dictionary" or tutorial on how to modify the above script. What I want to do is HangUp once I've authenticated (or have the server Hang Up on me) and then "answer" and incoming call and log in again.

I've found some scripts that do it in SCO, and windows, but obviously the script doesn't use the same language. Would one of you gurus know how to do it?

Thanks.



[ Reply to This | # ]
Run a script to automate PPP connections
Authored by: sloetguy on Oct 16, '03 11:55:28AM

This will send what is in the username field:
write "^u\13"

This will send the password field:
write "^p\13"

The \13 is the return key so you should be able to get rid of that integrate it into a single line.

You can even do error checking so it will prompt you if the username is wrong.

Jason


note "Waiting for Username prompt..." 3
matchclr
matchstr 1 20 "sername: " !--- first letter ambiguity can't hurt...
matchread 150
note "No username prompt" 3
jump 99
!----------------------------------------------------------
!--- Connect successful. Time to login...
!--- Send the User's login
!----------------------------------------------------------
@LABEL 20
note "------------- label 20 ----------" 3
note "Sending Username..." 3
write "^u\13"
matchclr
matchstr 1 30 "assword: "
matchread 150
note "Timed out waiting for \34Password: \34 prompt." 3
jump 99

!----------------------------------------------------------
!--- Send the user's password
!----------------------------------------------------------
@LABEL 30
note "------------- label 30 ----------" 3
note "Sending Password..." 3
write "^p\13"



[ Reply to This | # ]
Sending more than a single username and password
Authored by: sloetguy on Oct 16, '03 12:05:53PM

This will prompt the user for the final password. Is this more like what you are looking for?

I wrote this for a company using Compuserve with a secure tunnel back to their LAN. Hence the xyzpdq reference....

@ANSWER
@HANGUP
EXIT 0
!
@ORIGINATE
!
CHRDELAY 1
!
@LABEL 10
PAUSE 5
WRITE "\13"
!
@LABEL 11
MATCHCLR
MATCHSTR 1 12 "Host Name: "
MATCHREAD 300
NOTE "Connect script couldn't match \34 Host Name: \34" 3
JUMP 99
!
!(Hard coded "xyzpdq" since this is for xyzpdq use only with the xyz system)
@LABEL 12
PAUSE 1
note "Sending Host Id..."
WRITE "xyzpdq\13"
!
@LABEL 13
MATCHCLR
MATCHSTR 1 14 "UIC: "
MATCHREAD 300
NOTE "Connect script couldn't match \34UIC: \34" 3
JUMP 99
!
!(This sends whatever is in the "username" field in remote access)
@LABEL 14
PAUSE 1
Note "Sending Compuserve User-ID..."
WRITE "^11\13"
!
@LABEL 20
MATCHCLR
MATCHSTR 1 25 "Password: "
MATCHREAD 300
NOTE "Connect script couldn't match \34Password: \34" 3
JUMP 99
!
!(This sends whatever is in the "password" field in remote access)
@LABEL 25
PAUSE 1
Note "Sending Compuserve Password...
WRITE "^12\13"
!
@LABEL 30
MATCHCLR
MATCHSTR 1 35 "Username: "
MATCHREAD 300
NOTE "Connect script couldn't match \34Username: \34" 3
JUMP 99
!
!
!If you comment out the following section (35) and replace the write command with
!
!WRITE "USERNAME\13"
!"USERNAME\13" should be your first initial last name\13 IE: "juser@abc/13"
!
!You will then be able to skip that dialog box. You must keep the security server pin as an ask !everytime for security measures.
!
@LABEL 35
PAUSE 1
ASK 1 "What is your Security Server User ID" [98]
!
@LABEL 40
PAUSE 1
Note "Sending abc User-ID..."
WRITE "^*\13"
!
@LABEL 45
MATCHCLR
MATCHSTR 1 50 "Password: "
MATCHREAD 300
NOTE "Connect script couldn't match \34abc Password: \34" 3
JUMP 99
!
@LABEL 50
PAUSE 1
ASK 1 "What is your Security Server Pin?" [98]
!
!
@LABEL 55
PAUSE 1
Note "Sending abc Password..."
WRITE "^*\13"

@LABEL 90
PAUSE 1
EXIT 0
!
@LABEL 98
PAUSE 60
EXIT -6002 "You must enter a password"
!
@LABEL 99
PAUSE 60
EXIT -6002 "Connection script failed."



[ Reply to This | # ]