1 #!/usr/local/bin/expect -f
3 # This script was written by Jim Isaacson <jcisaac@crl.com>. It is
4 # designed to work as a script to use the SecureCARD(tm) device. This
5 # little device is mated with a central controller. The number displayed
6 # on this card changes every so often and you need to enter the number
7 # along with your user account name in order to gain access. Since chat
8 # is based upon fixed strings this procedure will not work with chat.
10 # It is included by permission. An excellent reference for the expect
11 # program used by this script is in the book:
15 # Published by O'Rielly and Associates
18 send_user "hello, starting ppp\n"
20 system "stty 19200 -echoe -echo raw < /dev/ttyS3 > /dev/ttyS3"
23 # These are the parameters for the program.
28 set dialup <put phone number here>
31 spawn -noecho -open [open $modem "r+"]
36 send "ATe0v1x4&c1q0&d2&c1s2=128s0=0DT $dialup\r"
40 set still_connecting 1
45 set still_connecting 0
50 set still_connecting 0
54 send_user "Failed to Connect, exiting...\n"
57 -re ".*NO.*DIAL.*TONE" {
58 send_user "Failed to Connect, exiting...\n"
62 send_user "Failed to Connect, exiting...\n"
70 expect_user -re "(.*)\n"
71 send "$expect_out(1,string)\r"
77 expect_user -re "(.*)\n"
78 send "$expect_out(1,string)\r"
95 if { $still_connecting > 0 } {
101 if { $counter > 8 } {
102 send_user "Cannot Connect\n"
110 overlay -0 $spawn_id -1 $spawn_id pppd /dev/ttyS3 19200 192.111.187.215: \
111 crtscts modem defaultroute debug