source: release-kits/lirk3/bin/ant-installer/web/manual/manual/OptionalTasks/telnet.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 5.4 KB
Line 
1<!--
2 Licensed to the Apache Software Foundation (ASF) under one or more
3 contributor license agreements. See the NOTICE file distributed with
4 this work for additional information regarding copyright ownership.
5 The ASF licenses this file to You under the Apache License, Version 2.0
6 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<html>
18
19<head>
20<meta http-equiv="Content-Language" content="en-us">
21<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
22<title>Telnet Task</title>
23</head>
24
25<body>
26
27<h2><a name="telnet">Telnet</a></h2>
28<h3>Description</h3>
29Task to automate a remote telnet session. The task uses
30nested <tt>&lt;read&gt;</tt> to indicate strings to wait for, and
31<tt>&lt;write&gt;</tt> tags to specify text to send.
32
33<p>If you do specify a userid and password, the system will
34assume a common unix prompt to wait on. This behavior can be easily over-ridden.</p>
35<p><b>Note:</b> This task depends on external libraries not included in the Ant distribution.
36See <a href="../install.html#librarydependencies">Library Dependencies</a> for more information.</p>
37
38<h3>Parameters</h3>
39<table border="1" cellpadding="2" cellspacing="0">
40 <tr>
41 <td><b>Attribute</b></td>
42 <td><b>Values</b></td>
43 <td><b>Required</b></td>
44 </tr>
45 <tr>
46 <td>userid</td>
47 <td>the login id to use on the telnet server.</td>
48 <td>Only if password is specified</td>
49 </tr>
50 <tr>
51 <td>password</td>
52 <td>the login password to use on the telnet server.</td>
53 <td>Only if userid is specified</td>
54 </tr>
55 <tr>
56 <td>server</td>
57 <td>the address of the remote telnet server.</td>
58 <td>Yes</td>
59 </tr>
60 <tr>
61 <td>port</td>
62 <td>the port number of the remote telnet server. Defaults to port 23.</td>
63 <td>No</td>
64 </tr>
65 <tr>
66 <td>initialCR</td>
67 <td>send a cr after connecting (&quot;yes&quot;). Defaults to &quot;no&quot;.</td>
68 <td>No</td>
69 </tr>
70 <tr>
71 <td>timeout</td>
72 <td>set a default timeout to wait for a response. Specified in seconds. Default is no timeout.</td>
73 <td>No</td>
74 </tr>
75</table>
76<h3><a name="nested">Nested Elements</a></h3>
77The commands to send to the server, and responses to wait for, are
78described as nested elements.
79
80<h4>read</h4>
81
82<p>declare (as a text child of this element) a string to wait for.
83The element supports the timeout attribute, which overrides any
84timeout specified for the task as a whole. It also has a <tt>string</tt>
85attribute, which is an alternative to specifying the string as
86a text element.
87</p>
88<i>Always declare an opening and closing
89<code>&lt;read&gt;</code> element to ensure that statements are not sent before
90the connection is ready, and that the connection is not broken before
91the final command has completed.
92</i>
93<h4>write</h4>
94
95<p>describes the text to send to the server. The <tt>echo</tt> boolean
96attribute controls whether the string is echoed to the local log;
97this is "true" by default
98</p>
99<h3>Examples</h3>
100A simple example of connecting to a server and running a command. This assumes
101 a prompt of &quot;ogin:&quot; for the userid, and a prompt of &quot;assword:&quot;
102 for the password.
103
104<blockquote><pre>
105&lt;telnet userid=&quot;bob&quot; password=&quot;badpass&quot; server=&quot;localhost&quot;&gt;
106 &lt;read&gt;/home/bob&lt;/read&gt;
107 &lt;write&gt;ls&lt;/write&gt;
108 &lt;read string=&quot;/home/bob&quot;/&gt;
109&lt;/telnet&gt;
110</pre></blockquote>
111
112This task can be rewritten as:
113<blockquote><pre>
114&lt;telnet server=&quot;localhost&quot;&gt;
115 &lt;read&gt;ogin:&lt;/read&gt;
116 &lt;write&gt;bob&lt;/write&gt;
117 &lt;read&gt;assword:&lt;/read&gt;
118 &lt;write&gt;badpass&lt;/write&gt;
119 &lt;read&gt;/home/bob&lt;/read&gt;
120 &lt;write&gt;ls&lt;/write&gt;
121 &lt;read&gt;/home/bob&lt;/read&gt;
122&lt;/telnet&gt;
123</pre></blockquote>
124
125A timeout can be specified at the <code>&lt;telnet&gt;</code> level or at the <code>&lt;read&gt;</code> level.
126This will connect, issue a sleep command that is suppressed from displaying and wait
12710 seconds before quitting.
128<blockquote><pre>
129&lt;telnet userid=&quot;bob&quot; password=&quot;badpass&quot; server=&quot;localhost&quot; timeout=&quot;20&quot;&gt;
130 &lt;read&gt;/home/bob&lt;/read&gt;
131 &lt;write echo=&quot;false&quot;&gt;sleep 15&lt;/write&gt;
132 &lt;read timeout=&quot;10&quot;&gt;/home/bob&lt;/read&gt;
133&lt;/telnet&gt;
134</pre></blockquote>
135
136The task can be used with other ports as well:
137<blockquote><pre>
138&lt;telnet port=&quot;80&quot; server=&quot;localhost&quot; timeout=&quot;20&quot;&gt;
139 &lt;read/&gt;
140 &lt;write&gt;GET / http/0.9&lt;/write&gt;
141 &lt;write/&gt;
142 &lt;read timeout=&quot;10&quot;&gt;&amp;lt;/HTML&amp;gt;&lt;/read&gt;
143&lt;/telnet&gt;
144</pre></blockquote>
145<p>
146To use this task against the WinNT telnet service, you need to configure the service to use
147classic authentication rather than NTLM negotiated authentication.
148This can be done in the Telnet Server Admin app:
149select "display/change registry settings", then "NTLM", then set the value of NTLM to 1.
150</p>
151
152
153</body>
154</html>
155
Note: See TracBrowser for help on using the repository browser.