Learning HTTP Requests – A Mini HTTP Exercise

[read_meter]

Table of Contents

While learning HTTP in Detail, I thought it’d be fun to put it to the test in the terminal.

Here’s a quick exercise to practice learning HTTP Requests, Responses and Headers.

  • Difficulty: Easy – new to Linux.
  • Environment: local Debian-based Linux installation e.g. Ubuntu in VirtualBox.
  • Commandsgitpython3cdmkdir, wget.

Steps

Here’s everything you need to do, note, you’ll need two terminals to do this:

  1. Terminal 1: git clone https://github.com/mrashleyball/HTTP.git, cd HTTP
  2. python3 -m http.server
  3. Terminal 2: nc 0.0.0.0 8000, GET / HTTP/1.1
  4. nc 0.0.0.0 8000, GET /flag.txt HTTP/1.1
  5. mkdir Downloads, cd Downloads
  6. wget 0.0.0.0:8000, wget 0.0.0.0:8000/flag.txt

Wow, pretty easy to spin up web servers and test HTTP Requests, hey?

Explanation

This is a good exercise to take a step beyond the theory, TryHackMe does a great job with interactive static web pages within their platform.

But I thought it’d be fun to go one step further and test it out within the terminal.

Using the python webserver with netcat, you can clearly see the request making it to the server and it responds with the index.html file, very cool.

https://p146.p4.n0.cdn.getcloudapp.com/items/7KuQnzg6/32afd2e5-d1d2-45b8-9e70-6f6cddccb37d.jpeg?v=02e071e63c51d47eaaecca3f5e5f40d4

And for the flag.txt you simply need to specify the file path to get the response:

https://p146.p4.n0.cdn.getcloudapp.com/items/rRu1BgPb/5bcd68ab-a90a-4001-8a4d-2690d616ceb3.jpeg?v=3a1d02039587da30a671942a5932959c

For more help, here’s a list of links to helpful guides/articles/forums I used in my research:

Reflection

This was a really fun little exercise to think up and put together, I love doing mini-projects like this. It combines all the skills I believe are important in tech like writing, teaching and having a grasp on the fundamentals.

“It is important to view knowledge as sort of a semantic tree — make sure you understand the fundamental principles, ie the trunk and big branches, before you get into the leaves/details or there is nothing for them to hang on to.” – Elon Musk.

Thanks for reading and I hope you learned something from this little exercise. This is day 47 of #100DaysOfHacking on the Hackers Learning PathSubscribe for CyberSec updates or read more, happy hacking.

About The Author
Mr Ash

Mr Ash

“Learn, create, share, repeat.” • IT teacher, former web designer, learning CyberSec • Road to #100DaysOfHacking on Hackers Learning Path.
Share This Article
LinkedIn
Twitter
Facebook
WhatsApp
Email

Monthly Newsletter

Learn about cyber security, hacking guides & python programming.

Leave A Comment

Leave a Reply

Your email address will not be published.

More Content

Monthly Newsletter

Learn about cyber security, hacking guides & python programming.

This site uses cookies and other tracking technologies to assist with navigation, monitor site usage and web traffic, assist with our promotional and marketing efforts, and customize and improve our services, as set out in our privacy policy