Professional /etc/hosts management tool for penetration testing and CTF challenges
Features β’ Installation β’ Usage β’ Examples β’ Troubleshooting
- Overview
- Features
- Installation
- Usage
- Command Reference
- Examples
- Common Use Cases
- Troubleshooting
- Contributing
ADDD is a powerful Bash script designed to simplify /etc/hosts file management during penetration testing, CTF competitions, and general system administration. It provides an intuitive interface with color-coded output, automatic backups, and comprehensive error handling.
During penetration testing and CTF challenges, you often need to:
- Quickly add discovered subdomains to
/etc/hosts - Manage multiple domains pointing to the same IP
- Clean up entries after completing a challenge
- Search for previously added domains
ADDD streamlines all these tasks with simple commands and prevents common mistakes like duplicate entries or invalid IPs.
- β Add domains - Single or multiple domains to any IP address
- β List entries - View all custom DNS entries in a formatted table
- β Search domains - Quickly find which IP a domain points to
- β Remove domains - Delete specific domains without affecting others
- β Edit entries - Change a domain's IP address
- β Clean all - Remove all custom entries at once
- π Automatic backups - Creates
/etc/hosts.oldbefore first modification - β IP validation - Prevents invalid IP addresses
- π Duplicate detection - Avoids creating duplicate entries
- π¨ Color-coded output - Easy to read success/error messages
- π Summary reports - Shows what was added, skipped, or removed
- π Intelligent merging - Automatically adds domains to existing IP entries
- π§Ή Clean removal - Removes entire line if last domain or just the domain if others exist
- π Pattern matching - Uses word boundaries to prevent partial matches
- π Organized structure - Keeps custom entries under
# Otherssection
# Clone the repository
git clone https://github.com/4ndymcfly/addd.git
# Navigate to directory
cd addd
# Make executable
chmod +x addd.sh
# Optional: Install globally
sudo cp addd.sh /usr/local/bin/addd# Download the script
wget https://raw.githubusercontent.com/4ndymcfly/addd/main/addd.sh
# Make executable
chmod +x addd.sh
# Move to PATH (optional)
sudo mv addd.sh /usr/local/bin/adddsudo ./addd.sh --help
# or if installed globally:
sudo addd --helpAll commands require root privileges (sudo)
sudo addd.sh [OPTIONS] [ARGUMENTS]| Command | Description |
|---|---|
addd.sh <IP> <domain> |
Add a single domain |
addd.sh <IP> <domain1> <domain2> ... |
Add multiple domains to same IP |
addd.sh -l |
List all custom entries |
addd.sh -s <domain> |
Search for a domain |
addd.sh -r <domain> |
Remove a specific domain |
addd.sh -e <domain> <new_ip> |
Edit domain's IP address |
addd.sh -c |
Clean all custom entries |
addd.sh -h |
Show help |
# Add single domain
sudo addd.sh 10.10.10.50 contoso.htb
# Add multiple domains to same IP
sudo addd.sh 10.10.10.50 contoso.htb www.contoso.htb admin.contoso.htbOutput:
[+] Backup created: /etc/hosts.old
[+] Added new entry: 10.10.10.50 contoso.htb
[+] Added 'www.contoso.htb' to existing IP 10.10.10.50
[+] Added 'admin.contoso.htb' to existing IP 10.10.10.50
Summary: 3 added, 0 skipped
sudo addd.sh --list
# or
sudo addd.sh -lOutput:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Custom DNS Entries in /etc/hosts:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
IP Address Domain(s)
10.10.10.50 contoso.htb www.contoso.htb admin.contoso.htb
10.10.10.60 example.htb api.example.htb
sudo addd.sh --search contoso.htb
# or
sudo addd.sh -s contoso.htbOutput:
Searching for 'contoso.htb'...
[+] Found: contoso.htb β 10.10.10.50
sudo addd.sh --remove admin.contoso.htb
# or
sudo addd.sh -r admin.contoso.htbOutput:
[+] Removed 'admin.contoso.htb' from IP 10.10.10.50 in /etc/hosts
sudo addd.sh --edit contoso.htb 10.10.10.60
# or
sudo addd.sh -e contoso.htb 10.10.10.60Output:
[+] Updated 'contoso.htb': 10.10.10.50 β 10.10.10.60
sudo addd.sh --clean
# or
sudo addd.sh -cOutput:
[+] All custom entries have been removed from /etc/hosts
# Add the machine's IP and hostname
sudo addd.sh 10.10.10.50 soccer.htb
# Later, discover subdomains during enumeration
sudo addd.sh 10.10.10.50 soc-player.soccer.htb
# List all entries to verify
sudo addd.sh -l# Add main domain and discovered subdomains
sudo addd.sh 192.168.1.100 ctf.local www.ctf.local admin.ctf.local api.ctf.local
# Search for a specific subdomain
sudo addd.sh -s admin.ctf.local
# Remove a subdomain that's no longer needed
sudo addd.sh -r api.ctf.local# Add different targets
sudo addd.sh 10.10.10.50 target1.htb
sudo addd.sh 10.10.10.60 target2.htb www.target2.htb
sudo addd.sh 10.10.10.70 target3.htb
# List all targets
sudo addd.sh -l
# Target IP changed? Update it
sudo addd.sh -e target2.htb 10.10.10.65
# Finished with all targets? Clean up
sudo addd.sh -c# Initial target
sudo addd.sh 10.10.10.50 example.htb
# Found subdomains via gobuster/ffuf
sudo addd.sh 10.10.10.50 admin.example.htb dev.example.htb staging.example.htb
# Found more during testing
sudo addd.sh 10.10.10.50 api.example.htb cdn.example.htb
# Verify all added correctly
sudo addd.sh -l# Standard workflow
sudo addd.sh <MACHINE_IP> <machine>.htb
sudo addd.sh -s <machine>.htb # Verify it was added
# ... perform your testing ...
sudo addd.sh -c # Clean up when done# Add discovered virtual hosts
sudo addd.sh 192.168.1.50 app.company.local admin.company.local
# Update IP if moved to different environment
sudo addd.sh -e app.company.local 10.0.0.50
sudo addd.sh -e admin.company.local 10.0.0.50# Set up local dev environment
sudo addd.sh 127.0.0.1 myapp.local api.myapp.local admin.myapp.local
# List to verify
sudo addd.sh -lProblem: Permission denied error when running the script
Solution:
# Ensure you're running with sudo
sudo ./addd.sh <arguments>
# Or make sure the script is executable
chmod +x addd.shProblem: Invalid IP address format error
Solution:
- Verify the IP format is correct (e.g.,
10.10.10.50, not10.10.10.256) - Each octet must be 0-255
# β
Correct
sudo addd.sh 10.10.10.50 example.htb
# β Incorrect
sudo addd.sh 10.10.10.256 example.htbProblem: Domain already exists in /etc/hosts
Solution:
# Search where it currently points
sudo addd.sh -s domain.htb
# Option 1: Remove and re-add
sudo addd.sh -r domain.htb
sudo addd.sh <new_ip> domain.htb
# Option 2: Use edit command
sudo addd.sh -e domain.htb <new_ip>Problem: Cannot find a domain you know you added
Solution:
# List all entries to see what's there
sudo addd.sh -l
# Check if it's in a different section of /etc/hosts
cat /etc/hosts | grep domain.htb
# Search using the tool
sudo addd.sh -s domain.htbProblem: Want to restore but no /etc/hosts.old exists
Solution:
- The backup is only created on the first modification
- If you need to restore, copy from your system backup or:
# Manual backup before using
sudo cp /etc/hosts /etc/hosts.backup
# Restore if needed
sudo cp /etc/hosts.backup /etc/hostsProblem: Color codes appearing as text instead of colors
Solution:
- Ensure your terminal supports ANSI colors
- Try a different terminal emulator (e.g., GNOME Terminal, iTerm2, Windows Terminal)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ADDD - Advanced Domain DNS Daemon v2.0
/etc/hosts management tool for pentesting
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
USAGE:
./addd.sh <IP> <domain> [domain2] [domain3] ... # Add domain(s) to IP
./addd.sh -l | --list # List all custom entries
./addd.sh -s | --search <domain> # Search for a domain
./addd.sh -r | --remove <domain> # Remove a specific domain
./addd.sh -c | --clean # Remove all custom entries
./addd.sh -e | --edit <domain> <new_ip> # Edit domain's IP
./addd.sh -h | --help # Show this help
Contributions are welcome! Feel free to:
- π Report bugs
- π‘ Suggest new features
- π§ Submit pull requests
- π Improve documentation
# Fork and clone the repo
git clone https://github.com/yourusername/addd.git
cd addd
# Make your changes
# Test thoroughly with different scenarios
# Submit a PRThis project is licensed under the MIT License - see the repository for details.
4ndyMcFly
- π Website: hackingepico.com
- πΌ LinkedIn: andres-lorente
- π GitHub: @4ndymcfly
- π― HackTheBox: Profile
- Inspired by the needs of the pentesting and CTF community
- Built for efficiency during HackTheBox, TryHackMe, and CTF challenges
- Thanks to all contributors and users providing feedback
β If you find this tool useful, please consider giving it a star! β
Made with β€οΈ for the pentesting community