A Python utility to monitor domain DNS A records and send notifications when IP addresses change. Supports email and Telegram notifications.
- DNS Monitoring: Continuously monitors a domain's A record (IPv4 address)
- Change Detection: Automatically detects when a domain's IP address changes
- Email Notifications: Send alerts via SMTP email
- Telegram Notifications: Send alerts via Telegram bot API
- IP History: Stores the last known IP address locally
- Python 3.x
dnspython: For DNS resolutionrequests: For Telegram API calls
- Clone the repository:
git clone https://github.com/dtsypkin/DNS-Check.git
cd DNS-Check- Install dependencies:
pip install dnspython requestsEdit dns_check.py and set the following variables:
NOTIFICATION_METHOD: Choose'email'or'telegram'DOMAIN_TO_MONITOR: The domain to monitor (e.g.,example.com)
RECIPIENT_EMAIL: Email address to receive notificationsSENDER_EMAIL: Email address sending notificationsSMTP_SERVER: SMTP server address (e.g.,smtp.gmail.com)SMTP_PORT: SMTP port (default: 587)SMTP_PASSWORD: Password for the sender's email account
TELEGRAM_BOT_TOKEN: Your Telegram bot tokenTELEGRAM_CHAT_ID: Your Telegram chat ID
Run the script:
python dns_check.pyFor continuous monitoring, set up a cron job (Linux/Mac) or Task Scheduler (Windows):
0 * * * * cd /path/to/DNS-Check-1 && python dns_check.py- Resolves the DNS A record for the specified domain
- Compares the current IP with the previously stored IP (in
last_ip.txt) - If different, sends a notification with the old and new IP addresses
- Updates the stored IP address
last_ip.txt: Stores the last known IP address of the monitored domain
MIT License
For issues or questions, please create an issue on GitHub.