Monday, June 9, 2008

Telnet command with port number.

Telnet command will helps to peep in to the remote server's application port. And we can have response from the remote server if you sent appropriate packets or data.

Syntax: telnet [IP address] [Application port num]
eg:
#telnet 192.168.1.2 8000
[ type here to send the appropriate data which remote server can recognize ]
Use Crtl + ] to get command mode prompt.
telnet> ? Enter
Gives some commad
telnet>close -->to exit

If you want to send Http response from command ..
Use ethereal to capture the data to be sent.
[Hint Right click the request and select TCP Streams ,You will get the Http response packet , Just Copy and paste it after telnet.]
Procedure
---------

Below packet is the capture of the HTTP get method ,since
assuming httpd is running in the server at port 8080.

#telnet 192.168.1.2 8080



If application is HTTP server below code capture will help full.
---This is what HTTP GET method request packet looks----
GET /index.html HTTP/1.1
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Host: 192.168.1.1:8080
Connection: Keep-Alive
Cache-Control: no-cache
------------------------Ends-----------------

---This is what HTTP POST method request packet looks----
POST /line_sip.htm?l=1 HTTP/1.1
Content-Length: 312
Connection: Keep-Alive

user_moh1=&user_alert_info1=&user_pic1=&user_dp_str1= &user_dp_exp1_0=off&user_dper_expiry1=3600&user_auto_connect1=off &user_descr_contact1=on&user_sipusername_and_local_name1=off& Settings=Save
------------------------Ends-----------------
user_moh1,user_alert_info1 .. are variables getting update values by POST request.

No comments: