File: chat.tut

package info (click to toggle)
dunc 2.4
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 112 kB
  • ctags: 55
  • sloc: sh: 1,543; makefile: 46
file content (154 lines) | stat: -rw-r--r-- 6,726 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
          Dial Up Networking Client Configuration Utility

		Chat Tutorial Section

In this section you will configure the chat parameters.
Don't worry, we'll explain everything.  Chat is a program that
acts on your behalf once the connection to your ISP is made.
It does the actual interactive logon part.  However, like
(almost) everything else, there is no magic here.  Chat needs
to know what text the ISP will prompt you with, so it can
echo a response to the prompt at the proper time.  If you
don't know what the login prompts look like, don't worry.
We've provided some very common default prompts.  Chat can use
uucp style magic tokens too.  This IS magic!  The best way to
illustrate this is to walk through a login attempt.

If you were to dial into your ISP with a terminal emulator
such as minicom, or even cu, you might see something like this:

	CONNECT 9600

	Welcome to Jimmy Joe Jim Bob's Internet Service!

	This server has been up for 187 days!

	Enter username:

to which you respond with your username by typing:
my_ppp_username and then get prompted for a passwd:

	Enter Secret Key:

to which you would respond with your passwd:  my_ppp_passwd
You might also be prompted for additional information, or
you might even be expected to enter a command or series of
commands without getting prompted.  You may have to ask your
ISP for details if you don't know.  Or, if you have special
software you ISP provided you with, it surely has its own
"chat" information, probably in an .ini file somewhere if
its MS-Windows software.  If so, you could probably just read
the chat file they provide you with and get all of the needed
prompts and responses from it.  But for now, lets assume we
know the prompt strings and go through the same login as above,
but we'll configure chat to act on our behalf.

We need to tell chat what to expect before it will send
anything, so the first thing we tell chat to expect is nothing.
We do that by making our first entry on the first line of
the chat file an empty pair of quotes (it doesn't matter
what kind of quotes as long as they're the same and empty).
We'll use "".  Now we can tell chat to dial up your ISP.
We place this on the line with the "" separated by a space:
atdtm02225551122.  Please note there is no period.  In case you
don't know hayes "at" commands (niether do I really), the "at"
is just the modem command prefix.  The "dt" is for "dial tone"
as opposed to "dial pulse" which is dp.   The m0 tells the
modem that the volume should be 0, or no volume.  This makes
a quiet connection.  You can make this m1 or m2 if you like,
but we make it m0 by default because most people don't want
to hear all of those high pitched mechanical frequencies, etc.
The rest is just the area code and phone number.

Now we want chat to wait for the CONNECT string before we start
looking for other login prompt text, so we give this to chat:
CONNECT "".  This tells chat to look for CONNECT and send "",
or nothing.  This procedure is called an "expect send pair".
Using chat is as simple as giving it expect send pairs with
the right information.  Our chat file line now looks like this:

"" atdtm02225551122 CONNECT ""
^_________________^ ^________^
      /                 \
  expect send pair    expect send pair


We need to give an expect send pair for the login prompt, but
here we'll use one of those uucp magic tokens we mentioned.
If you remember, the login prompt was: "Enter username:", so
we'll tell chat to look for just the last piece of that, rname:.
The magic token is "--" without the quotes.  This tells chat
to look for the string "rname:" and if it doesn't get it,
send a carriage return and look again.  Some ISP's require
a carriage return prior to giving the login prompt.  So our
chat line now looks like:

"" atdtm02225551122 CONNECT "" rname:--rname:
                               ^^^^^ ^^ ^^^^^
                               |     |  |
                        prompt /   magic \ prompt
                         string    token    string

We tell chat to send our username: my_ppp_username, so we have:

"" atdtm02225551122 CONNECT "" rname:--rname: my_ppp_username
                               ^____________________________^
                                         /
                                    expect send pair

The next expect send pair we need to configure is the passwd
set.  The ISP here used this prompt:  Enter Secret Key:,
so we'll use the last part of that and our passwd which will
look like this:

"" atdtm02225551122 CONNECT "" rname:--rname: my_ppp_username \
Key: my_ppp_passwd

Please note the uppercase "Key:" as chat looks for whatever
text we tell it to, and the ISP sent a capital K.  Please also
note that I wrapped the chat line for readability and you don't
have to do that in reality.  In fact, the chat file we create
for you using this utility won't.

Now, for some, this is a complete chat file, but for others
we still need to invoke the remote connection daemon (start
the program we talk to on the ISP's computer).  This may be
as simple as an expect send pair like the following:

"" start_ppp

or may be entirely different.  Your ISP may present a menu
and prompt you for a choice.   In that case the expect send
pair will be the last part of the prompt followed by what you
would type in to respond to the prompt.

There, now we've finished configuring our chat file!  and it
now looks like this:

"" atdtm02225551122 CONNECT "" rname:--rname: my_ppp_username \
Key: my_ppp_passwd "" start_ppp

You should be ready to configure your chat file by providing the
expect send pairs we ask you for.  We'll ask for a connection
acknowledgement, such as CONNECT, which needs no send string.
Then we'll ask you for the login prompt expect string, and use your
username as the send pair.  Then you'll be asked for the passwd
prompt string (Key: in our example).  Because there is a security
issue with storing a human readable passwd in a text file, we dont'
reccommend doing it.  Use the StorePWD option in the Properties
menu to toggle this option.

After completing the passwd expect send pair configuration (really
just the expect side of these pairs), you'll be asked if you need
to add other expect send pairs to start the server side software.  
If so, you will have to add these on the input box line so they
appear as the pairs do above.  For example, the above expect send
pair would be entered together on the input box line as:
"" start_ppp

If you have special needs beyond this, you can edit the connect 
script we create prior to executing it to make additional
changes.  As with all input boxes, the defaults we provide can
be overwritten by backspacing and typing over them.

Good luck!