Hostsman
Cross-platform command line tool for handling hosts files. Adds, removes, or lists mappings in the hosts file.
Description
Hostsman is a cross-platform command line tool designed for managing entries in the hosts file, located at /etc/hosts on Linux systems. It provides simple operations to insert, remove, check, or list hostname-to-IP mappings, making it useful for network configuration, testing, or blocking unwanted domains by redirecting them to specific IPs.
Common use cases include adding custom DNS mappings for development environments, removing obsolete entries, verifying if a hostname is already mapped, or listing all current mappings. This tool is particularly handy in penetration testing or system administration where quick manipulation of the hosts file is needed without manual editing.
It relies on Python dependencies and installs via standard Kali package management, ensuring compatibility across platforms.
How It Works
Hostsman interacts directly with the system's hosts file at /etc/hosts. It parses command-line arguments to either read the file for listing or checking hostnames, append new HOSTNAME[:IP] mappings (defaulting to 127.0.0.1 if IP omitted), or remove specified hostnames by rewriting the file excluding those entries. Operations require root privileges for file modifications.
Installation
sudo apt install hostsmanFlags
Examples
hostsman -hhostsman -lhostsman -c example.comhostsman -c example.com test.comhostsman -i example.comhostsman -i example.com:192.168.1.100 test.com:10.0.0.1hostsman -r example.comhostsman -r example.com test.com unwanted.com