Code: Select all
#!/usr/bin/tclsh
##################################
# create file domain.txt
# file should look like this without the '#' :
##################################
#<id> <host>
##################################
#{0000000} {domain.tld}
#{0000000} {domain.tld}
##################################
set username "<username>"
set password "<password>"
package require base64
set crypt [base64::encode $username:$password]
proc ipupdater {crypt ipaddr} {
set rf [open domain.txt r]
foreach x [split [read $rf] \n] {
if {![string equal {} [lindex $x 1]]} {
if {![catch {socket dynamic.zoneedit.com 80} s]} {
puts $s "GET /auth/dynamic.html?host=[lindex $x 1]&dnsto=$ipaddr&id=[lindex $x 0] HTTP/1.1"
puts $s "Host: dynamic.zoneedit.com"
puts $s "User-Agent: ipupdater"
puts $s "Authorization: Basic $crypt"
puts $s "\n\r\n\r"
puts "WEB <-- GET /auth/dynamic.html?host=[lindex $x 1]&dnsto=$ipaddr&id=[lindex $x 0] HTTP/1.1"
puts "WEB <-- Host: dynamic.zoneedit.com"
puts "WEB <-- User-Agent: ipupdater"
puts "WEB <-- Keep-Alive: 300"
puts "WEB <-- Authorization: Basic $crypt"
puts "WEB <-- <crlf><crlf>"
flush $s
while {![eof $s]} {
gets $s x
regsub -all {<(.|\n)*?>} $x {} x
if {![string equal {} $x]} {
puts "WEB --> $x"
}
}
close $s
}
}
}
close $rf
}
ipupdater $crypt $argv