Playing Client to Server Programs with Telnet
A number of common high-level protocols involve exchange of ascii, not binary, information between the servers and clients that use the protocols. In such cases you can substitute a telnet session for the client program that would otherwise talk to the target server. Tell telnet to talk to the port used by the target server program. By convention, for 3 such protocols, those ports are:
HTTP 80
SMTP 25
POP3 110
You can simulate the activities of an http, smtp, or pop3 client this way. Examples are provided here. Use a telnet program. In Microsoft Windows operating systems such a program is built in. It can be run by issuing the appropriate telnet command from the command prompt in a DOS window, e.g.:
telnet <target machine's domain name or IP address> 80
(You may have to make sure "local echo" is selected in "preferences" in order to see what you type.) Another telnet client program for Windows which I prefer is TeraTerm, which you can freely download if interested.
Here are some related links that may be helpful:
an SMTP
tutorial
POP3 via
telnet
Trivial uses of
Telnet
Playing HTTP client (web browser)
Please see the write-up by Lars Garshol.
Playing SMTP (sending/outgoing) Mail Client
SMTP stands for simple mail transport protocol. SMTP server programs listen to port 25 on the server computers where they run. The messages that they and mail client programs exchange are in ascii; that is, SMTP is an ascii protocol. So you can conduct a session with a mail server using telnet, just as a mail client program would, by connecting to the remote port 25 and typing in the messages that would otherwise be emitted by the client program.
This works, of course, only if there actually is an SMTP server program running on the other machine. Most likely if the other machine is a known outgoing mail server there will be, and otherwise there won't. It also works only if you have an account and password on the other machine. If you are an internet email user, you can probably find out the identity (domain name or IP address) of your ISP's SMTP server. It does the work whenever you send mail. The ISP probably sent you that information when you signed up and instructed you to supply it to your mail clent program. It can probably be found by viewing the configuration information in that program.
Below is a recorded session in which I sent a message from one account of mine to another (I later successfully received it at the other account). The technique is described further in Hedrick.
Try to duplicate it. Send mail to yourself if you have a second account, or send it to your single account which can be both sender and receiver.[root@EMACH1 ppp]# telnet mail.pacbell.net 25
Trying 206.13.28.240...
Connected to mail.pacbell.net.
Escape character is '^]'.
220 mta6.snfc21.pbi.net -- Server ESMTP (Sun Internet Mail Server
sims.3.5.2000.01.05.12.18.p9)
HELO dmorgan1
250 mta6.snfc21.pbi.net OK, [206.170.218.25].
MAIL From:dmorgan1@pacbell.net
250 2.5.0 Address Ok.
RCPT To:dmorgan1@mailcity.com
250 2.1.5 dmorgan1@mailcity.com OK.
DATA
354 Enter mail, end with a single ".".
Hello. Hope you enjoy
this message. Bye.
.
250 2.5.0 Ok.
QUIT
221 2.3.0 Bye received. Goodbye.
Connection closed by foreign host.
[root@EMACH1 ppp]# exit
POP stands for post office protocol. POP3 server programs listen to port 110 on the server computers where they run. The messages that they and mail client programs exchange are in ascii; that is, POP3 is an ascii protocol. So you can conduct a session with a mail server using telnet, just as a mail client program would, by connecting to the remote port 110 and typing in the messages that would otherwise be emitted by the client program.
This works, of course, only if there actually is a POP3 server program running on the other machine. If the machine is a known incoming mail server there's a very good chance a POP3 program is running there. On the other hand, there are other incoming mail protocols that mail servers can use instead (IMAP on port 143 or 220). It also works only if you have an account and password on the other machine. If you are an internet email user, you can probably find out whether your ISP uses POP3 and if so the identity (domain name or IP address) their POP3 server. It does the work whenever you collect your mail. The ISP probably sent you that information when you signed up and instructed you to supply it to your mail clent program. It can probably be found by viewing the configuration information in that program.
Below is a recorded session in which I
checked my mail, found 2 messages waiting for me, and read one of them, a letter
from my mom. Try this
at your own ISP's server. Check your existing mail. Note that this will only
show held messages if there are any (and even if there are, you might not have a
letter from your mom). Accounts at the server can be set to hold messages, or to
delete them from the server automatically at the time they are retrieved by the
account holder. In such cases you will only see messages received by the server
but not yet retrieved by you. (Also in such cases, if you retrieve the message
by this tutorial technique, that will cause the server to delete it. If it is
important and it scrolls off the screen before you have a chance to read it, it
won't be there any longer for you to reread it later. In that case you could
read all mail by your normal means and thus capture copies of it to your local
machine. Then send yourself a message so that there will be something-- that is
not important-- for your to retrieve by the telnet technique.)
[root@EMACH1 /root]# telnet
postoffice.pacbell.net 110
Trying 206.13.28.122...
Connected to pacbell.net.
Escape character is '^]'.
+OK POP-3 mta1.snfc21.pbi.net - Sun Internet Mail Server -
sims.3.5.2000.01.05.12.18.p9 at Sun, 29 Oct 2000 11:21:38 -0800 (PST)
USER dmorgan1
+OK User name accepted, password please
PASS <password goes here>
+OK Mailbox open, 2 messages
LIST
+OK Mailbox scan listing follows
1 1349
2 1580
.
RETR 2
+OK 1580 octets
Return-path: <joanmestjian@hotmail.com>
Received: from mta2.snfc21.pbi.net (mta2-pr.snfc21.pbi.net)
by sims2.snfc21.pbi.net
(Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id
<0G3700ISIHHYOU@sims2.snfc21.pbi.net> for dmorgan1@sims-ms-daemon; Sun,
29 Oct 2000 11:15:44 -0800 (PST)
Received: from hotmail.com ([64.4.15.77])
by mta2.snfc21.pbi.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9)
with ESMTP id <0G37006YVHAJI8@mta2.snfc21.pbi.net> for
dmorgan1@sims2.snfc21.pbi.net; Sun, 29 Oct 2000 11:11:07 -0800 (PST)
Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun,
29 Oct 2000 11:15:26 -0800
Received: from 206.170.218.25 by lw10fd.law10.hotmail.msn.com with HTTP; Sun,
29 Oct 2000 19:15:26 +0000 (GMT)
Date: Sun, 29 Oct 2000 11:15:26 -0800 (PST)
From: Joan Morgan <joanmestjian@hotmail.com>
Subject: A message from mom
To: dmorgan1@pacbell.net
Message-id: <F77r8cU6xfPTeip68V800004016@hotmail.com>
MIME-version: 1.0
Content-type: text/plain; format=flowed
X-Originating-IP: [206.170.218.25]
X-OriginalArrivalTime: 29 Oct 2000 19:15:26.0428 (UTC)
FILETIME=[97F329C0:01C041DC]
Hello Dave,
Don't forget to brush your teeth. Just because you're grown up now doesn't
mean you don't have to brush them three times a day!
Love,
Mom
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
.
DELE 2
+OK Message deleted
LIST
+OK Mailbox scan listing follows
1 1349
.
QUIT
+OK BYE
Connection closed by foreign host.
[root@EMACH1 /root]# exit