Sunday, August 16, 2015

Using Telnet for Website Browsing

 

Abstract

The purpose of this document is to demonstrate use of telnet application to use basic HTTP methods.

Motivation:

This document showcases capabilities of telnet application for the purpose of accessing any website in plain HTML text or using HTTP methods.


Introduction:


We need to use TELNET application to browse two web applications, one running on localhost and another on the web. We would use the windows telnet application to accomplish the task.


Method/measurement:


Step1- Enable Telnet Application:


In the first step, we would make sure that telnet application is enabled on the windows machine. To verify, go to command prompt and type telnet and hit enter. If telnet is not enabled then you need to enable by going to Control Panel->Turn on or off windows features and checking the telnet client checkbox as shown below.




Step 2-Run telnet application:


In the Second step, we would launch the telnet application by typing telnet command and hitting enter on the command prompt as shown below.

This would launch a telnet application as shown below


Step 3- Connect to web application running on local host:


Prerequisite : You must have the web server running on your machine to cater HTTP requests.

 In this step , we will connect to localhost ,running on port 3000, using the open command via telnet application. The format for the open command is as follow:

O <<hostaddress>> <<portnumber>>


Step 4- GET command on localhost:


Now, we will use the GET command to get the home page of the web application, running on the local machine. The format for the GET command is :

GET /<URL> HTTP/1.0 <enter>

Host: host address <enter>

In our example ,we would write the command as shown below.

This would return the HTML response for the home page of our web application mytodos as shown in below screenshot.


As you can see, the returned response contains several other parameters along with the Page source such as request return code 200 OK. These are the parameters , which are not generally viewable through the internet browser.

Step 5-Get command on External Website :

Now, we would try to do a HTTP GET command to an external website www.gravitonnetwork.com and browse to the contact us page of the website.

This web server is listening on port 80 so we would use port number 80 in our command as shown below.

The format for the GET command remains

GET /<URL> HTTP/1.0 <enter>

Host: host address <enter>

We would first connect to www.gravitonnetwork.com on port 80 using following command.

 o www.gravitonnetwork.com 80


Now, we would use get command to browse to the contact us page of the website.

GET /contact_us.html HTTP/1.0

Host: www.gravitonnetwork.com:80

This would return the HTML response for the contact us page of the web site as shown in below screenshot.


As you can see the returned response, contains several other parameters along with the Page source such as request return code, server information etc. These parameters are not generally viewable through the internet browser.


Google search using Telnet client:

In the next step , we would do a google query using telnet . To do this, connect to google using telnet clinet

o www.google.com 80

Now use the following command to run the search on parameter search

Get http://www.google.com/?gws_rd=ssl#q=search HTTP/1.0

host:www.google.com

If you can notice our search string is present as q=search in the command.After running the command, we would get following response from google server:


Other HTTP methods:


So far, we have used only HTTP get method to retrieve the page. However, we can use other HTTP methods such as GET,PUT, DELETE, POST and HEAD as well to interact with the website . For example to retrieve the header information of the website www.gravitonnetwork.com, we can use HEAD command as shown below

HEAD / HTTP/1.0

Host:www.gravitonnetwork.com

We would get following response in our results, header information for the requested page.


To use the POST method, for a form that that contains following fields:


Item and location with a submit button 

POST http://localhost:3000/mytodos/new HTTP/1.0

Host: localhost:3000

Item=firstItem&location=Denver


Results:


By following the steps mentioned in the above section, we have learned how we can use TELNET client to browse any website.


Conclusion:


In the document, we have gone through the process to


  1. Enable TELNET client on windows platform

  2. Use telnet client for browsing web application on localhost

  3. Use telnet client for browsing web application on external webserver

  4. Use telnet to do a google query.


 





No comments:

Post a Comment