Date: Sun, 22 Mar 1998 02:01:32 -0500 From: Gordon Shankman <drummerboy@vt.edu> To: freebsd-questions@FreeBSD.ORG Subject: PPP Scripting Message-ID: <3514B74C.C75989D9@vt.edu>
next in thread | raw e-mail | index | archive | help
--------------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 <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 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <HTML> 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: <P>ppp.conf <P><TT>1. default:</TT> <BR><TT>2. set device /dev/cuaa0</TT> <BR><TT>3. set speed 19200</TT> <BR><TT>4. set log Phase Chat Connect Carrier hdlc LCP IPCP CCP tun</TT> <BR><TT>5. set dial "ABORT BUSY ABOURT NO\\sCARRIER TIMEOUT 5 \"\"</TT> <BR><TT> ATE1Q0 OK-AT-OK \\dATDT\\\T TIMEOUT 40 CONNECT</TT> <BR><TT>6.</TT> <BR><TT>7. vttelnet:</TT> <BR><TT>8. set dial ""</TT> <BR><TT>9. set line /dev/cuaa0</TT> <BR><TT>10. set speed 19200</TT> <BR><TT>11. set login "IFY?\r-\r-IFY?\r c MBER:\r vttelnet LETE</TT> <BR><TT> \r\r\r\r\r name:-\r-name: <I>username</I> ssword: <I>pword</I> Serv> ppp</TT> <BR><TT> stname: default"</TT> <BR><TT>12. set timeout 0</TT> <BR><TT>13. deny lqr</TT> <BR><TT>14. set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0</TT> <BR><TT>15. delete ALL</TT> <BR><TT>16. add 0 0 HISADDR</TT><TT></TT> <P>ppp.linkup <P><TT>1. vttelnet:</TT> <BR><TT>2. delete ALL</TT> <BR><TT>3. add 0 0 HISADDR</TT> <BR><TT>4. !bg sendmail -bg -q30m</TT><TT></TT> <P>I have not been able to test it to see if it works because when I run ppp with either the command line: <TT>ppp -auto vttelnet </TT>or by running ppp, then using <TT>dial vttelnet </TT>it goes to a dial prompt and says: <P>dialing attempt 1 of 1 <BR>dial...OK! <P>It then sits there with a blinking cursor. I manually connect using ppp, and then term. The script is designed to do the following: <P>Once term is executed, send <CR> until <BR><TT>CALL, DISPLAY, OR MODIFY?</TT> <BR>appears, then send a <BR><TT>c</TT> <BR>which brings up the prompt: <BR><TT>ENTER NUMBER:</TT> <BR>send <BR><TT>vttelnet</TT> <BR>and wait for <BR><TT>CALL COMPLETE</TT> <BR>send <BR><TT><CR><CR><CR><CR><CR></TT> <BR>which brings up <BR><TT>Username:</TT> <BR>send <BR><I><TT>username</TT></I> <BR>wait for <BR><TT>Password:</TT> <BR>send <BR><I><TT>pword</TT></I> <BR>wait for <BR><TT>VT_TermServ></TT> <BR>send <BR><TT>ppp</TT> <BR>wait for <BR><TT>IP address or hostname:</TT> <BR>send <BR><TT>default</TT> <P>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: <P><TT>;</TT> <BR><TT>; A script for logging in to VT HSMP</TT> <BR><TT>;</TT> <BR><TT>proc main</TT><TT></TT> <P><TT> ; variable declarations</TT> <BR><TT> ; change "default" to IP address for static PPP</TT> <BR><TT> string myIP = "default"</TT> <BR><TT> integer maxretries = 5</TT> <BR><TT> integer retries = 0</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> getCBXprompt:</TT> <BR><TT> ;=========================================</TT> <BR><TT> set screen keyboard off</TT> <BR><TT> retries = retries + 1</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> waitfor</TT> <BR><TT> " MODIFY?" then doCall</TT> <BR><TT> until 2</TT> <BR><TT> if ( retries <= maxretries) then</TT> <BR><TT> goto getCBXprompt</TT> <BR><TT> endif</TT> <BR><TT> transmit "No CBX prompt."</TT> <BR><TT> halt</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> doCall:</TT> <BR><TT> ;=========================================</TT> <BR><TT> retries = 0</TT> <BR><TT> transmit "c vttelnet<cr>"</TT> <BR><TT> waitfor</TT> <BR><TT> "COMPLETE" then doTermServ,</TT> <BR><TT> "ABORT" then handleInQueue,</TT> <BR><TT> "RETRY?" then handleRetry</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> doTermServ:</TT> <BR><TT> ;=========================================</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit "<cr>"</TT> <BR><TT> waitfor</TT> <BR><TT> "sername:" then doLogin</TT> <BR><TT> until 2</TT> <BR><TT> goto doTermServ</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> handleInQueue:</TT> <BR><TT> ;=========================================</TT> <BR><TT> waitfor "COMPLETE" then doTermServ</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> handleRetry:</TT> <BR><TT> ;=========================================</TT> <BR><TT> if retries < maxretries then</TT> <BR><TT> retries = retries + 1</TT> <BR><TT> transmit "N<cr>"</TT> <BR><TT> goto getCBXprompt</TT> <BR><TT> endif</TT> <BR><TT> transmit "Call failed."</TT> <BR><TT> halt</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> doLogin:</TT> <BR><TT> ;=========================================</TT> <BR><TT> delay 1</TT> <BR><TT> transmit $USERID + "<cr>"</TT> <BR><TT> waitfor "assword:"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit $PASSWORD, raw</TT> <BR><TT> transmit "<cr>"</TT><TT></TT> <P><TT> ; check for bad or expired password</TT> <BR><TT> waitfor</TT> <BR><TT> "denied" then handleBadPass,</TT> <BR><TT> "expiring" then handleExpPass</TT> <BR><TT> until 2</TT> <BR><TT> goto startPPP</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> handleBadPass:</TT> <BR><TT> ;=========================================</TT> <BR><TT> set screen keyboard on</TT> <BR><TT> waitfor "assword"</TT> <BR><TT> waitfor "<cr>"</TT> <BR><TT> set screen keyboard off</TT> <BR><TT> waitfor</TT> <BR><TT> "expiring" then handleExpPass,</TT> <BR><TT> "denied" then handleBadPass,</TT> <BR><TT> "_TermServ>" then startPPP</TT> <BR><TT> until 2</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> handleExpPass:</TT> <BR><TT> ;=========================================</TT> <BR><TT> delay 1</TT> <BR><TT> transmit "changepass" + "<cr>"</TT> <BR><TT> waitfor "(PID)"</TT> <BR><TT> delay 1</TT> <BR><TT> transmit $USERID + "<cr>"</TT> <BR><TT> waitfor "assword:"</TT> <BR><TT> set screen keyboard on</TT> <BR><TT> ;-----------------------</TT> <BR><TT> ; uncomment the following</TT> <BR><TT> ; block to have the script</TT> <BR><TT> ; handle expired passwords</TT> <BR><TT> ; automatically.</TT> <BR><TT> ;-----------------------</TT> <BR><TT> ;transmit $PASSWORD, raw</TT> <BR><TT> ;transmit "<cr>"</TT> <BR><TT> ;delay 1</TT> <BR><TT> ;transmit $PASSWORD, raw</TT> <BR><TT> ;transmit "<cr>"</TT> <BR><TT> ;delay 1</TT> <BR><TT> ;transmit $PASSWORD, raw</TT> <BR><TT> ;transmit "<cr>"</TT> <BR><TT> ;-----------------------</TT> <BR><TT> waitfor "_TermServ>"</TT> <BR><TT> set screen keyboard off</TT> <BR><TT> transmit "login" + "<cr>"</TT> <BR><TT> goto doTermServ</TT> <BR><TT> </TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> startPPP:</TT> <BR><TT> ;=========================================</TT> <BR><TT> transmit "PPP " + myIP + "<cr>"</TT><TT></TT> <P><TT> if myIP == "default" then</TT> <BR><TT> goto handleDefault</TT> <BR><TT> endif</TT><TT></TT> <P><TT> if myIP != "default" then</TT> <BR><TT> goto handleStatic</TT> <BR><TT> endif</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> handleDefault:</TT> <BR><TT> ;=========================================</TT> <BR><TT> waitfor</TT> <BR><TT> "denied" then cantDSLIP,</TT> <BR><TT> "address is" then queryIP</TT> <BR><TT> until 3</TT> <BR><TT> </TT> <BR><TT> queryIP:</TT> <BR><TT> set ipaddr getip</TT> <BR><TT> goto breakOut</TT><TT></TT> <P><TT> cantDSLIP:</TT> <BR><TT> transmit "+ Default SLIP access denied."</TT> <BR><TT> halt</TT><TT></TT> <P><TT> ;=========================================</TT> <BR><TT> handleStatic:</TT> <BR><TT> ;=========================================</TT> <BR><TT> waitfor "assword"</TT> <BR><TT> transmit $PASSWORD, raw</TT> <BR><TT> transmit "<cr>"</TT><TT></TT> <P><TT> waitfor</TT> <BR><TT> "denied" then noSTATIC,</TT> <BR><TT> "your system." then breakOut</TT> <BR><TT> until 3</TT> <BR><TT> </TT> <BR><TT> noSTATIC:</TT> <BR><TT> transmit "+ Static SLIP access denied."</TT> <BR><TT> halt</TT><TT></TT> <P><TT>breakOut:</TT> <BR><TT>endproc</TT> <P>Thank you for any help you may be able to provide. <P>Gordon Shankman <BR>Computer Science Major <BR>Virginia Tech</HTML> --------------C183C6E7324F9FB42492F24F-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3514B74C.C75989D9>