Controleer TCP Port 80 (http / https) met telnet

HTTP Protocol Basics

HTTP is a plaintext protocol. Thereby, simulating a browser and testing access through port 80 using the telnet command becomes simple.

The following steps are necessary for this from a Linux command line:

  1. Execute telnet SERVERNAME 80. Thereby, telnet will connect to the server named SERVERNAME through port 80.
  2. If the establishment of the TCP connection is possible, telnet will respond with the messages: Connected to SERVERNAME. and Escape character is '^]'.
  3. A web page can now be requested using the HTTP protocol (such as the server’s web site). Enter the following two lines to do this and press afterwards the Enter key two times:
    GET / HTTP/1.1
    HOST: HOSTNAME
  4. The server will respond with the HTTP status and the web page (such as HTTP/1.1 200 OK and so forth.)

Example

In the following example, the http://checkip.dyndns.org/[2] page will be accessed. The following commands will be entered on the Linux command line, followed by pressing the Enter two times:

telnet checkip.dyndns.org 80
GET / HTTP/1.1
HOST: checkip.dyndns.org

The checkip.dyndns.org server will respond with HTTP Response, which will also contain the HTML code for the web page:

[user@fedora9 user]$ telnet checkip.dyndns.org 80
Trying 204.13.249.70...
Connected to checkip.dyndns.org.
Escape character is '^]'.
GET / HTTP/1.1
HOST: checkip.dyndns.org

HTTP/1.1 200 OK
Content-Type: text/html
Server: DynDNS-CheckIP/1.0
Connection: close
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 106

<html><head><title>Current IP Check</title></head><body>Current IP Address: 91.113.127.247</body></html>
Connection closed by foreign host.
[user@fedora9 user]$ 

References

  1. Jump up Hypertext Transfer Protocol (en.wikipedia.org)
  2. Jump up For details, see http://www.dyndns.com/support/tools/
Dit bericht is gepost in Linux. Bookmark de link.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *