I was trying netcat with a simple HTTP GET Request as follows:

nc roamin-nomen.name 80

GET / HTTP/1.1
Host: roamin-nomen.name

400 - Bad Request

And then I remembered that you have to end your lines with CRLF:

nc -C roamin-nomen.name 80

That, with the above input, got me the result I was expecting.

301 Moved Permanently

The 301 Moved Permanently is because my website redirects to https.

In addtion I made a text file of the get request so I could pipe it into netcat as follows:

cat http_get_request.txt | nc -C roamin-nomen.name 80

If I look at the file with vim or cat, I see the ^M displayed for CR (caret notation).

cat -v http_get_request.txt

GET / HTTP/1.1^M
Host: www.roamin-nomen.name^M
^M

Previous Post Next Post