Resolve HtB hosts and all subdomains using dnsmasq
, or resolve hosts with /etc/hosts
additions.
curl https://raw.githubusercontent.com/fx2301/htb_etc_hosts/master/dnsmasq.hosts.conf | sudo tee /etc/dnsmasq.hosts.conf
echo 'conf-file=/etc/dnsmasq.hosts.conf' | sudo tee -a /etc/dnsmasq.conf
sudo systemctl restart dnsmasq
To give you an idea of the contents:
curl -s https://raw.githubusercontent.com/fx2301/htb_etc_hosts/master/dnsmasq.hosts.conf | head -n 10
# === start auto-generated by https://github.com/fx2301/htb_etc_hosts ===
# Easy machines
address=/academy.htb/10.10.10.215 # https://app.hackthebox.com/machines/297
address=/access.htb/10.10.10.98 # https://app.hackthebox.com/machines/156
address=/active.htb/10.10.10.100 # https://app.hackthebox.com/machines/148
address=/admirer.htb/10.10.10.187 # https://app.hackthebox.com/machines/248
address=/antique.htb/10.10.11.107 # https://app.hackthebox.com/machines/400
address=/arctic.htb/10.10.10.11 # https://app.hackthebox.com/machines/9
curl https://raw.githubusercontent.com/fx2301/htb_etc_hosts/master/hosts.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.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
The easiest to understand is appending to your /etc/hosts
file. The best solution is integration into dnsmasq
(it will also support subdomains).
Generate a fully up to date dnsmasq.hosts.conf yourself (see Setup):
python3 generate.py dnsmasq > dnsmasq.hosts.conf
Or use a snapshot from the repo:
curl -O https://raw.githubusercontent.com/fx2301/htb_etc_hosts/masterdnsmasq.hosts.conf
Edit /etc/dnsmasq.conf to set conf-file
to the full path to dnsmasq.hosts.conf
, e.g.:
conf-file=/home/you/code/htb_etc_hosts/dnsmasq.hosts.conf
Restart dnsmasq, e.g.:
sudo systemctl restart dnsmasq
Generate a fully up to date hosts.txt yourself (see Setup):
python3 generate.py hosts > hosts.txt
Or use a snapshot from the repo:
curl -O https://raw.githubusercontent.com/fx2301/htb_etc_hosts/master/hosts.txt
Append to /etc/hosts
(note this gets messy with repeated runs):
cat hosts.txt | sudo tee -a /etc/hosts
To regenerate files yourself, you need htb_cli
which wasn't a published repo at the time of writing this documentation. Create an issue on this repo if you want access - thanks!
python3 -m venv .venv
source .venv/bin/activate
pip install --editable ../htb_cli
These static IPs won't play nice with any dynamically IP addresses from HtB. A work-around is to edit your configuration. E.g. for dnsmasq:
Oops, getting the post-release-arena IP address:
$ ping shibboleth.htb
PING shibboleth.htb (10.10.11.124) 56(84) bytes of data.
^C
Edit the shibboleth.htb entry in dnsmasq.hosts.conf
to be my personal IP address:
$ vi dnsmasq.hosts.conf
...snip...
address=/shibboleth.htb/10.129.232.23
...snip...
Restart dnsmasq
and all is well:
$ sudo systemctl restart dnsmasq
$ ping shibboleth.htb
PING shibboleth.htb (10.129.232.23) 56(84) bytes of data.
64 bytes from 10.129.232.23 (10.129.232.23): icmp_seq=1 ttl=63 time=85.6 ms
^C
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).