/etc/hosts
for HackTheBox machines
Auto-generate Save yourself some tedium on getting started on a new machine by having your /etc/hosts
ready to go.
Quickstart
curl https://raw.githubusercontent.com/fx2301/htb_etc_hosts/master/hosts_all.txt | sudo tee -a /etc/hosts
To give you an idea of the contents:
curl -s https://raw.githubusercontent.com/fx2301/htb_etc_hosts/master/hosts_all.txt | head -n 10
# === start auto-generated by https://github.com/fx2301/htb_etc_hosts ===
# Easy machines
10.10.10.215 academy.htb # https://app.hackthebox.com/machines/297
10.10.10.98 access.htb # https://app.hackthebox.com/machines/156
10.10.10.100 active.htb # https://app.hackthebox.com/machines/148
10.10.10.187 admirer.htb # https://app.hackthebox.com/machines/248
10.10.11.107 antique.htb # https://app.hackthebox.com/machines/400
10.10.10.11 arctic.htb # https://app.hackthebox.com/machines/9
Setup
python3 -m venv .venv
source .venv/bin/activate
pip install --editable ../htb_cli
^^ note that htb_cli
wasn't a published repo at the time of writing this documentation. Create an issue on this repo if you want access - thanks!
Generating
Generate a fully up to date hosts.txt yourself (the code defaults to active machines only):
python3 generate.py > hosts_active.txt
Downloading
Use the file you want from the repo (list is a snapshot from 2021-11-09):
curl -O https://raw.githubusercontent.com/fx2301/htb_etc_hosts/master/hosts_all.txt
Appending
cat hosts_all.txt | sudo tee -a /etc/hosts
Caveats
This won't play nice with any dynamically IP addresses that are dynamically assigned by HtB.
Contributing
PRs are welcome. Even just to keep the list up to date. Please don't include any fuzzed subdomains, though. No spoilers allowed (even for retired machines).