Hurricane Electric's IPv6 Tunnel Broker Forums

Advanced search  

News:

Welcome to Hurricane Electric's Tunnelbroker.net forums!

Author Topic: Dynamic source IP address updater  (Read 3617 times)

HQuest

  • Newbie
  • *
  • Posts: 11
Dynamic source IP address updater
« on: July 02, 2011, 12:39:16 PM »

This script was created to update tunnel IP address on TunnelBroker website.

My tunnel endpoint is an Apple Airport Extreme Base Station router. As I have a dynamic IP address (which, believe me, changes a lot daily), and as I have no way of adding a custom process right into this device, the below script works for me.

Script is pure VBS, developed, tested and working on W7. Did not tried on previous Windows versions, but it may work as well.

You may need to add site's certificate on Trusted Root Certificates Authority store, to avoid a warning every time script is run -- reason: HTTPS certificate issued to tunnelbroker.net, destination is ipv4.tunnelbroker.net, so IE complains about it.

Finally, you can safely add it to run under Scheduled Tasks. Just be sure you don't schedule the task for much frequent updates or you may end up booted by HE's servers.

Last but not least, there may be improvements to the below code. I hate programming, and I am not a good fan of Windows OS, but that's the preferred OS for most of the games I love playing while I'm at home. I can do magic on bash, but on VBS, the results surprised even myself!

Code: [Select]
' According to HE/TunnelBroker, this is the URL you should use to
' auto update your IPv6 tunnel address
URL = "https://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=$IPV4ADDR&pass=$MD5PASS&user_id=$USERID&tunnel_id=$GTUNID"
' Tunnel ID can be found at your tunnel details page
GTUNID = "00000"
' UserID can be found at your Tunnel Broker main page
USERID = "0123456789abcdef0123456789abcdef"
' Password should be MD5 hashed, but VBScript does not provide
' native MD5 functions. Fortunately, there are lots of online MD5
' hash calculators.
MD5PASS = "FEDCBA9876543210FEDCBA98756543210"
' Even if you have a static IP address, I suggest use of "AUTO"
IPV4ADDR = "AUTO"
'
' You should not change anything below this point
' =================================================================

Set WshShell = WScript.CreateObject("WScript.Shell")
Set http = WScript.CreateObject("Microsoft.XmlHttp")

URL = Replace (URL, "$IPV4ADDR", IPV4ADDR)
URL = Replace (URL, "$MD5PASS", MD5PASS)
URL = Replace (URL, "$USERID", USERID)
URL = Replace (URL, "$GTUNID", GTUNID)
' If you want to double check what is going to be send,
' uncomment the next following line:
' WScript.Echo URL
http.open "GET", URL, False
http.send ""
' Uncomment the following next line if you want to see
' what Tunnel Broker sent to us after update request
' WScript.Echo http.responseText
Set http = nothing
Set WshShell = nothing
« Last Edit: July 02, 2011, 12:40:50 PM by HQuest »
Logged