7

Is it true that everything you do on the web such as web browsing and reading email you can do with Telnet?

3
  • 1
    cough netcat cough
    – user59328
    Mar 6, 2011 at 16:31
  • I wish it wasn't mutilated in Fedora <_< Mar 6, 2011 at 18:21
  • @Alexei: FYI, there are at least five different implementations of netcat. On the other hand, socat is the same everywhere. Mar 7, 2011 at 11:10

3 Answers 3

8

Yes, although that would forfeit benefits of compression, and working with chunked GET response or Base64-encoded login/password in SMTP would be painful, so I wouldn't recommend actually using it except for testing purposes, use Perl or python if you want to do something on the web automatically.

Also, if you want to make requests that are indistinguishable from the ones a certain browser makes (having to do this is a sad reality when you're trying to work with sites protected by systems such as Bad Behavior), consider writing a mini-server that will output your request verbatim (there are such examples flying around, but they will probably need some slight modification). Then you will be able to use it as a template to make simple requests to such sites.

For example, try

telnet google.com 80

When the initializing is done, type

GET / HTTP/1.0

and press ENTER twice (as required by HTTP protocol). You will get 302 response that a browser would normally use to redirect you to WWW.google.com.

3
  • I didn't get a 302 response. It sent the page.
    – tony_sid
    Mar 6, 2011 at 8:55
  • 5
    There is a page in 302 response :) Mar 6, 2011 at 9:16
  • 3
    Also not 100% accurate. You're not requesting a page from google.com, you're requesting it from it's ip! This is in the HTTP spec, called host header. You have to do `telnet google.com 80 _ GET / HTTP/1.0 _ Host: google.com _ then it'll work. You have to tell the server you're trying to request "google.com" and not any other subdomain or domain from this server
    – sinni800
    Mar 8, 2011 at 7:21
7

Telnet can be used for (nearly) raw TCP connections, and you can use character-based protocols with it, but there are some differences:

Therefore, a Telnet client application may also be used to establish an interactive raw TCP session, and it is commonly believed that such session which does not use the IAC (\377 character, or 255 in decimal) is functionally identical. This is not the case, however, because there are other network virtual terminal (NVT) rules, such as the requirement for a bare carriage return character (CR, ASCII 13) to be followed by a NULL (ASCII 0) character, that distinguish the telnet protocol from raw TCP sessions.

Otherwise, you're able to use character-based application layer protocols such as HTTP, FTP, SMTP and IRC using Telnet. Cince it's quite a challenge to read and write compressed data manually, you're limited to HTTP without HTTP/1.1's compression. For protocols that are entirely binary, you're pretty much out of luck.

5
  • You can actually use HTTP 1.1 if you explicitly forbid compression in headers. Mar 6, 2011 at 8:35
  • Sorry, unless you explictly allow compression in headers. Mar 6, 2011 at 8:41
  • @Alexei Thanks for the hint, edited the post accordingly. Now it works either way.
    – Daniel Beck
    Mar 6, 2011 at 8:42
  • The telnet application does not use the telnet protocol when connecting to a non-telnet port. Therefore, the fact that the telnet protocol is not a raw TCP connection is irrelevant.
    – Teddy
    Mar 6, 2011 at 12:02
  • 3
    @Teddy: It depends on which application you consider "the". I have tested telnet from GNU "inetutils", Arch "telnet-bsd", Debian "krb5-clients", Debian "netkit-telnet-ssl", PuTTY-svn r9020, Windows XP "telnet.exe", Windows 98 "telnet.exe", Windows XP "HyperTerminal" and they all send CR/LF and respond to Telnet option negotiation irrespective of the TCP port used by server (in this test, tcp/9). The only difference is that only some of them (namely PuTTY) initiate the nego without waiting for the server to do it. Mar 6, 2011 at 14:53
1

Technically yes, you can do that. but pragmatically speaking the answer is no:

for example, i can get a webpage using

telnet www.page.com 80

but i will get the html text from it, not the,css, image and other resources.

Then, with the html file, you can get every other files with consecutive telnet calls. css is "trivial" to get, it is the same to get a file, also js and other "included" files. but binaries are not as easy because i must download it then process it, without counting that some resources required a specific cookie and a ref.

And the website may be is forcing for z-compression and many other "details" that are "detailed" in the specification of the protocol, protocol that is hardly patched and with several exceptions.

While is possible but it is the same to build an exist service/protocol from scratch so, it is the same to say "i can build Windows just "poking" zeroes and ones." <-- is possible but it will take a lot of absurd time to do that.

An example of a site that you can't fully load is gmail.com because it also include a extra complexity :javascript (excluding Lynx because it is not native, neither a real experience).

Anyways, outside web and email, exist some protocol that can't be accessed using a plain telnet because it required some kind of timely handshaking (a couple of seconds if not less) that can't be imitated using two separates call to telnet without using some sort of automatism, i.e. we are talking about a client that is not a proper telnet client but over it.

1
  • To be fair you can pipe input to telnet, but yeah :) Mar 6, 2011 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .