Last active
November 16, 2017 19:34
-
-
Save Hornet-C/bd940bba3802d3c7a05129188222ab46 to your computer and use it in GitHub Desktop.
Update script for dynv6.com to set your IPv4 address and IPv6 prefix. works with only one devices MAC-adress. Use it as cronjob to automate updates.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mydnv6token = "auth-token" | |
mydnv6hostname = "username.dynv6.net" | |
' MAC adress of desired device | |
searchingFor = "20:CF:30:09:F3:80" | |
Dim myIP4Address : myIP4Address = "" | |
Dim myIP6Address : myIP6Address = "" | |
Dim objWMIService : Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") | |
Dim colAdapters : Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True") | |
Dim objAdapter | |
For Each objAdapter in colAdapters | |
If StrComp(objAdapter.MACAddress,searchingFor,1)=0 and Not IsNull(objAdapter.IPAddress) Then myIP4Address = trim(objAdapter.IPAddress(0)) : myIP6Address = trim(objAdapter.IPAddress(3)) | |
Next | |
' testing stuff | |
'Wscript.echo "My IP4Address is " & myIP4Address | |
'Wscript.echo "My IP6Address is " & myIP6Address | |
'Wscript.echo "http://ipv4.dynv6.com/api/update?hostname=" & mydnv6hostname & "&ipv4=" & myIP4Address & "&token=" & mydnv6token | |
dim xHttp: Set xHttp = createobject("MSXML2.ServerXMLHTTP") | |
xHttp.Open "GET", "http://ipv4.dynv6.com/api/update?hostname=" & mydnv6hostname & "&ipv4=" & myIP4Address & "&token=" & mydnv6token, False | |
' 2 stands for SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS | |
' 13056 means ignore all server side cert error | |
xHttp.setOption 2, 13056 | |
xHttp.Send | |
xHttp.Open "GET", "http://dynv6.com/api/update?hostname=" & mydnv6hostname & "&ipv6=" & myIP6Address & "&token=" & mydnv6token, False | |
xHttp.setOption 2, 13056 | |
xHttp.Send |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment