Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Google   


Teraterm

News Telnet protocol Recommended Links Expect Free SSH Windows clients
HyperTerm Exceed HostExplorer SSH Serial Console on Solaris sshfs
Password-less SSH login     Humor Etc

Currently Teraterm is probably the best client for Windows environment. It  one of the few that understands middle mouse button and have some macro capabilities.  The product has non-intuitive configuration and there is no history of visited sites. but generally functionality is very good. 

The right site to download the latest version of  Teraterm is Japanese sourceforge site:  TeraTerm Open Source Project

Many older version are available on various sites. You should generally avoid them.  That includes "bastard" version called TeraTerm Pro Web (abandonware; version 3.1.3, October 8, 2002. ttpro313.zip ).

Please note that many users try to reinvent the bicycle in a form of yet another macro language for terminal emulation. Expect is a more universal and often more powerful way of doing the same that frees you from the dependency of somebody design mistakes and the luck of understanding of compiler/interpreter technology. You should learn to use it on Unix. The efforts instantly pay for itself. 

The teraterm.ini file contains all the configuration settings and parameters used by the application. You may modify the file directly in editor. or through the executable (teraterm.exe) by changing settings then saving the configuration via the Setup --> Save Setup... menu.

Modern versions of Teraterm keep the list recently visited hosts. That's a very convenient feature. 



Notes:
  • Those pages are written by people for whom English is not a native language. Some amount of grammar and spelling errors should be expected.
  • This is a Spartan WHYFF (We Help You For Free) site. It cannot replace the best teachers and the best books.
  • The site contain some obsolete pages as it develops like a living tree... Some links on older pages are broken. Please try to use Google, Open directory, etc. to find a replacement link (see HOWTO search the WEB for details). We would appreciate if you can mail us a correct link.

Search Amazon by keywords:

Google   
Open directory

Research Index

 

Old News ;-)

TeraTerm Support Forums View topic - First step to Tera Term Macros

linkstate
Newbie


Joined: 16 Mar 2007
Posts: 7

 
Posted: Fri Mar 16, 2007 5:34 pm    Post subject: First step to Tera Term Macros Reply with quote

First to all I want to congratulate this wonderful tool of trade 


I'm willing to take my first step into Tera Term Macros and I will probably won't make it on my own.

So here's the deal.

I want to be able to telnet to an access router in a companies HQ and then telnet into all the switches and do a "show tech" command in order to backup all the configs and informations about the switches into a text file.

All the switches are Cisco 2950.


Please help this poor man in need of your assistance.



With My best regards,
   
boris
Guru


Joined: 08 Jan 2005
Posts: 496
Location: Seattle, WA, USA

 
Posted: Fri Mar 16, 2007 6:34 pm    Post subject: Reply with quote

Depending on the number of switches different approaches can be taken. Can you say roughly how many switches you need to connect to?
_________________
Thanks.
Best regards,
// Boris
   
linkstate
Newbie


Joined: 16 Mar 2007
Posts: 7

 
Posted: Fri Mar 16, 2007 6:37 pm    Post subject: Reply with quote

boris wrote:
Depending on the number of switches different approaches can be taken. Can you say roughly how many switches you need to connect to?




About 600 Switches :s



Cheers,
   
boris
Guru


Joined: 08 Jan 2005
Posts: 496
Location: Seattle, WA, USA

 
Posted: Fri Mar 16, 2007 7:16 pm    Post subject: Reply with quote

TeraTerm macro can definitely help you but writing such script is not an easy task.
I'd suggest you to approach it in few steps.

Start with writing telnet connection macro script to establish connection to your access router in HQ. You can use connection template from LogMeTT or sample code from one of the topics in these forums.

Then develop your script further to establish the second connection.

Step 3 will be to get familiar with opening and closing log files from macro. Here you can also add your "show tech" command.

Once you get to this point your macro will be able to reach one of your Cisco-s collect printout and save it into local file.

Then comes the tricky part. You need to store IP addresses of all your 600 switches in plain text file and run your macro in the loop where every execution will be using one IP from your IP list. Similar issue was discussed not long ago on our forums; just do some search and reading here. 2 more files that will help you are macro.hlp and LogMeTT.chm. You will find them both in TeraTerm package. Finally do not forget to give different file names to each log file. You probably can build log name from IP address and current time stamp. Check code snippets in our forums for the example.
_________________
Thanks.
Best regards,
// Boris
   
linkstate
Newbie


Joined: 16 Mar 2007
Posts: 7

 
Posted: Fri Mar 16, 2007 8:24 pm    Post subject: Reply with quote

I'm feeling a bit fuzzy about this ....


My first piece of code turned out something like this:

connect 'ip address:23 /nossh' ----> that's my office
wait'Username:'
sendln'usernamexxx'
wait'Password:'
sendln'passwordxxx'
wait'hostname>'
sendln'telnet 172.23.128.11' ----> that's the HQ of the company
wait'Username:'
sendln'usernamexxx'
wait'Password:'
sendln'passwordxxx'

fileopen filehandle 'file.txt' 0

filereadln filehandle line

while result=0

sendln line

wait'Username:'
sendln'usernamexxx'
sendln'passwordxxx'
sendln 'show tech'
sendln'exit'


endwhile

exit


My problem is that the macro does read the first ip address of the text file but it doesn't continue with the other ones.



Regarding the issue of saving the logs with each hostname or ip address, that remains a complete phantom to me.


Hope that explained myself correctly to you.


My regards,
   
boris
Guru


Joined: 08 Jan 2005
Posts: 496
Location: Seattle, WA, USA

 
Posted: Sat Mar 17, 2007 6:22 am    Post subject: Reply with quote

Do you have word 'telnet' followed by IP address on each line of your file.txt?
_________________
Thanks.
Best regards,
// Boris
   
linkstate
Newbie


Joined: 16 Mar 2007
Posts: 7

 
Posted: Sat Mar 17, 2007 2:45 pm    Post subject: Reply with quote

No. Just the ip addresses. why ? is it supposed to ?
   
boris
Guru


Joined: 08 Jan 2005
Posts: 496
Location: Seattle, WA, USA

 
Posted: Sat Mar 17, 2007 5:03 pm    Post subject: Reply with quote

The same way as you do
Quote:
sendln'telnet 172.23.128.11'
earlier in your script, you need to pass method of connection and IP address in
Quote:
sendln line
Content of variable line is one string of your file.txt. If file does not contain words 'telnet' than you get as the result
 
Code:
sendln  172.23.x.y  ; <- whatever IP you have
which is the same as if you would type only IP address at command prompt without mentioning whether you need telnet, ssh, rlogin etc.

Instead of adding 600 words 'telnet' to your file, the better approach would be to concatenate word 'telnet' and IP taken from the file.

The code can look like this:
 
Code:
...

fileopen filehandle 'file.txt' 0

filereadln filehandle line

while result=0
connect_line='telnet ' ; <-- make sure you have trailing space
strconcat connect_line line
sendln connect_line

wait'Username:'
sendln'usernamexxx'
sendln'passwordxxx'
sendln 'show tech'
sendln'exit'


endwhile
...

_________________
Thanks.
Best regards,
// Boris
   
linkstate
Newbie


Joined: 16 Mar 2007
Posts: 7

 
Posted: Sun Mar 18, 2007 10:46 am    Post subject: Reply with quote

Okay.
I have something like this...
I'm testing with a .txt file with just two ip addresses for testing.
The thing is that he only telnets into the first ip address in that file and doesn't jump into the 2 ip address.
Could it be something with the while procedure ?


sendln line

while result=0
connect_line='telnet ' ;
strconcat connect_line line

wait'Username:'
sendln'XXXXX'
sendln'XXXX'
timeout = 4
sendln 'show tech'
sendln'exit'

endwhile




Thank you for your assistance
   
boris
Guru


Joined: 08 Jan 2005
Posts: 496
Location: Seattle, WA, USA

 
PostPosted: Sun Mar 18, 2007 11:11 am    Post subject: Reply with quote

Read description of strconcat function. Your connection string is in connect_line and not in line.
There are few other issues with your last code. Please post here your complete macro, otherwise it is unclear if there are scripting or copy/pasting errors.
_________________
Thanks.
Best regards,
// Boris
   
linkstate
Newbie


Joined: 16 Mar 2007
Posts: 7

 
PostPosted: Sun Mar 18, 2007 11:18 am    Post subject: Reply with quote

Let me see if I can explain this better to you.



Here's the whole code with comments





connect '213.xx.xx.xx:23 /nossh' ---> My first telnet to my company
wait'Username:'
sendln'xxxxxxx'
wait'Password:'
sendln'xxxxxxx'
wait'hostname>'
sendln'telnet 172.23.xx.xx' ---------> My telnet to the other company
wait'Username:'
sendln'xxxxx'
wait'Password:'
sendln'xxxxxxx'

-------------"So far So good here"--------------------


fileopen filehandle 'andre.txt' 0

filereadln filehandle line



sendln line

while result=0
connect_line='telnet ' ;
strconcat connect_line line

wait'Username:'
sendln'xxxxx'
wait'Password:'
sendln'xxxxx'
timeout = 4
sendln 'xxxxx'
sendln'exit'

endwhile





exit
   
boris
Guru


Joined: 08 Jan 2005
Posts: 496
Location: Seattle, WA, USA

 
PostPosted: Sun Mar 18, 2007 2:48 pm    Post subject: Reply with quote

Try this code

 
Code:
connect '213.xx.xx.xx:23 /nossh'
wait 'Username:'
sendln 'xxxxxxx'
wait 'Password:'
sendln 'xxxxxxx'
wait 'hostname>'
sendln 'telnet 172.23.xx.xx'
wait 'Username:'
sendln 'xxxxx'
wait 'Password:'
sendln 'xxxxxxx'

fileopen filehandle 'andre.txt' 0

while result=0
 connect_line='telnet '
 filereadln filehandle line
 strconcat connect_line line
 sendln connect_line
 wait 'Username:'
 sendln 'xxxxx'
 wait 'Password:'
 sendln 'xxxxx'
 timeout = 4        ; I'm not sure why do you need this line
 sendln 'xxxxx'     ; and this line
 sendln 'show tech'
 wait 'xxxxxxxxx'  ; <= whatever appears at the end of 'show tech'  printout
 sendln 'exit'
endwhile

fileclose filehandle

exit

_________________
Thanks.
Best regards,
// Boris
   
IshmaelCallMe
Coach


Joined: 25 Jan 2006
Posts: 119
Location: Denver, Colorado, USA

 
PostPosted: Mon Mar 19, 2007 6:53 am    Post subject: Reply with quote

You need to move your filereadln command to just before the while and a copy of it to just before the endwhile so that the result variable gets set correctly for both the first and subsequent loops.
   
boris
Guru


Joined: 08 Jan 2005
Posts: 496
Location: Seattle, WA, USA

 
PostPosted: Mon Mar 19, 2007 7:14 am    Post subject: Reply with quote

Thanks, I missed that Embarassed

 
Code:
connect '213.xx.xx.xx:23 /nossh'
wait 'Username:'
sendln 'xxxxxxx'
wait 'Password:'
sendln 'xxxxxxx'
wait 'hostname>'
sendln 'telnet 172.23.xx.xx'
wait 'Username:'
sendln 'xxxxx'
wait 'Password:'
sendln 'xxxxxxx'

fileopen filehandle 'andre.txt' 0
filereadln filehandle line

while result=0
 connect_line='telnet '
 strconcat connect_line line
 sendln connect_line
 wait 'Username:'
 sendln 'xxxxx'
 wait 'Password:'
 sendln 'xxxxx'
 timeout = 4        ; I'm not sure why do you need this line
 sendln 'xxxxx'     ; and this line
 sendln 'show tech'
 wait 'xxxxxxxxx'   ; <= whatever appears at the end of 'show tech'  printout
 sendln 'exit'
 filereadln filehandle line
endwhile

fileclose filehandle

exit

_________________
Thanks.
Best regards,
// Boris
   
IshmaelCallMe
Coach


Joined: 25 Jan 2006
Posts: 119
Location: Denver, Colorado, USA

 
PostPosted: Mon Mar 19, 2007 8:11 am    Post subject: Reply with quote

There ya go, that oughta work. Smile

One additional thing I would suggest to the original poster is to set the "timeout" variable BEFORE any wait or waitln statements (not in the middle of the loop, as it is now!) and then (ideally) check the "result" variable each time.

If the timeout variable is not set, I believe it defaults to 0, which means the script will wait forever at that point if the text does not show up.

SourceForge.jp Project File List

4.30 - [ Release Notes / Change Log ]
        teraterm_utf8_430.exe 2.3 MB 2028 2006-03-07 01:18 fffba4dcdb1b210d582a2efd0604a282
ttssh2
    2.20 - [ Release Notes / Change Log ]
        ttxssh2_220.zip 525.7 KB 653 2006-03-09 22:51 6c7a7064ecac0d04f2d80a1e28884f78
    2.19 - [ Release Notes / Change Log ]
        ttxssh2_219.zip 525.6 KB 551 2006-03-02 23:43 385117f67edd52b4a3079b309f765bb9
    2.18 - [ Release Notes / Change Log ]
        ttxssh2_218.zip 628.2 KB 4737 2005-11-05 03:50 7f7ad5838f17f5d97d3623c51f3cab60
    2.13 - [ Release Notes / Change Log ]
        ttxssh2_213.zip 546.3 KB 4226 2005-04-24 20:33 584108f9d8168692252f41b4a532a53e
   

Using telnet's command mode

When you use the Solaris telnet command to log in from one site to another, don't forget that you can enter telnet's command mode at any time during your session, usually by entering the following key sequence:

    [CTRL] ] (the control key and right-bracket key at the same time)

When this is successful, you'll see the following prompt:

    telnet>

Then, from the "telnet>" prompt, enter "?" to learn more about the available telnet commands. A few commands that will give you more help at the prompt are shown below:

    display        displays many current Telnet settings
    send ?        displays commands you can "send" to the remote site
    set ?             displays variables that can be set

One of my favorites (mostly when fooling around) is:

    send ayt

which means "send this message: are you there?".

TeraTerm 3.1.3 - Telnet, SSH2, SSL Client with built in Web Server

TeraTerm Pro Web is the next generation tool for connecting with remote Telnet and SSH hosts. It is built based on the extremely popular open-source TeraTerm product put out by T. Teranishi in 1999 (click here for original site). In keeping with the original philosophy and spirit of the author, our modified version is completely free!!

Downloads TeraTerm Pro Web works on Windows 95/98, 2000, XP. Here are the latest TeraTerm Pro Web releases:

Background
As big-time fans of the original, we realized that there were a host of missing features that could make it immensely more useful, namely:

ShellTelnet Rudenko software. Abandonware. Interesting but still pretty buggy...

ShellTelnet is a Windows telnet client intended for use with a Unix/Linux shell account.

In addition to the classic telnet functionality, ShellTellnet introduces a new way of browsing Unix hosts. ShellTelnet allows the user to browse files and folders on a remote machine using the Windows Explorer interface.

ShellTelnet includes a hidden FTP client. It makes possible to transfer files without a use of slow and archaic utilities like Kermit and zmodem.

To use ShellTelnet you need a local Windows machine and a remote machine running Unix or Linux. It is assumed that the default shell on the remote machine is BASH.

Dima Maloff's Telnet Project There is now a Win32 version

EasyTerm Home Page


 

Recommended Links


In case of broken links please try to use Google search. If you find the page please notify us about new location
Google     

Tera Term - Wikipedia, the free encyclopedia

TeraTerm Open Source Project

 

Etc

What has been added to TeraTerm 3.1?
We have added a variety of features. Two of the most predominant changes are:

(1) Adding the ability to connect to SSH2 based hosts. To connect to a SSH host, simply choose the SSH service radio button when connecting via the new connection dialog box.
(2) Adding a built in web server to allow a remote web browser or web application server (such as PHP, ColdFusion, WebSphere, ASP, etc) to send one or more commands to the telnet or SSH host that TeraTerm is currently connected to. The resulting text stream is captured and sent back to the calling web client where it can then be parsed and processed.

Here's how to make it work:

  1. Modify the result.htm template to your taste. The text "%result%" will be replaced with the captured text stream and the entire result template will be passed back to the calling web client
  2. Modify the error.htm template if desired. The text "%error%" will be replaced with and error message (if an error is encountered) and that template will be returned back to the calling web client.
  3. Go into the Web menu and choose "Accept HTTP Connections...". Make sure that the result and error templates point to the correct files.
  4. Select the desired IP address and port you want to listen on.
  5. Check the "Activate HTTP Listening" checkbox. Once you do this, TeraTerm will begin listening for incoming web requests.
The web client can pass commands in one of two ways:

Via HTTP GET

http://127.0.0.1:8080/get.htm?command1=xxx\n&termstring1=aaa|bbb|ccc&timeout1=5&command2=yyy\n&&termstring2=ddd|eee|fff&timeout2=10

In this web call, TeraTerm will send the command "xxx" (with a newline "\n") to the connected host. It will then wait and watch the host's text stream for one of the following termination strings, "aaa", "bbb", "ccc", OR 5 seconds to elapse (whichever comes first). (Please note that the delimiter for termstring's to watch for it the pipe character by default but can be changed in the configuration settings). Next, TeraTerm will pass the command "yyy" (with a newline) to the host and wait for termstrings "ddd", "eee", "fff", or 10 seconds to elapse (whichever comes first). It will then stop it's text stream capture and pass the entire captured block of text back to the calling web client. Please note that carriage returns will be escaped with a "\r", linefeeds with a "\n", tabs with a "\t" etc.

You may pass as many commands as you wish as long as an accompying termstring and timeout parameter is passed as well.

Via HTTP POST

You may issue the same parameters via an HTTP POST instead of a GET if desired. The following HTML code demonstrates an example of passing the same data as the GET example above:

<FORM NAME="myform" ACTION="http://127.0.0.1:8080/post.htm" METHOD="post">
<INPUT TYPE="hidden" NAME="command1" VALUE="xxx\n">
<INPUT TYPE="hidden" NAME="termstring1" VALUE="aaa|bbb|ccc">
<INPUT TYPE="hidden" NAME="timeout1" VALUE="5">
<INPUT TYPE="hidden" NAME="command2" VALUE="yyy\n">
<INPUT TYPE="hidden" NAME="termstring2" VALUE="ddd|eee|fff">
<INPUT TYPE="hidden" NAME="timeout2" VALUE="10">
<INPUT TYPE="submit" NAME="Submit" VALUE="Submit">
</FORM>
 

Obtaining the connection status of Tera Term

You may issue a status request to Tera Term to request the current connection status, which can optionally include the hostname and port it is connected to and the duration it has been connected. This is very useful since a web application may want to make sure Tera Term is connected before passing a GET or POST sequence of commands. Here is an example of how to call the status request:

http://127.0.0.1:8080/status.htm

You may modify the status template returned by specifying it in the configuration settings. Be sure that the variables %hostname%, %port% and %time% are included, as these will be replaced by the actual data when returned back to the calling HTTP client. If Tera Term is currently disconnected, the error template will be returned with the %error% variable set to "Not Connected"

Making Tera Term connect to a remote host

You, of course, can manually connect Tera Term to a remote Telnet or SSH host before issuing HTTP GET or POST command sequences to it. You can also have Tera Term connect to a remote host by calling a connect template, which is very useful for a web application to programmatic cause Tera Term to connect to a remote host. Example:

http://127.0.0.1:8080/connect.htm?hostname=www.foo.com&port=23

This will cause Tera Term to connect to the remote host. If unable to connect, the error template will be returned with the appropriate error message swapped with the %error% variable. Please note that at this time you are unable to use this template to connect to a SSH host. Connecting to a SSH host will still have to be done manually.

Making Tera Term disconnect from a remote host

You can cause Tera Term to disconnect from it's currently connected host by issuing a call to the disconnect template as follows:

http://127.0.0.1:8080/disconnect.htm

Please note that the ability to call this can be disabled in the configuration settings, if desired.

Authentication

Authentication can be set in the configuration file as required to prevent unauthorized passing of commands to a remote telnet host via Tera Term. Unfortunately, documentation regarding forms and methods of authenticating these requests will not be available until the full documentation set is released. Please check the Ayera website (http://www.ayera.com) frequently for an update.

Teraterm

TeraTerm 3.1.3 - Telnet, SSH2, SSL Client with built in Web Server

TeraTerm Pro Web is the next generation tool for connecting with remote Telnet and SSH hosts. It is built based on the extremely popular open-source TeraTerm product put out by T. Teranishi in 1999 (click here for original site). In keeping with the original philosophy and spirit of the author, our modified version is completely free!!

Downloads TeraTerm Pro Web works on Windows 95/98, 2000, XP. Here are the latest TeraTerm Pro Web releases:

Background
As big-time fans of the original, we realized that there were a host of missing features that could make it immensely more useful, namely:

TeraTerm -- old site

 


Copyright © 1996-2008 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: June 05, 2008