{"id":36478994,"url":"https://github.com/w0ltage/go-to-box","last_synced_at":"2026-03-09T22:39:20.615Z","repository":{"id":176688258,"uuid":"651899795","full_name":"w0ltage/go-to-box","owner":"w0ltage","description":"Add, remove or replace hosts in the hosts file. Primarily made for use when hacking machines from HackTheBox.","archived":false,"fork":false,"pushed_at":"2023-06-22T14:41:22.000Z","size":123,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-02-14T20:28:04.292Z","etag":null,"topics":["hackthebox","hosts-manage"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/w0ltage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-06-10T12:41:23.000Z","updated_at":"2024-02-14T20:28:05.326Z","dependencies_parsed_at":null,"dependency_job_id":"0d0e4a98-cbe8-44a6-8e68-89f604032657","html_url":"https://github.com/w0ltage/go-to-box","commit_stats":null,"previous_names":["tokiakasu/go-to-box","w0ltage/go-to-box"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/w0ltage/go-to-box","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w0ltage%2Fgo-to-box","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w0ltage%2Fgo-to-box/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w0ltage%2Fgo-to-box/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w0ltage%2Fgo-to-box/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w0ltage","download_url":"https://codeload.github.com/w0ltage/go-to-box/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w0ltage%2Fgo-to-box/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28330147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hackthebox","hosts-manage"],"created_at":"2026-01-12T01:00:10.354Z","updated_at":"2026-03-09T22:39:20.602Z","avatar_url":"https://github.com/w0ltage.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"static/terminal.png\" alt=\"terminal\" width=\"400px\"\u003e\n  \u003cbr\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e •\n  \u003ca href=\"#running-gtb\"\u003eRunning gtb\u003c/a\u003e •\n  \u003ca href=\"#notes\"\u003eNotes\u003c/a\u003e\n\u003c/p\u003e\n\n`gtb` is a \"shortcut\" to adding, removing or replacing hosts in /etc/hosts file. Made for \\*nix, but hypothetically can work with Windows hosts file (c:\\Windows\\System32\\Drivers\\etc\\hosts). **You need root privileges to edit /etc/hosts, so run the tool as root or with sudo.**\n\n# Installation\n\n```sh\ngo install -v github.com/tokiakasu/go-to-box/cmd/gtb@latest\n```\n\n# Usage\n\n```sh\ngtb -h\n```\n\nThis will display help for the tool. \n\n```console\nAdd, remove or replace hosts in the hosts file\nUsage: gtb { mode } { argument(s) } \n-rm\tMode to remove all domains with a specified TLD\n-add\tMode to add host to hosts file\n-re\tMode to remove all domains with specific TLD to replace them wtih another IP and domain\n-i\tValue for domain IP address\n-d\tValue for domain name\n\nThere are only 3 types of program execution scenarios:\ngtb -rm \u003ctld\u003e                                Remove all \u003ctld\u003e domains from hosts file\ngtb -add -i \u003cIP\u003e -d \u003cdomain\u003e                 Add \u003cIP\u003e address and \u003cdomain\u003e\ngtb -re -i -rm \u003ctld\u003e -i \u003cIP\u003e -d \u003cdomain\u003e     Remove all \u003ctld\u003e domains and add \u003cIP\u003e with \u003cdomain\u003e\n```\n\n# Running gtb\n\n### Remove all domains with specified TLD\n\n`/etc/hosts` before\n\n```console\n# Host addresses\n127.0.0.1    localhost\n10.129.162.54    therockers.com\n10.120.143.99    thecreators.com\n10.129.161.44    thetoppers.htb\n```\n\nThis will delete all .com domains\n\n```console\n# gtb -rm com\n\nDomains removed successfully\n```\n\n`/etc/hosts` after \n\n```console\n# Host addresses\n127.0.0.1    localhost\n10.129.161.44    thetoppers.htb\n```\n\n### Add new IP address and domain name\n\n`/etc/hosts` before\n\n```console\n# Host addresses\n127.0.0.1    localhost\n10.129.162.54    therockers.com\n```\n\nThis will add the IP address `10.129.161.44` and the domain name `thetoppers.htb` at the end of the hosts file\n\n```console\n# gtb -add -i 10.129.161.44 -d thetoppers.htb\n\nDomain added successfully\n```\n\n`/etc/hosts` after\n\n```console\n# Host addresses\n127.0.0.1    localhost\n10.129.162.54    therockers.com\n10.129.161.44    thetoppers.htb\n```\n\n### Replace old domains with new ones\n\n`/etc/hosts` before\n\n```console\n# Host addresses\n127.0.0.1    localhost\n10.129.162.54    therockers.htb\n10.120.143.99    thecreators.htb\n10.129.161.44    thetoppers.htb\n```\n\nThis will remove all .htb domains and add the IP address `192.168.0.50` with domain name `ftp.localx.com` at the end of the hosts file\n\n```console\n# gtb -re -rm htb -i 192.168.0.50 -d ftp.localx.com\n\nDomain replaced successfully\n```\n\n`/etc/hosts` after\n\n```console\n# Host addresses\n127.0.0.1    localhost\n192.168.0.50    ftp.localx.com\n```\n\n# Notes\n\n- gtb works with only one TLD, IP address or domain name at a time\n- The path to the hosts file is set in hostsPath variable within main() function. Feel free to change it.\n- To be honest, writing this tool by using only internals libs, especially `flag` library was a real ~pain~ challenge. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw0ltage%2Fgo-to-box","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw0ltage%2Fgo-to-box","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw0ltage%2Fgo-to-box/lists"}