TELNET

Communicate with another host using the TELNET protocol.

Syntax
      TELNET [-a] [-e escape_char] [-f log_file] [-l user] [-t term] [host [port]]

Key
   -a   Attempt automatic logon Same as -l except uses currently logged on user name
   -e   Escpae character to enter telnet client prompt.
   -f   Filename for client side logging.
   -l   The username to login with on the remote system.
        Requires that the remote system support the TELNET ENVIRON option.
   -t   The terminal type: vt100, vt52, ansi or vtnt.
  host  The hostname or IP address of the remote computer.
  port  A port number or service name.   

In Windows 7 and above the telnet client is not enabled by default.
To enable it open 'Programs and Features' | 'Turn Windows features on and off' and select Telnet Client.
or run
pkgmgr /iu:"TelnetClient"

In Windows 2008 and above the telnet server is not installed by default.
To enable it open Server Manager | Features | Add Features and select 'Telnet Server' and install.
or run Install-WindowsFeature or
ServerManagercmd -install telnet-client

Telnet commands

 close    Disconnect from an existing Telnet connection.
 display  Show the current settings for Telnet Client.
 open     Use open hostname to establish a Telnet connection to a host.
 quit     Disconnect from the remote server (if connected) and close the Telnet Client.
 send     Send commands to the Telnet server. 
 send ao  Abort output command.
 send ayt "Are you there?" command.
 send esc Sends the current escape character.
 send ip  Interrupt process command.
 send synch Perform a Telnet synch operation. 
 send brk   Send a break signal.
 set        Configure the Telnet Client for the current session:
 set bsasdel Backspace will be sent as delete
 set codeset option  Available only when the language is set to Japanese.
 set crlf  Set new-line mode; causes the RETURN key to send the combination of carriage
           return and line feed: 0x0D, 0x0A. When turned off, it sends only the carriage
           return character, 0x0D.
 set delasbs  Delete will be sent as backspace.
 set escape character
           Specifies the character that will switch from Telnet session mode to the
           Telnet command mode. From command mode, press ENTER to return to session mode.
 set localecho  Turn on local echo. All characters typed will be displayed on the local console.
               Remote Telnet servers usually send each character typed back, so setting this
               option could result in duplicate characters displayed for each one typed.
 set logfile name  The name of the Telnet log file for this session, also turns on logging.
                   The default path is your current directory.
 set logging  Turn on logging for this session.
 Set mode console
          Change the mode of operation to console mode (default).
          Setting the mode to console causes Telnet server to include ANSI or other escape
          commands to control cursor positioning within a fixed window of x rows and y columns.
 Set mode stream
          Change the mode of operation to stream mode.
          Setting the mode to stream turns off the ANSI or other escape commands that
          attempt to control cursor placement or clearing the screen.
          Stream mode is useful when you do not want the Telnet client to emulate a terminal.
          The output is sent as if there is no terminal window with x rows and y columns.
          Some applications that use Telnet for file transfer fail to work correctly when
          console mode is enabled.
 set ntlm Turn on NTLM authentication.
 set term {ansi | vt100 | vt52 | vtnt}  The type of terminal to emulate.
 status   Determines whether the computer running Telnet Client is connected.
 unset    Turns off an option previously set by using the set command.
 ?/help   Display Help.  ?/set Display Help information for the set command.

Anything other than one of the commands above will be sent as a string to the Telnet server.
For example, send ss64 sends the string ss64 to the Telnet server, which echoes the string in the Telnet session window.

Telnet communicates with the peer (telnet server) in clear text which is a potential security hazard for machines connected to the internet. Telnet traffic can be secured with Internet Protocol security (IPsec)

A alternative to telnet is SSH (which is cross platform) a popular choice on Windows is PuTTY: A Free Telnet/SSH Client.

Ports

20 & 21 File Transfer Protocol (FTP)
22 Secure Shell (SSH)
23 Telnet remote login service (the telnet client default)
25 Simple Mail Transfer Protocol (SMTP)
53 Domain Name System (DNS) service
80 Hypertext Transfer Protocol (HTTP) used in the World Wide Web
110 Post Office Protocol (POP3)
119 Network News Transfer Protocol (NNTP)
143 Internet Message Access Protocol (IMAP)
161 Simple Network Management Protocol (SNMP)
194 Internet Relay Chat (IRC)
443 HTTP Secure (HTTPS)
465 SMTP Secure (SMTPS)

Examples

Connect to the remote webserver for ss64.com through HTTP port number 80 and retrieve the home page, note the GET command is case sensitive:

C:\> telnet ss64.com 80
GET /index.html
<line feed>

Run a telnet script using the freeware Telnet scripting tool, in the scriptfile use \m for a carriage return/linefeed:
C:\utils\TST10.exe /r:MyTelnetScript.txt /o:output.txt

“Is this to be an empathy test? Capillary dilation of the so-called blush response? Fluctuation of the pupil. Involuntary dilation of the iris... Deckard: We call it Voight-Kampff for short” ~ BladeRunner script

Related:

Telnet Scripting Tool - by Albert Yale (Freeware).
TlntAdmn.exe - Telnet Server administraton tool (start, stop, configure).
Equivalent bash command (Linux): telnet - Communicate with another host using the TELNET protocol.
Equivalent PowerShell cmdlet: Enter-PSSession


 
Copyright © SS64.com 1999-2019
Some rights reserved