Skip to content

Instantly share code, notes, and snippets.



Last active Sep 30, 2020
What would you like to do?
CDMon dynamic DNS IP update script
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python script to update CDMon dynamic DNS
# @author = @jovimon
# @version = 0.1.20200930
# Prerequisites: sudo pip install requests / sudo apt install python-requests
# Based on:
# You can find the last version on:
# Updated to python 3 as per the comments to the gist.
import requests
import hashlib
import datetime
user = 'example-user'
password = 'example-password'
# If you want, you can change how you obtain your external IP address.
# newip must contain just the IP without anything else, even spaces or newlines.
newip = requests.get('').text
# newip = requests.get('').text
# Obtain current date and time
curr_date ="%Y-%m-%d %H:%M:%S")
# Obtain password digest that will be used in the update request
pw_digest = hashlib.md5(bytes(password,"ascii")).hexdigest()
# Build the update URL
url = "" % (user, pw_digest, newip)
# Make the update request
r = requests.get(url)
# Check if everything went fine. If not, show the error.
if r.text.find('customok') < 0:
print("%s - Update error!\nResponse received: %s\nCheck cdmon KB for problems." % (curr_date, r.text))
print("%s - Update successful!" % curr_date)

This comment has been minimized.

Copy link

@otakuryo otakuryo commented Sep 27, 2020

Need fix:
import md5 -> import hashlib
pw_digest = -> pw_digest = hashlib.md5(bytes(password,"ascii")).hexdigest()
print "..."-> print ("...")


This comment has been minimized.

Copy link
Owner Author

@jovimon jovimon commented Sep 30, 2020

Thanks @otakuryo, I updated the gist to python 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.