S
S
Serge Belous2017-03-08 18:50:50
bash
Serge Belous, 2017-03-08 18:50:50

How to generate an http request using netcat?

Tell me how to generate the correct http request using netcat?

nc -v microsoft.com 80
Connection to ya.ru 80 port [tcp/http] succeeded!
GET / HTTP/1.0
Host: ya.ru
Connection: close
does not output anything to the console.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2017-03-08
@jcmvbkbc

Add two newlines after "Connection: close".
Host: ya.ru - this is in vain, of course, but it should not affect the response.
It gives me:

$ nc -v microsoft.com 80
microsoft.com [104.43.195.251] 80 (http) open
GET / HTTP/1.0
Host: ya.ru
Connection: close

HTTP/1.1 301 Moved Permanently
Cache-Control: private
Content-Length: 23
Content-Type: text/html
Location: http://www.microsoft.com
Server: Microsoft-IIS/8.5
Set-Cookie: ASPSESSIONIDASRCAASR=PBJJGFHDDCGOKPCJFIKFJPPE; path=/
X-Powered-By: ASP.NET
Date: Wed, 08 Mar 2017 18:12:16 GMT
Connection: close

<!--TOOLBAR_EXEMPT-->

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question