Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Teraterm

News Telnet Clients Recommended Links Teraterm Macros Reference for macrolanguage Invoking Teraterm from command line Highlights of enhancements in latest versions
CygTerm+ SSH  Password-less SSH login Using Pageant for authentication TTSSH How to use TeraTerm for the Serial Console Teraterm log and replay function
GNU Screen Putty Telnet protocol Mcedit -- Midnight Commander’s Editor   LogMeTT TTPMenu
Expect   Tips Admin Horror Stories Unix History Humor Etc

Introduction

Currently Teraterm is probably the best free/open source Telnet/SSH client for Windows environment.  It supports both Telnet and SSH (limited scp functionality is also supported via File/send file and File/SSH SCP menu items). In addition to standard terminal emulator functionality (also present in Putty) Teraterm has macro language  which allows to automate login to most frequently used servers. Unfortunately few people understand this very important and productivity enhancing (especially for sysadmins) feature of Teraterm.

System administrator can greatly benefit from studying Teraterm macro language as well as adopting more advanced methods of work with this program. See Teraterm Tips. For example Teraterm can log the session. logging can be activated iether via menu or by invoking the program with the option /L (you can achieve that by creating a small wrapper script). See Teraterm log and replay function

For system administrators it make sense to create a set of small batch files that lauches Terterm with a given init file (which allow to specify you the color of the background) and connect macro.

For example:

cd C:\Utils\Teraterm
ttermpro.exe /F=LGREEN.INI /M=headnode.ttl

Using different color of the background heps to prevent a typical sysadmin blunder -- executing command(s) on the wrong server. See Sysadmin Horror Stories

History

Teraterm  known by the abbreviation `TT' was created in 1994 in Japan. The original author of the Teraterm was Takashi Teranishi.  Teraterm was released as freeware and won "Online software grand prize 97" competition held by Japanese tool portal Madonomori in 1997. Takashi Teranishi stopped developing Teraterm in 1998. The latest official version created by him was version 2.3.

In September 2004 group of Teraterm enthusiasts from Japan was able to contact Takashi Teranishi. They obtained the permissions to develop Teraterm further and to distribute it under BSD license. They launched the project at SourceForge.jp and released series of versions starting from 4.00.  Support forum was established in early 2005. It is the place where TeraTerm users can ask their questions, exchange ideas, share their experience working with the application, post new feature suggestions or report the bugs.  The current version of Teraterm is 4.83 (as of June 2013).

How to download right Teraterm version

The only right site to download the latest version of  Teraterm is Japanese SourceForge siteTeraterm Open Source Project. You can also use LogmeTT site (logmett.com) but I doubt that installing logmett makes sense.  The site might be probably is more convenient for the USA users.

During installation you should generally avoid selecting Connect component (which provides tabs) as it does not work well. LogmeTT itself is also mixed blessing and use a different license. Therefore you might wish to avoid installing it too. See additional information at my page LogMeTT

Many older and obsolete versions are still available on various sites and are displayed prominently by Google. The first site in Google search "teraterm" points to abandonware (3.1.3 called Teraterm Pro Web  from Ayera) and should be ignored

!

  • The current version of Teraterm is 4.82 or higher and should be  downloaded only from  SourceForge.JP
  • Please avoid downloading software package from the original site Tera Term Home Page  (http://hp.vector.co.jp/authors/VA002416/teraterm.html)
  • Please avoid downloading  version 3.1.3 called Teraterm Pro Web  from Ayera Technologies  (http://www.ayera.com/teraterm/).  This package ( ttpro313.zip) is an abandonware created October 8, 2002 and never updated since then....

Capabilities

The product has non-intuitive configuration, but  functionality is very good.  It provides history of visited sites out of the box and has ability to change the size of screen on the fly.  By loading different configuration files (TERATERM.INI by default) you can easily adapt to non standard colors which new servers often present to sysadmins.  It can write history of your actions to the file. And of couse macro language is an important productivity enhancement tool. It can be combined with programmable keyboard to perform various, pretty complex operation of the server with one keystroke. 

Among the features we can list the following:

Invoking Teraterm from command line

See Tera Term command line for full list of options. For our purposes only three options are important /F, /M and /R:

TTERMPRO [ <host> /F=<setup file>] [/M=<macro file>] [/P=<TCP port#>] [/R=<replay file>] [/T=<telnet flag>]

Option /F  is the most important option and it gives you ability to specify the setup file. By encoding option /F in simple batch file you can invoke Teraterm with different setup file which for example have different userid for connection, different color settings, set of servers to connect to etc. You can create several icons each of which load different ini file. .

By encoding option /F in simple batch file you can invoke Teraterm with different setup file which for example have different Userid for connection, different color settings, set of servers to connect to etc. You can create several icons each of which load different ini file. .

For example, we can create a script ttroot.bat  that contains just two lines:
cd "C:\Programe files\teraterm"
ttermpro.exe /F=root.ini
This script invoke Teraterm with the configuration file root.ini  that provides login as root account and, possibly, some other settings like, say, the location of appropriate SSH private key.

Full list of options

There are multiple addtional opns that you can specify along or instead of options  /F=<setup file>, /M=<macro file>  and /P=<TCP port#>.

<host>
Host name or IP address.
<host>:<TCP port#>
<host> with a TCP port number.
":" is placed between <host> and <TCP port#>.
<host> <TCP port#>
<host> with a TCP port number.
Space character(s) between <host> and <TCP port#>.
Number just after <host> is interpreted as a port number.
telnet://<host>[:<TCP port#>][/]
URL style - for telnet handler
TCP port number and "/" at the end are optional.
If TCP port number is omitted, use 23. (TCPPort setting in setup file is ignored.)
/B
Telnet binary option.
/BAUD=<baud rate>
baud rate of serial port. If the baud rate not supported by Tera Term is specified, this option is ignored.
/C=<serial port#>
Serial port
/DS
Disable displaying the "New connection" dialog on startup
/E
Disable TCPLocalEcho and TCPCRSend option
/F=<setup file>
Setup file
/F=TERATERM.INI (default)
If this value is not a full path, it is understood as a relative path from ttermpro.exe.
/FD=<file transfer directory>
File transfer directory
/H
Hide title bar.
/I
Start Tera Term in iconized state.
/K=<keyboard setup file>
Keyboard setup file
/K=KEYBOARD.CNF (default)
If this value is not a full path, it is understood as a relative path from ttermpro.exe.
/L=<log file>
Start Tera Term with logging.
/LA=<language>
Language mode.
/M=<macro file>
Start Tera Term with macro.
If this value is not a full path, it is understood as a relative path from ttermpro.exe.
/P=<TCP port#>
TCP port number
/R=<replay file>
Replay file
/T=<telnet flag>
/TEKICON=<icon name>
TEK window icon. Could be specify the same value of TEKIcon of setup file.
/TIMEOUT=<connecting timeout value>
Could be specified per seconds.
/V
Start Tera Term in hidden (invisible) state.
/VTICON=<icon name>
VT window icon. Could be specify the same value of VTIcon of setup file.
/W="<window title>"
Window title
A user should put the window title in double quotes by using " (double quote) character two times to include the character.
/X=<window position (x)>
Windows position (horizontal)
/Y=<window position (y)>
Windows position (vertical)
;<comment>
Comment. Should be last in the command line.

Examples of invocation from the command line

TTERMPRO host1.mydomain.com /F=ROOT.INI # Use root user for login
TTERMPRO host2.mydomain.com /F=ROOT.INI /L=F:\Teraterm\rootlog.txt # use logging
TTERMPRO host5.mydomain.com /R=add_ntp_config.tt ; replay a file
TTERMPRO host5.mydomain.com /M=transfere_dot_files ; replay a file
TTERMPRO myhost.mydomain:23
TTERMPRO myhost.mydomain 23
TTERMPRO 111.111.11.11
TTERMPRO myhost.mydomain /T=0 /P=7
TTERMPRO /C=1
TTERMPRO /F=TELNET.INI
TTERMPRO /C=2 /BAUD=9600 /F=MYSETUP.INI
TTERMPRO /K=MYKEY.CNF /W="My host"
TTERMPRO myhost /B /X=100 /Y=50

Default values

Following default values are stored in the Teraterm setup file:

<TCP port#>
/B
<baud rate>
<serial port#>
<file transfer directory>
/H
<kanji code (receive)>
<kanji code (transmit)>
<language>
<macro file>
<telnet flag>
<icon name>
<window title>
<window pos (x)>
<window pos (y)>

What's really important is the teraterm has macro capabilities that enable automatic login to any conceivable  Unix or linux or Cisco boxes (both SSH and telnet logins). Teraterm macro language is documented at MACRO Help Index

Teraterm also can be used as Cygwin terminal (in addition to the entry in the File menu it has a shortcut Alt-G). It is a much better command window then windows CMD and is highly recommended for all Cygwin users

Highlights of enhancements in latest versions

As with most open source product documentation is outdated. For example full capabilities of macro language can be deciphered only by reading NEWS announcements. Here we collected them for your convenience.

Generally you should use version 4.77 or later as there were important additions to macro language in recent versions (starting from 4.52):

2006.2.10 (Ver 4.27)

2006.10.09 (Ver 4.46)

2007.8.8 (Ver 4.53)

2007.9.30 (Ver 4.54)

New:

Priority Operator
1 not ~ ! +(unary) -(unary)
2 * / %
3 + -
4 >> << >>>
5 and &
6 xor ^
7 or |
8 < > <= >=
9 = == <> !=
10 &&
11 ||

Old:

Priority Operator
1 not ~ ! +(unary) -(unary)
2 * / %
2 and &
3 + -
3 or xor | ^
4 = <> < > <= >=
5 &&
6 ||

2007.12.4 (Ver 4.56)

2008.1.15 (Ver 4.57)

2008.6.25 (Ver 4.59)

2008.9.23 (Ver 4.60)

2009.3.22 (Ver 4.62)

2009.7.5 (Ver 4.63)

2009.11.10 (Ver 4.64)

2010.2.20 (Ver 4.65)

2010.5.31 (Ver 4.66)

2010.8.31 (Ver 4.67)

2011.3.5 (Ver 4.69)

2011.12.04 (Ver 4.72)

Sample Program in Teraterm macrolanguage

For more information see TeraTerm Macros

Here is funny a sample program:

; 1. Open Tera Term Pro (free VT100 emulator)
; 2. Control -> Macro
; 3. choose 99b.ttl
;
; it will run even if you close the app, to kill prematurely please open
; taskmanager and kill the ttpmacro.exe
;
; 99 Bottles of Beer macro for Tera Term
; by Lance Yamada

for i 99 1
j = i - 1
int2str istr i
int2str jstr j
        strconcat istr ' bottles of beer on the wall,'
strconcat jstr ' bottles of beer on the wall!'

if i = 1 then
messagebox '1 bottle of beer on the wall,' 'Tera Term'
messagebox 'time to get more beer!' 'Tera Term'
else
messagebox istr 'Tera Term'
messagebox 'take one down pass it around,' 'Tera Term'
messagebox jstr 'Tera Term'
endif
next

Several sample ttl file are included with Teraterm, but they usually need some minor tweaking before they work with real servers.  For example:

; sample macro of Tera Term
; 
; File: ssh2login.ttl
; Description: auto login with SSH2 protocol
; Environment: generic
; Update: 2004/12/4
; Author: Yutaka Hirata

username = 'nike'
hostname = '192.168.1.3'

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

msg = 'Enter password for user '
strconcat msg username
passwordbox msg 'Get password'

msg = hostname
strconcat msg ':22 /ssh /auth=password /user='
strconcat msg username
strconcat msg ' /passwd='
strconcat msg inputstr

Good source of inspiration can also be

Special utility LogMeTT written by Boris Maisuradze permits convenient storage of login macros for various servers greatly simplifying  the task of getting to the right server in minimum time and with minimum hassle (if macros contain passwords they probably should be protected via encrypted drive or similar method). It permits grouping server by location, by operating system, etc. It is highly recommended and really worth the effort of learning the interface.  Among notable features:

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. It 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.

Multiple setup file are possible, for example one for AIX, one for HP-UX, one for Solaris and one for Linux.

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


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

[Apr 12, 2020] logging - Change log file name of teraterm log - Stack Overflow

Apr 12, 2020 | stackoverflow.com

Change log file name of teraterm log Ask Question Asked 4 years, 8 months ago Active 10 months ago Viewed 5k times


pmverma ,

I would like to change the default log file name of teraterm terminal log. What I would like to do automatically create/append log in a file name like "loggedinhost-teraterm.log"

I found following ini setting for log file. It also uses strftime to format log filename.

    ; Default Log file name. You can specify strftime format to here.
    LogDefaultName=teraterm "%d %b %Y" .log
    ; Default path to save the log file.
    LogDefaultPath=
    ; Auto start logging with default log file name.
    LogAutoStart=on

I have modified it to include date.

Is there any way to prefix hostname in logfile name

Fox eg,

myserver01-teraterm.log
myserver02-teraterm.logfile
myserver03-teraterm.log

Romme ,

I had the same issue, and was able to solve my problem by adding &h like below;

; Default Log file name. You can specify strftime format to here. LogDefaultName=teraterm &h %d %b %y.log ; Default path to save the log file. LogDefaultPath=C:\Users\Logs ; Auto start logging with default log file name. LogAutoStart=on

> ,

https://ttssh2.osdn.jp/manual/en/menu/setup-additional.html

"Log" tab

View log editor

Specify the editor that is used for display log file

Default log file name(strftime format)

Specify default log file name. It can include a format of strftime.

&h      Host name(or empty when not connecting)
&p      TCP port number(or empty when not connecting, not TCP connection)
&u      Logon user name
%a      Abbreviated weekday name
%A      Full weekday name
%b      Abbreviated month name
%B      Full month name
%c      Date and time representation appropriate for locale
%d      Day of month as decimal number (01 - 31)
%H      Hour in 24-hour format (00 - 23)
%I      Hour in 12-hour format (01 - 12)
%j      Day of year as decimal number (001 - 366)
%m      Month as decimal number (01 - 12)
%M      Minute as decimal number (00 -  59)
%p      Current locale's A.M./P.M. indicator for 12-hour clock
%S      Second as decimal number (00 - 59)
%U      Week of year as decimal number, with Sunday as first day of week (00 - 53)
%w      Weekday as decimal number (0 - 6; Sunday is 0)
%W      Week of year as decimal number, with Monday as first day of week (00 - 53)
%x      Date representation for current locale
%X      Time representation for current locale
%y      Year without century, as decimal number (00 - 99)
%Y      Year with century, as decimal number
%z, %Z  Either the time-zone name or time zone abbreviation, depending on registry settings;
    no characters if time zone is unknown
%%      Percent sign

example:

teraterm-&h-%Y%m%d_%H_%M_%S.log

[Nov 09, 2017] TERM strings by Tom Ryder

Jan 26, 2013 | sanctum.geek.nz

A certain piece of very misleading advice is often given online to users having problems with the way certain command-line applications are displaying in their terminals. This is to suggest that the user change the value of their TERM environment variable from within the shell, doing something like this:

$ TERM=xterm-256color

This misinformation sometimes extends to suggesting that users put the forced TERM change into their shell startup scripts. The reason this is such a bad idea is that it forces your shell to assume what your terminal is, and thereby disregards the initial terminal identity string sent by the emulator. This leads to a lot of confusion when one day you need to connect with a very different terminal emulator.

Accounting for differences

All terminal emulators are not created equal. Certainly, not all of them are xterm(1) , although many other terminal emulators do a decent but not comprehensive job of copying it. The value of the TERM environment variable is used by the system running the shell to determine what the terminal connecting to it can and cannot do, what control codes to send to the program to use those features, and how the shell should understand the input of certain key codes, such as the Home and End keys. These things in particular are common causes of frustration for new users who turn out to be using a forced TERM string.

Instead, focus on these two guidelines for setting TERM :

  1. Avoid setting TERM from within the shell, especially in your startup scripts like .bashrc or .bash_profile . If that ever seems like the answer, then you are probably asking the wrong question! The terminal identification string should always be sent by the terminal emulator you are using; if you do need to change it, then change it in the settings for the emulator.
  2. Always use an appropriate TERM string that accurately describes what your choice of terminal emulator can and cannot display. Don't make an rxvt(1) terminal identify itself as xterm ; don't make a linux console identify itself as vt100 ; and don't make an xterm(1) compiled without 256 color support refer to itself as xterm-256color .

In particular, note that sometimes for compatibility reasons, the default terminal identification used by an emulator is given as something generic like xterm , when in fact a more accurate or comprehensive terminal identity file is more than likely available for your particular choice of terminal emulator with a little searching.

An example that surprises a lot of people is the availability of the putty terminal identity file, when the application defaults to presenting itself as an imperfect xterm(1) emulator.

Configuring your emulator's string

Before you change your terminal string in its settings, check whether the default it uses is already the correct one, with one of these:

$ echo $TERM
$ tset -q

Most builds of rxvt(1) , for example, should already use the correct TERM string by default, such as rxvt-unicode-256color for builds with 256 colors and Unicode support.

Where to configure which TERM string your terminal uses will vary depending on the application. For xterm(1) , your .Xresources file should contain a definition like the below:

XTerm*termName: xterm-256color

For rxvt(1) , the syntax is similar:

URxvt*termName: rxvt-unicode-256color

Other GTK and Qt emulators sometimes include the setting somewhere in their preferences. Look for mentions of xterm , a common fallback default.

For Windows PuTTY, it's configurable under the "'Connections > Data"' section:

Setting the terminal string in PuTTY

More detail about configuring PuTTY for connecting to modern systems can be found in my article on configuring PuTTY .

Testing your TERM string

On GNU/Linux systems, an easy way to test the terminal capabilities (particularly effects like colors and reverse video) is using the msgcat(1) utility:

$ msgcat --color=test

This will output a large number of tests of various features to the terminal, so that you can check their appearance is what you expect.

Finding appropriate terminfo(5) definitions

On GNU/Linux systems, the capabilities and behavior of various terminal types is described using terminfo(5) files, usually installed as part of the ncurses package. These files are often installed in /lib/terminfo or /usr/share/terminfo , in subdirectories by first letter.

In order to use a particular TERM string, an appropriate file must exist in one of these directories. On Debian-derived systems, a large collection of terminal types can be installed to the system with the ncurses-term package.

For example, the following variants of the rxvt terminal emulator are all available:

$ cd /usr/share/terminfo/r
$ ls rxvt*
rxvt-16color  rxvt-256color  rxvt-88color  rxvt-color  rxvt-cygwin
rxvt-cygwin-native  rxvt+pcfkeys  rxvt-unicode-256color  rxvt-xpm
Private and custom terminfo(5) files

If you connect to a system that doesn't have a terminfo(5) definition to match the TERM definition for your particular terminal, you might get a message similar to this on login:

setterm: rxvt-unicode-256color: unknown terminal type
tput: unknown terminal "rxvt-unicode-256color"
$

If you're not able to install the appropriate terminal definition system-wide, one technique is to use a private .terminfo directory in your home directory containing the definitions you need:

$ cd ~/.terminfo
$ find
.
./x
./x/xterm-256color
./x/xterm
./r
./r/rxvt-256color
./r/rxvt-unicode-256color
./r/rxvt
./s
./s/screen
./s/screen-256color
./p
./p/putty-256color
./p/putty

You can copy this to your home directory on the servers you manage with a tool like scp :

$ scp -r .terminfo server:
TERM and multiplexers

Terminal multiplexers like screen(1) and tmux(1) are special cases, and they cause perhaps the most confusion to people when inaccurate TERM strings are used. The tmux FAQ even opens by saying that most of the display problems reported by people are due to incorrect TERM settings, and a good portion of the codebase in both multiplexers is dedicated to negotiating the differences between terminal capacities.

This is because they are "terminals within terminals", and provide their own functionality only within the bounds of what the outer terminal can do. In addition to this, they have their own type for terminals within them; both of them use screen and its variants, such as screen-256color .

It's therefore very important to check that both the outer and inner definitions for TERM are correct. In .screenrc it usually suffices to use a line like the following:

term screen

Or in .tmux.conf :

set-option -g default-terminal screen

If the outer terminals you use consistently have 256 color capabilities, you may choose to use the screen-256color variant instead.

If you follow all of these guidelines, your terminal experience will be much smoother, as your terminal and your system will understand each other that much better. You may find that this fixes a lot of struggles with interactive tools like vim(1) , for one thing, because if the application is able to divine things like the available color space directly from terminal information files, it saves you from having to include nasty hacks on the t_Co variable in your .vimrc . Posted in Terminal Tagged term strings , terminal types , terminfo

[Jun 1, 2016] Tera Term 4.95 released

2017.05.31 (Ver 4.95)

TTSSH 2017.05.31 (Ver 2.81)

[Jul 13, 2014] Latest version is available from SourceForge.jp download page. Current latest release is 4.83.

[Sep 21, 2010] Pseudo-graphic border in MC if you are using teraterm

That tip helps if you are using teraterm as emulator and want to run mc in it.
gnome.apps.mc.general

> Please, a small question - I made the new installation (FC3, KDE)
> and run MC (the great SW!!). Everything works, except that borders on
> the panels are drawn by 'a umlaut' instead of pseudo-graphic (lines)

This is a locale and termcap issue which I do not fully understand.
Fortunately I do know a workaround. :) Use this:
LANG C mc
to start mc.

[Mar 22, 2009] TeraTerm Support Forums • View topic - Tera Term 4.62 released

Hi everyone,

Tera Term 4.62 has just been released.

Here is the link to download page:

http://www.logmett.com/index.php?/Downl ... m-462.html

Additional information is available from the links below:

Here are the documents.

http://ttssh2.sourceforge.jp/manual/en/

http://ttssh2.sourceforge.jp/manual/en/macro/

The links below contain the list of added features and bugs fixed:

TeraTerm - http://logmett.com/forum/viewtopic.php?t=3

TTSSH - http://logmett.com/forum/viewtopic.php?t=29

LogMeTT - http://logmett.com/forum/viewtopic.php?t=45
_________________
Best regards,
NAGATA Shinya
http://ttssh2.sourceforge.jp/

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

[ Mar 16, 2007 ] 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

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:

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:

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:

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:

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:

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:

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:

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:

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

Posted: Sun Mar 18, 2007 11:11 am Post subject:

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

Posted: Sun Mar 18, 2007 11:18 am Post subject:

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

Posted: Sun Mar 18, 2007 2:48 pm Post subject:

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

Posted: Mon Mar 19, 2007 6:53 am Post subject:

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

Posted: Mon Mar 19, 2007 7:14 am Post subject:

Thanks, I missed that

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

Posted: Mon Mar 19, 2007 8:11 am Post subject:

There ya go, that oughta work.

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?".


Recommended Links

Google matched content

Softpanorama Recommended

Top articles

Sites

TeraTerm -- old site, historical value only

Random Findings

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

Please avoid this version

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:



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: April 12, 2020