Telnet, NC, CURL, and HTTP - Hsanokklis/2023-2024-Tech-journal GitHub Wiki
Use telnet to connect to your web server and retrieve a web page
yum install telnet
- You will have to manually type the HTTP Message Request Start Line
- Take a screen shot showing the text html you received from the server
TROUBLESHOOTING: putting / in front of the something means its a directory, I was writing GET /about/aboutme.html/ and the / at the end of the request was telling the server that it was a directory so it wasn't retrieving the page correctly.
I tried retrieving the webpage with just GET /about/aboutme.html
and it worked because security is no Bueno. It worked the second time without connecting to the host because we already connected once so it didn't need the host again (because of the lack security).
Use nc (netcat) to query the web server and return only the headers of the webpage
yum install nc
nc command
This command usese the echo
and nc
command to manually construct and send an HTTP HEAD request to the 10.0.17.23
web server on port 80
. The command queries the server and retrieves only the headers of the root path of the website.
Breakdown of the command
HEAD
- Specifies the HTTP method as HEAD
/
- Specifies the path
HTTP/1.1
- the HTTP version being used
Host: 10.0.17.23
- the IP of the server
\r\n
lines are carriage return and line feed characters used to terminate lines in the HTTP request.
| nc 10.0.17.23 80
- pipes the constructed HTTP request to the
nc
. nc
establishes a connection to the specified IP address
- pipes the constructed HTTP request to the
trying it with the /about/about.html path
Use curl to connect to the web server a retrieve a webpage
Getting just the page header
Link used: https://stackoverflow.com/questions/19037474/how-to-request-only-for-a-web-page-header-using-netcat
Getting the webpage at /about/aboutme.html