From owner-freebsd-questions Sat Mar 21 23:03:25 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA17910 for freebsd-questions-outgoing; Sat, 21 Mar 1998 23:03:25 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from quackerjack.cc.vt.edu (quackerjack.cc.vt.edu [198.82.160.250]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA17903 for ; Sat, 21 Mar 1998 23:03:13 -0800 (PST) (envelope-from drummerboy@vt.edu) Received: from sable.cc.vt.edu (sable.cc.vt.edu [128.173.16.30]) by quackerjack.cc.vt.edu (8.8.8/8.8.8) with ESMTP id CAA22766 for ; Sun, 22 Mar 1998 02:06:25 -0500 (EST) Received: from vt.edu (as2511-20.sl007.cns.vt.edu [128.173.36.46]) by sable.cc.vt.edu (8.8.8/8.8.8) with ESMTP id CAA32369 for ; Sun, 22 Mar 1998 02:02:58 -0500 (EST) Message-ID: <3514B74C.C75989D9@vt.edu> Date: Sun, 22 Mar 1998 02:01:32 -0500 From: Gordon Shankman X-Mailer: Mozilla 4.04 [en] (Win95; I) MIME-Version: 1.0 To: freebsd-questions@FreeBSD.ORG Subject: PPP Scripting Content-Type: multipart/alternative; boundary="------------C183C6E7324F9FB42492F24F" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --------------C183C6E7324F9FB42492F24F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I am having trouble writing a script that will work with my dialup connection. It is a serial port, "direct" connection so it does not use a modem. I have written a script for it in /etc/ppp/ppp.conf with the appropriate commands in /etc/ppp/ppp.linkup to set up a dynamic IP address, as follows: ppp.conf 1. default: 2. set device /dev/cuaa0 3. set speed 19200 4. set log Phase Chat Connect Carrier hdlc LCP IPCP CCP tun 5. set dial "ABORT BUSY ABOURT NO\\sCARRIER TIMEOUT 5 \"\" ATE1Q0 OK-AT-OK \\dATDT\\\T TIMEOUT 40 CONNECT 6. 7. vttelnet: 8. set dial "" 9. set line /dev/cuaa0 10. set speed 19200 11. set login "IFY?\r-\r-IFY?\r c MBER:\r vttelnet LETE \r\r\r\r\r name:-\r-name: username ssword: pword Serv> ppp stname: default" 12. set timeout 0 13. deny lqr 14. set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 15. delete ALL 16. add 0 0 HISADDR ppp.linkup 1. vttelnet: 2. delete ALL 3. add 0 0 HISADDR 4. !bg sendmail -bg -q30m I have not been able to test it to see if it works because when I run ppp with either the command line: ppp -auto vttelnet or by running ppp, then using dial vttelnet it goes to a dial prompt and says: dialing attempt 1 of 1 dial...OK! It then sits there with a blinking cursor. I manually connect using ppp, and then term. The script is designed to do the following: Once term is executed, send until CALL, DISPLAY, OR MODIFY? appears, then send a c which brings up the prompt: ENTER NUMBER: send vttelnet and wait for CALL COMPLETE send which brings up Username: send username wait for Password: send pword wait for VT_TermServ> send ppp wait for IP address or hostname: send default Once this is done term exits and the script sets up the dummy IP addresses, then the script in ppp.linkup assigns the correct IP addresses and I can get out on the net. Will the script I have work with this dialup and how can I get it to work? If not, what can I change to get it to work? The following is a Win 95/NT dialup networking script for this dialup. It was written by Virginia Tech and does more than what I need for the BSD script but it might help you help me so here it is: ; ; A script for logging in to VT HSMP ; proc main ; variable declarations ; change "default" to IP address for static PPP string myIP = "default" integer maxretries = 5 integer retries = 0 ;========================================= getCBXprompt: ;========================================= set screen keyboard off retries = retries + 1 transmit "" delay 1 transmit "" delay 1 transmit "" delay 1 transmit "" delay 1 transmit "" waitfor " MODIFY?" then doCall until 2 if ( retries <= maxretries) then goto getCBXprompt endif transmit "No CBX prompt." halt ;========================================= doCall: ;========================================= retries = 0 transmit "c vttelnet" waitfor "COMPLETE" then doTermServ, "ABORT" then handleInQueue, "RETRY?" then handleRetry ;========================================= doTermServ: ;========================================= transmit "" delay 1 transmit "" delay 1 transmit "" delay 1 transmit "" delay 1 transmit "" waitfor "sername:" then doLogin until 2 goto doTermServ ;========================================= handleInQueue: ;========================================= waitfor "COMPLETE" then doTermServ ;========================================= handleRetry: ;========================================= if retries < maxretries then retries = retries + 1 transmit "N" goto getCBXprompt endif transmit "Call failed." halt ;========================================= doLogin: ;========================================= delay 1 transmit $USERID + "" waitfor "assword:" delay 1 transmit $PASSWORD, raw transmit "" ; check for bad or expired password waitfor "denied" then handleBadPass, "expiring" then handleExpPass until 2 goto startPPP ;========================================= handleBadPass: ;========================================= set screen keyboard on waitfor "assword" waitfor "" set screen keyboard off waitfor "expiring" then handleExpPass, "denied" then handleBadPass, "_TermServ>" then startPPP until 2 ;========================================= handleExpPass: ;========================================= delay 1 transmit "changepass" + "" waitfor "(PID)" delay 1 transmit $USERID + "" waitfor "assword:" set screen keyboard on ;----------------------- ; uncomment the following ; block to have the script ; handle expired passwords ; automatically. ;----------------------- ;transmit $PASSWORD, raw ;transmit "" ;delay 1 ;transmit $PASSWORD, raw ;transmit "" ;delay 1 ;transmit $PASSWORD, raw ;transmit "" ;----------------------- waitfor "_TermServ>" set screen keyboard off transmit "login" + "" goto doTermServ ;========================================= startPPP: ;========================================= transmit "PPP " + myIP + "" if myIP == "default" then goto handleDefault endif if myIP != "default" then goto handleStatic endif ;========================================= handleDefault: ;========================================= waitfor "denied" then cantDSLIP, "address is" then queryIP until 3 queryIP: set ipaddr getip goto breakOut cantDSLIP: transmit "+ Default SLIP access denied." halt ;========================================= handleStatic: ;========================================= waitfor "assword" transmit $PASSWORD, raw transmit "" waitfor "denied" then noSTATIC, "your system." then breakOut until 3 noSTATIC: transmit "+ Static SLIP access denied." halt breakOut: endproc Thank you for any help you may be able to provide. Gordon Shankman Computer Science Major Virginia Tech --------------C183C6E7324F9FB42492F24F Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit I am having trouble writing a script that will work with my dialup connection.  It is a serial port, "direct" connection so it does not use a modem.  I have written a script for it in /etc/ppp/ppp.conf with the appropriate commands in /etc/ppp/ppp.linkup to set up a dynamic IP address, as follows:

ppp.conf

1.  default:
2.   set device /dev/cuaa0
3.   set speed 19200
4.   set log Phase Chat Connect Carrier hdlc LCP IPCP CCP tun
5.   set dial "ABORT BUSY ABOURT NO\\sCARRIER TIMEOUT 5 \"\"
    ATE1Q0 OK-AT-OK \\dATDT\\\T TIMEOUT 40 CONNECT
6.
7.  vttelnet:
8.   set dial ""
9.   set line /dev/cuaa0
10.  set speed 19200
11.  set login "IFY?\r-\r-IFY?\r c MBER:\r vttelnet LETE
    \r\r\r\r\r name:-\r-name: username ssword: pword Serv> ppp
    stname: default"
12.  set timeout 0
13.  deny lqr
14.  set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0
15.  delete ALL
16.  add 0 0 HISADDR

ppp.linkup

1.  vttelnet:
2.   delete ALL
3.   add 0 0 HISADDR
4.   !bg sendmail -bg -q30m

I have not been able to test it to see if it works because when I run ppp with either the command line:  ppp -auto vttelnet or by running ppp, then using dial vttelnet it goes to a dial prompt and says:

dialing attempt 1 of 1
dial...OK!

It then sits there with a blinking cursor.  I manually connect using ppp, and then term.  The script is designed to do the following:

Once term is executed, send <CR> until
CALL, DISPLAY, OR MODIFY?
appears, then send a
c
which brings up the prompt:
ENTER NUMBER:
send
vttelnet
and wait for
CALL COMPLETE
send
<CR><CR><CR><CR><CR>
which brings up
Username:
send
username
wait for
Password:
send
pword
wait for
VT_TermServ>
send
ppp
wait for
IP address or hostname:
send
default

Once this is done term exits and the script sets up the dummy IP addresses, then the script in ppp.linkup assigns the correct IP addresses and I can get out on the net.  Will the script I have work with this dialup and how can I get it to work?  If not, what can I change to get it to work?  The following is a Win 95/NT dialup networking script for this dialup.   It was written by Virginia Tech and does more than what I need for the BSD script but it might help you help me so here it is:

;
; A script for logging in to VT HSMP
;
proc main

    ; variable declarations
    ; change "default" to IP address for static PPP
    string  myIP = "default"
    integer maxretries = 5
    integer retries    = 0

   ;=========================================
    getCBXprompt:
   ;=========================================
        set screen keyboard off
        retries = retries + 1
        transmit "<cr>"
        delay 1
        transmit "<cr>"
        delay 1
        transmit "<cr>"
        delay 1
        transmit "<cr>"
        delay 1
        transmit "<cr>"
        waitfor
            " MODIFY?" then doCall
        until 2
        if ( retries <= maxretries) then
            goto getCBXprompt
        endif
        transmit "No CBX prompt."
        halt

   ;=========================================
    doCall:
   ;=========================================
        retries = 0
        transmit "c vttelnet<cr>"
        waitfor
            "COMPLETE" then doTermServ,
            "ABORT"    then handleInQueue,
            "RETRY?"   then handleRetry

   ;=========================================
    doTermServ:
   ;=========================================
        transmit "<cr>"
        delay 1
        transmit "<cr>"
        delay 1
        transmit "<cr>"
        delay 1
        transmit "<cr>"
        delay 1
        transmit "<cr>"
        waitfor
            "sername:" then doLogin
        until 2
        goto doTermServ

   ;=========================================
    handleInQueue:
   ;=========================================
        waitfor "COMPLETE" then doTermServ

   ;=========================================
    handleRetry:
   ;=========================================
       if retries < maxretries then
            retries = retries + 1
            transmit "N<cr>"
            goto getCBXprompt
        endif
        transmit "Call failed."
        halt

   ;=========================================
    doLogin:
   ;=========================================
        delay 1
        transmit $USERID + "<cr>"
        waitfor "assword:"
        delay 1
        transmit $PASSWORD, raw
        transmit "<cr>"

        ; check for bad or expired password
        waitfor
            "denied"    then handleBadPass,
            "expiring"  then handleExpPass
        until 2
        goto startPPP

   ;=========================================
    handleBadPass:
   ;=========================================
        set screen keyboard on
        waitfor "assword"
        waitfor "<cr>"
        set screen keyboard off
        waitfor
            "expiring"   then handleExpPass,
            "denied"     then handleBadPass,
            "_TermServ>" then startPPP
        until 2

   ;=========================================
    handleExpPass:
   ;=========================================
        delay 1
        transmit "changepass" + "<cr>"
        waitfor "(PID)"
        delay 1
        transmit $USERID + "<cr>"
        waitfor "assword:"
        set screen keyboard on
        ;-----------------------
        ; uncomment the following
        ; block to have the script
        ; handle expired passwords
        ; automatically.
        ;-----------------------
        ;transmit $PASSWORD, raw
        ;transmit "<cr>"
        ;delay 1
        ;transmit $PASSWORD, raw
        ;transmit "<cr>"
        ;delay 1
        ;transmit $PASSWORD, raw
        ;transmit "<cr>"
        ;-----------------------
        waitfor "_TermServ>"
        set screen keyboard off
        transmit "login" + "<cr>"
        goto doTermServ
 

   ;=========================================
    startPPP:
   ;=========================================
       transmit "PPP " + myIP + "<cr>"

        if myIP == "default" then
            goto handleDefault
        endif

        if myIP != "default" then
            goto handleStatic
        endif

   ;=========================================
    handleDefault:
   ;=========================================
        waitfor
            "denied"      then cantDSLIP,
            "address is"  then queryIP
        until 3
 
        queryIP:
            set ipaddr getip
            goto breakOut

        cantDSLIP:
            transmit "+ Default SLIP access denied."
            halt

   ;=========================================
    handleStatic:
   ;=========================================
        waitfor "assword"
        transmit $PASSWORD, raw
        transmit "<cr>"

        waitfor
            "denied"        then noSTATIC,
            "your system."  then breakOut
        until 3
 
        noSTATIC:
            transmit "+ Static SLIP access denied."
            halt

breakOut:
endproc

Thank you for any help you may be able to provide.

Gordon Shankman
Computer Science Major
Virginia Tech --------------C183C6E7324F9FB42492F24F-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message