From 57bf66bc00b3d3e1988387c8517c14a0070a3d70 Mon Sep 17 00:00:00 2001 From: s00ner Date: Wed, 23 Feb 2022 18:49:55 -0500 Subject: [PATCH] added hosts file info --- techniaues_and_tools/hosts_file.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 techniaues_and_tools/hosts_file.md diff --git a/techniaues_and_tools/hosts_file.md b/techniaues_and_tools/hosts_file.md new file mode 100644 index 0000000..5289c35 --- /dev/null +++ b/techniaues_and_tools/hosts_file.md @@ -0,0 +1,13 @@ +# Add the Box to Your Hosts File + +It's common for Hack the Box machines to include web servers that respond differently to HTTP requests depending on if you're requesting the IP address directly, the hostname, or a sub-domain. +(This is called [virtual hosting](https://en.wikipedia.org/wiki/Virtual_hosting)). +For example, on the [Bucket](https://app.hackthebox.com/machines/Bucket) machine the webserver gives different responses for `http://10.10.10.212`, `http://bucket.htb`, and `http://s3.bucket.htb`. +There is no DNS service on the HTB network so you have to use your [hosts file](https://en.wikipedia.org/wiki/Hosts_(file)) to resolve the different host names into the IP address. + +For the Bucket machine, we'd add the following line to `/etc/hosts`: + +`10.10.10.212 bucket.htb s3.bucket.htb` + +You can do this easily from the command line with `sudo nano /etc/hosts` use the nano text editor to add the line. +To make sure it's working you can try `ping bucket.htb` and it should ping 10.10.10.212. \ No newline at end of file