Hi, I've been spending all night trying to learn how to use telent (I have windows xp) but I can't figure it out. Dos comes with microsoft telnet but seems to have limited capabilities. I have downloaded telstar and some other programs but none seem to work for me. I simply would like to know, in layman terms, how I can run telnet or use a script, for commands like get and host, etc. I've read how to use the commands, but no clue what program or script I can actually type them into! The programs I've tried always say connection attempt failed when putting in host of www.hacker.org and even if it did connect there is no place to type in a get or range or whatever command.
Cheers,
John
Telnet (how to use it)
It depends what you want to do with telnet. Technically the telnet protocol is more than just a TCP connection, but you can generally also use it to just poke text at TCP ports and see what you get back as well. To get anything useful, though, you need to know what to send.
So if you want to send a web request, you need to connect to port 80 (put 80 on the command line after the hostname), then write:
Note the blank line at the end, i.e. you need to press Enter twice. The server should then send something back to you - at the very least, an error message.
The "/" is the path on the server. The protocol version number is important if you want certain headers to work - for a virtually-hosted site (most cheap hosting is virtual) you need a Host: header to tell the server which site you're after, as many sites are hosted on a single IP address.
Beyond that you can read the relevant RFCs (Internet standards documents) for full details of the protocol, including other headers. But as p2p said, command-line tools like wget and curl are often easier ways to send somewhat customized web requests. Sending raw data like this is only necessary if you need full control of the headers - and again as p2p said, there are other options - languages like Perl and Python are well equipped for doing this kind of thing in a more programmatic way.
So if you want to send a web request, you need to connect to port 80 (put 80 on the command line after the hostname), then write:
Code: Select all
GET / HTTP/1.1
Host: www.hacker.org
The "/" is the path on the server. The protocol version number is important if you want certain headers to work - for a virtually-hosted site (most cheap hosting is virtual) you need a Host: header to tell the server which site you're after, as many sites are hosted on a single IP address.
Beyond that you can read the relevant RFCs (Internet standards documents) for full details of the protocol, including other headers. But as p2p said, command-line tools like wget and curl are often easier ways to send somewhat customized web requests. Sending raw data like this is only necessary if you need full control of the headers - and again as p2p said, there are other options - languages like Perl and Python are well equipped for doing this kind of thing in a more programmatic way.
Thanks for the reply's guys. Unfortunately I am still stuck. I mainly need this for a range problem.
To be more clear, Telstar for example, starts with a small windows that asks to type in the host, to which I type in www.hacker.org and it always says "could not open connection to the host on port 23" and shuts down right away. In Microsoft Telnet I type in o www.hacker.org and again says cannot connect. I've tried secure commnet, anzio lite, etc. I've made sure the telnet service is running in services.msc and the only thing I can think of is that telnet is not working through my at- home linksys router. I put telnet, port 23, under Port Range Forward in the router setup (although not sure if that helps any or was done correctly). Also, any host I try to connect to doesn't work, even with trying various ports, so it's not just here. And I have no firewall running. Help!
To be more clear, Telstar for example, starts with a small windows that asks to type in the host, to which I type in www.hacker.org and it always says "could not open connection to the host on port 23" and shuts down right away. In Microsoft Telnet I type in o www.hacker.org and again says cannot connect. I've tried secure commnet, anzio lite, etc. I've made sure the telnet service is running in services.msc and the only thing I can think of is that telnet is not working through my at- home linksys router. I put telnet, port 23, under Port Range Forward in the router setup (although not sure if that helps any or was done correctly). Also, any host I try to connect to doesn't work, even with trying various ports, so it's not just here. And I have no firewall running. Help!
That's correct, port 23 is blocked for security reasonsmcjohn wrote:o www.hacker.org and again says cannot connect. Help!
Read http://en.wikipedia.org/wiki/HTTP or search for "telnet http sample session".
You have to specify which port to use by putting the port number after the IP address or server name:
or
Then for example type the three lines
(the last line is empty).
Code: Select all
telnet www.hacker.org 80
Code: Select all
telnet
> open www.hacker.org 80
Code: Select all
GET / HTTP/1.1
Host: www.hacker.org
Last edited by teebee on Tue Mar 31, 2009 10:15 pm, edited 2 times in total.
This all sets up your home PC so that other people can telnet into it. You *really* don't want to do that - the telnet protocol is about as insecure as they come. Remove the port forward and disable the telnet service ASAP. You only need the telnet client, not the server.mcjohn wrote:I've made sure the telnet service is running in services.msc ... I put telnet, port 23, under Port Range Forward in the router setup ... And I have no firewall running. Help!