-
Notifications
You must be signed in to change notification settings - Fork 0
/
afraid6.tcl
38 lines (31 loc) · 1.62 KB
/
afraid6.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# afraid6.tcl
# Updates your dynamic AAAA record in freedns.afraid.org.
# Should work with any decent DDNS provider that supports quad-A with very few code changes.
# Tested on Embedded Event Manager Version 3.00 (Cisco IOS 12.4(24)T8)
::cisco::eem::event_register_none maxrun 15 queue_priority low nice 0
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
# -- Set vars here --
# You can use short interface names (Fa0, Gi0/1, Di0) for $int
set int "Dialer0"
# Also update the set url "" statement a few lines below with your own base64 string
action_syslog msg "Looking for this router's global unicast IPv6 address..."
# Open CLI
if [catch {cli_open} result] {error $result $errorInfo} else {array set cli $result}
# Enable
if [catch {cli_exec $cli(fd) "enable"} result] {error $result $errorInfo}
# Run show ipv6 interface X
if [catch {cli_exec $cli(fd) "show ipv6 interface $int"} result] {error $result $errorInfo} else {set clioutput $result}
regexp {Global unicast.*subnet{1}} $clioutput x
regexp {(([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{1,4})} $x v6addr
action_syslog msg "Global unicast v6 is: $v6addr ($int)"
# Your "secret" update URL. Replace "YOUR_BASE64_SECRET==".
set url "http://freedns.afraid.org/dynamic/update.php?YOUR_BASE64_SECRET==&address=$v6addr"
action_syslog msg "Updating AAAA record on freedns.afraid.org..."
puts $url
if {[catch {http::geturl $url -queryblocksize 50 -type "text/plain" } token]} {
action_syslog msg "DDNS update failed. Can't get to URL. Maybe ip domain-lookup is turned off?"
} else {
action_syslog msg "freedns.afraid.org DDNS response: [http::data $token]"
}
exit 0