MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
November
Sun Mon Tue Wed Thu Fri Sat
         
23
24 25 26 27 28 29 30
2024
Months
NovDec


Sat, Dec 19, 2015 11:25 pm

Installing a Telnet client from Microsoft on Windows systems

If you need a telnet client on a Microsoft Windows system, e.g., a Windows Vista, 7, 8, Server 2008 R2, Windows Server 2008 system, etc., you can install PuTTY, which is probably the most popular telnet client for Microsoft Windows systems, created by Simon Tatham, or you can install one provided by Microsoft from a command line interface (CLI), i.e., a command prompt, using the pkgmgr command as shown below:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Administrator>pkgmgr /iu:"TelnetClient"

C:\Users\Administrator>

After you enter the pkgmgr /iu:"TelnetClient" command, you won't see any indication that the software has been installed. The command prompt will be redisplayed and you may have to wait a couple of minutes afterwards for the installation to be completed depending on the speed of your system. If you see a User Account Control dialog box displayed when you enter the command, provide a userid and password for an administrator account and confirm that you want to allow the action it displays.

After you've installed the telnet client application, you can type telnet at a command prompt to start the client, which will take you to the telnet client prompt:

Welcome to Microsoft Telnet Client

Escape Character is 'CTRL+]'

Microsoft Telnet>

The telnet client program, telnet.exe is installed in \windows\system32.

C:\Windows>dir /s telnet.exe
 Volume in drive C has no label.
 Volume Serial Number is 9420-A68C

 Directory of C:\Windows\System32

07/13/2009  08:39 PM            79,872 telnet.exe
               1 File(s)         79,872 bytes

 Directory of C:\Windows\winsxs\amd64_microsoft-windows-telnet-client_31bf3856ad
364e35_6.1.7600.16385_none_1426830c3ebb712d

07/13/2009  08:39 PM            79,872 telnet.exe
               1 File(s)         79,872 bytes

     Total Files Listed:
               2 File(s)        159,744 bytes
               0 Dir(s)  61,068,718,080 bytes free

[/network/telnet] permanent link

Mon, Dec 29, 2008 10:29 pm

Scripting Telnet Under Microsoft Windows

Telnet sessions can be automated using the Telnet Scripting Tool v.1.0 written by Albert Yale. I found the utility at How can I reboot my Alcatel SpeedTouch Pro by using a shortcut or a script?, where there is a sample of a text file that can be used to automate a telnet connection. The first line placed in the file contains the IP address of the telnet server followed by the port number to be used (23 is the default port for telnet connections). The subsequent lines contain the strings to wait for from the server, e.g. WAIT "User :" and to send as responses, e.g. SEND "\m". The \m is for a carriage return and linefeed.
Usage Syntax:

tst10.exe /r:script.txt [options]

/r:script.txt      run script.txt
[options]          any of these:

/o:output.txt      send session output to output.txt
/m                 run script in minimized window

Usage Example:

tst10.exe /r:script.txt /o:output.txt /m

Scripting Syntax:

HOSTNAME PORT      port number optional, default: 23
WAIT "string"      string to wait for
SEND "string"      string to send
\"                 represents the a quote character
\m                 represents a <CR/LF>
\\                 represents the backslash character

Scripting Example:

hostname.com 23
WAIT "login"
SEND "root\m"
WAIT "password"
SEND "mypassword\m"
WAIT ">"
SEND "dip internet.dip\m"
WAIT ">"

Scripting Note:

You can start with either WAIT or SEND commands,
but you *must* alternate them. ie: you can't use two
or more WAIT or SEND in a row.

Note:

TST will disconnect and close as soon
as its done with the last entry of the script.

If you need to, you can type in the terminal
window while the script is running.

You can use the tool to automate not just sessions where you log into another system via the telnet protocol, but other types of connections where you might use the telnet command.

E.g., I often telnet to the Simple Mail Transfer Protocol (SMTP) port, which is port 25 on mail servers, to troubleshoot connections. The Telnet Scripting Tool (TST) can be used to automate this type of testing as well.

For instance, I created a file, testSMTP.txt, to use with the Telnet Scripting Tool in timing how long it was taking a mail server to display its banner. The banner from mail server software, such as sendmail, usually begins with the code 220, e.g. 220 mail.example.com ESMTP Sendmail 8.13.8/8.13.8; Mon, 29 Dec 2008 21:39:48 -0500. So, I placed the following commands in a file to connect to a mail sever at address 192.168.0.5

192.168.0.5 25
WAIT "220"
SEND "quit\m"

The first line specifies the IP address of the server followed by the port number to use, in this case port 25 for an SMTP connection. The WAIT "220" tells the Telnet Scripting Tool to wait for the string 220 from the server and then to send the quit command followed by a carriage return and line feed, e.g. the characters that would be sent if I typed "quit" and hit the Enter key

I then opened a command prompt on a Windows XP system and entered the command below:

C:\DOCUME~1\JSmith\MYDOCU~1\>"\program files\network\tst10\tst10.exe" /r:testSMTP.txt

In this case the file testSMTP.txt was in the current directory, but the tst10.exe program was in \program files\network\tst10\tst10.exe

Note: before using the program,I uploaded the executable, TST10.exe, to VirusTotal, a service that scans files with many different antivirus programs. It checked the file with 38 antivirus programs. None of them found any malware within the file (see MD5: 4aee641e6ddb9a5fa95f590273729708). Note: the viradd and virsize in the Portable Executable (PE) information stand for "Virtual Address" and "Virtual Size" respectively (see Strange tcpip header?).

Download Locations for TST10.Zip

Petri IT Knowledgebase
MoonPoint Support
TheWorldsEnd.NET - free PHP networking scripts

References:

  1. How can I reboot my Alcatel SpeedTouch Pro by using a shortcut or a script?
    By: Daniel Petri
    Petri IT Knowledgebase
  2. Telnet Scripting for the DSL-G604T
    D-Link DSL-G604T Wireless ADSL Router Support Forum

[/network/telnet] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo