Watchtower is an automated subdomain reconnaissance tool designed to discover, scan, and monitor subdomains for changes.
It notifies you via Telegram and Discord when new subdomains are discovered or existing ones are updated.
- Multi-source subdomain enumeration (crt.sh, RapidDNS, Chaos, Subfinder, WebArchive, Shodan, GitHub Subdomains, etc.)
- DNS resolution via
massdnsand bruteforce DNS discovery withPureDNS - Live subdomain discovery using
dnsxandhttpx - Technology detection, status code checking, and title grabbing
- MongoDB storage for subdomains and change tracking
- BruteForce subdomain detection flagging and notifications
- Telegram & Discord notifications (message + CSV if too large)
- Multi-threading for faster scans
- YAML-based target management
- Advanced filters to query MongoDB results (status, title, tech, URL, bruteforce flag)
- CSV export for large scan results and notifications
- GitHub Subdomain discovery using
github-subdomains
watchtower/
├── cli/ # CLI argument handler
├── config/ # Configuration files (resolvers, settings)
├── core/ # Core logic (scanner, fetchers, mongo, processor)
├── utils/ # Logging & utility functions
├── data/ # Target YAML files directory
├── main.py # Main entry point
├── requirements.txt # Python dependencies
└── Dockerfile # Optional Docker support
requests
pymongo
PyYAML
colorama
tldextract
dnsgen
| Tool | Install Command |
|---|---|
| subfinder | go install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest |
| chaos | go install github.com/projectdiscovery/chaos-client/cmd/chaos@latest |
| dnsx | go install github.com/projectdiscovery/dnsx/cmd/dnsx@latest |
| httpx | go install github.com/projectdiscovery/httpx/cmd/httpx@latest |
| massdns | git clone https://github.com/blechschmidt/massdns.git && cd massdns && make && cp bin/massdns /usr/local/bin |
| shosubgo | go install github.com/incogbyte/shosubgo@latest |
| puredns | go install github.com/d3mondev/puredns@latest |
| github-subdomains | go install github.com/gwen001/github-subdomains@latest |
-
Clone the repository
git clone https://github.com/yourusername/watchtower.git cd watchtower -
Install Python dependencies
pip install -r requirements.txt
-
Create an alias to run Watchtower easily Add this function to your
~/.bashrcor~/.zshrc:watchtower() { python3 /app/main.py "$@" }
-
Reload your shell config
source ~/.bashrc
docker build -t watchtower .docker run --rm watchtower -u example.com --threads 10docker run --rm -v $(pwd)/data:/app/data watchtower --targets-file data/targets.yaml --threads 10targets:
- name: company1
domains:
- example.com
- example.org
- name: company2
domains:
- test.comMONGO_URI = "mongodb://admin:password@localhost:27017/admin?authSource=admin"
TELEGRAM_BOT_TOKEN = "your_bot_token"
TELEGRAM_CHAT_ID = "your_chat_id"
DISCORD_WEBHOOK_URL = "your_discord_webhook_url"
RESOLVER_PATH = "config/resolver.txt"
THREADS = 5
SHODAN_API_KEY = "your_shodan_api_key"
CHAOS_API_KEY = "your_chaos_api_key"
GITHUB_TOKEN = "your_github_token"
WORDLIST_PATH = "data/wordlist.txt"Watchtower uses MongoDB to store and track discovered subdomains and scan results over time.
sudo apt update
sudo apt install -y mongodb
sudo systemctl enable mongodb
sudo systemctl start mongodbmongouse admin
db.createUser({
user: "admin",
pwd: "yourStrongPassword",
roles: [{ role: "userAdminAnyDatabase", db: "admin" }]
})In the config/settings.py file, set your MongoDB connection:
MONGO_URI = "mongodb://admin:yourStrongPassword@localhost:27017/admin?authSource=admin"For each company (defined in targets.yaml), Watchtower creates a separate MongoDB database named <company>_db.
Inside each database, it stores subdomain scan results in the httpx_results collection.
Document example stored in MongoDB:
{
"url": "https://subdomain.example.com",
"status": "200",
"title": "Example Title",
"tech": ["nginx", "php"],
"bruteforce": true,
"created_at": "2024-03-12T09:00:00"
}watchtower -u example.comwatchtower --targets-file data/targets.yaml --threads 10watchtower --show-httpx company1watchtower --show-httpx company1 --status 200 --title adminwatchtower --show-httpx company1 --dns-check truewatchtower --show-new company1watchtower --show-new company1 --status 200 --dns-check truewatchtower --show-updates company1 --dns-check truewatchtower --update- First-time scan summaries
- New subdomains discovered
- Subdomain status/title/tech changes
- DNS BruteForce discovered subdomains with specific status codes (200, 403, 404)
- CSV file attachment when results are large
- Same as Telegram but via Discord webhook
- Open Telegram and search for
@BotFather - Send
/startand then/newbot - Give it a name and username (e.g.,
watchtower_bot) - Copy the provided Bot Token
- Create a Telegram group or use an existing one
- Add your bot as a member of the group
- Make sure the bot has permission to send messages
- Forward any message from the group to
@userinfobotor use this tool - Note the chat ID, usually starts with
-100
TELEGRAM_BOT_TOKEN = "your_bot_token"
TELEGRAM_CHAT_ID = "-1001234567890"Made with ❤️ by MohammadHossein Mohit