Skip to content

Instantly share code, notes, and snippets.

@mjtiempo
Created November 11, 2022 23:10
Show Gist options
  • Save mjtiempo/abfe5914e3c2742e59faecf75498636f to your computer and use it in GitHub Desktop.
Save mjtiempo/abfe5914e3c2742e59faecf75498636f to your computer and use it in GitHub Desktop.
script to update your IPV6 address in DynV6.com
import requests
import socket
URL='http://dynv6.com/api/update'
HOSTNAME='your_dynv6_hostname'
TOKEN='your_dyn_v6_token'
'''
You can use Task scheduler to run this on windows and cron on linux
'''
def update_dynv6(url=URL, hostname=HOSTNAME, token=TOKEN):
# socket.getaddrinfo(socket.gethostname(), None, socket.AF_INET6) will get all your active interface mine here is [2]
ipv6=socket.getaddrinfo(socket.gethostname(), None, socket.AF_INET6)[2][4][0]
payload = {
'hostname': hostname,
'token': token,
'ipv6': ipv6
}
r = requests.get(url, params=payload)
return r.text
if __name__ == "__main__":
print(update_dynv6())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment