# IP Address Change Notifier ========================== This script is designed to monitor and notify when the public IP address of a device changes. It uses various notification methods, including email, Telegram, and Nextcloud Talk. ## Configuration --- The script relies on a configuration file named `config.ini` to store settings. The file should be in the same directory as the script. ### General Settings * `check_interval`: The interval in seconds between IP checks (default: 300) * `notify_methods`: A comma-separated list of notification methods (default: email) * `last_ip_file`: The file to store the last known IP address (default: last_ip.txt) ### Email Settings * `from`: The sender's email address * `to`: The recipient's email address * `server`: The SMTP server address * `port`: The SMTP server port (default: 465) * `user`: The SMTP username * `pass`: The SMTP password ### Telegram Settings * `bot_token`: The Telegram bot token * `chat_id`: The Telegram chat ID ### Nextcloud Talk Settings * `url`: The Nextcloud URL * `token`: The Nextcloud token * `room`: The Nextcloud room ID ## How it Works --- 1. The script loads the configuration from `config.ini`. 2. It checks the public IP address using the `get_public_ip` function. 3. If the IP address has changed, it sends a notification using the specified methods. 4. The last known IP address is stored in the `last_ip_file`. ## Notification Methods --- The script supports the following notification methods: * Email: Sends an email using the specified SMTP server and credentials. * Telegram: Sends a message using the Telegram bot token and chat ID. * Nextcloud Talk: Sends a message using the Nextcloud URL, token, and room ID. ## Running the Script --- To run the script, simply execute it using Python: ```bash python ip_notifier.py ``` Note: Make sure to replace `ip_notifier.py` with the actual script name. ## Troubleshooting --- If you encounter any issues, check the script's output for error messages. Ensure that the configuration file is correct and that the notification methods are properly set up.