This is a script to update your ip address for your no-ip.com host(s).
I designed this to help people with dynamic ip's keep their no-ip hostnames linked to there current ip. This way you can keep their hostname pointed at the correct ip for serving pages or w/e.
This does NOT update your no-ip account if there is no ip change.
I would have included this feature , but such automation is against no-ip's TOS. If you just want to update your account for the purpose of avoiding EXPIRATION, just use the script to change your ip and quickly change it back.
If you want to use this script you will need a no-ip account. You can sign up here -->> https://www.no-ip.com/newUser.php - Write down your username and password (you will need it for this script)
Once you are logged in to your account just click Hosts/Redirects (top left) and then add a host.
Now:: Assuming you have a no-ip account:
Deep thoughts :P:
I used WhatIsMyIp.com for the ip retrieval. $ip is an obvious solution but it, quite often, has incorrect information during connection. It usually has the old ip address but sometimes it has the router/nat address or local information.
Additionally, I realize that the ip address is optional when updating no-ip via api but I feel it is better to check for changes as opposed to testing the sites tolerance of redundancy.
Hidden Features:
/WhatIsMyIp
Will echo back your current ip address from the api at http://www.whatismyip.com/
Edited Now tests clean on mIRC 7
Thanks to jaytea for his infinite knowledge of mIRC's scripting engine. Compatible mime encoding of unicode characters on mIRC 7 would not be done without his help.
;no-ip Updater by Ford_Lawnmower irc.Geekshed.net #Script-Help
menu channel,status,menubar {
.no-ipUpdate:dialog $iif(!$dialog(no-ip),-m no-ip,-v) no-ip
}
alias -l no-ipUpdate {
var %host $1, %ip $2
Getno-ipUpdate echo -st %host %ip $gettok($hget(no-ipUpdate,%host),2,32)
}
;Getno-ipUpdate send method host ip $encode_(user:pass,m)
alias -l Getno-ipUpdate {
if ($gettok($hget(no-ipUpdate,$3),4,32) != $4) {
var %sockname $+(no-ipUpdate,$network,$2,$ticks,$r(1,1000))
sockopen %sockname dynupdate.no-ip.com 80
sockmark %sockname $1-2 $+(/nic/update?hostname=,$3,&myip=,$4) $5 $3 $4
}
else $iif($dialog(no-ip),no-ipError $v1,echo -st) no-ip already up to date for $3
}
On *:sockopen:no-ipUpdate*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: $sock($sockname).addr
sockwrite -nt $sockname Authorization: Basic $gettok($sock($sockname).mark,4,32)
sockwrite -n $sockname User-Agent: mIRC no-ip Update/1.0 blackjackketcham@yahoo.com
sockwrite -n $sockname $crlf
}
else { sockclose $sockname | return }
}
On *:sockread:no-ipUpdate*: {
if ($sockerr) { sockclose $sockname | return }
else {
var %no-ipUpdate | sockread %no-ipUpdate
if (HTTP/1.1 200 OK isin %no-ipUpdate) {
tokenize 32 $sock($sockname).mark
$iif($dialog(no-ip),no-ipError $v1,$1-2) $5 Updated to $6
if ($hget(no-ipUpdate,$5)) hadd no-ipUpdate $5 $puttok($puttok($v1,$6,1,32),$6,4,32)
}
elseif (HTTP/1.1 401 isin %no-ipUpdate) {
$iif($dialog(no-ip),no-ipError $v1,$gettok($sock($sockname).mark,1-2,32)) Error: $nopath($script) %no-ipUpdate
}
elseif (Connection: close isin %no-ipUpdate) { sockclose $sockname | return }
}
}
On *:connect: { if ($hget(no-ipUpdate,0).item) no-ipUpdateAll }
On *:start: {
hmake no-ipUpdate 5
if ($exists(no-ipUpdate.hsh)) hload no-ipUpdate no-ipUpdate.hsh
}
On *:unload: { if ($hget(no-ipUpdate)) hfree $v1 }
alias -l no-ipUpdateAll {
if (!$timerno-ipUpdateAll) {
.timerno-ipUpdateAll 1 10 .noop
var %numhosts $hget(no-ipUpdate,0).item, %count 1
while (%numhosts >= %count) {
if ($gettok($hget(no-ipUpdate,%count).data,3,32)) .timer 1 $calc(%count * 3) GetWhatIsMyIp no-ipUpdate $hget(no-ipUpdate,%count).item
inc %count
}
}
}
alias -l WIMIPno-ipcheck GetWhatIsMyIP no-ipUpdate $1
alias WhatIsMyIP GetWhatIsMyIP echo -a
alias -l GetWhatIsMyIP {
var %sockname $+(WhatIsMyIP,$network,$2,$ticks)
sockopen %sockname www.whatismyip.com 80
sockmark %sockname $1-2 /automation/n09230945NL.asp
}
On *:sockopen:WhatIsMyIP*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: www.whatismyip.com
sockwrite -n $sockname $crlf
}
else { sockclose $sockname | return }
}
On *:sockread:WhatIsMyIP*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %WhatIsMyIP | sockread %WhatIsMyIP
if ($regex(%WhatIsMyIP,/([\d]{1,}\.[\d]{1,}\.[\d]{1,}\.[\d]{1,})/)) {
$iif($dialog(no-ip),did -ra $v1 4,$gettok($sock($sockname).mark,1-2,32)) $regml(1)
}
}
}
On *:dialog:no-ip:init,Sclick:*: {
if ($devent == init) no-ipInit $dname
elseif ($devent == Sclick) {
if ($did == 1) no-ipFillInfo $dname $did(1)
elseif ($count($did,11,13,14)) {
no-ipSaveData $dname
.timer 1 2 no-ipInit $dname
}
elseif ($did == 12) {
if ($hget(no-ipUpdate,$did(1))) {
if ($input(Are you sure you want to delete $did(1),yn,no-ipUpdate)) {
no-ipError $dname Deleting $did(1)
hdel no-ipUpdate $did(1)
.timer 1 2 no-ipInit $dname
}
}
else no-ipError $dname $did(1) does not exist in my database!
}
}
}
alias -l no-ipInit {
if ($hget(no-ipUpdate,0).item) {
didtok -ra $1 1 32 $regsubex($str(.,$v1),/(.)/g,$+($chr(32),$hget(no-ipUpdate,\n).item))
if (!$did($1,1).sel) did -c $1 1 1
no-ipFillInfo $1 $did($1,1)
}
else WhatIsMyIp
}
alias -l no-ipFillInfo {
if ($hget(no-ipUpdate,$2)) {
var %dname $1
tokenize 32 $hget(no-ipUpdate,$2)
did -ra %dname 2 $gettok($decode_($2,m),1,58)
did -ra %dname 3 $gettok($decode_($2,m),2,58)
did -raf %dname 4 $1
did $+(-,$iif($3,c,u)) %dname 5
}
}
alias -l no-ipSaveData {
if ($numtok($did($1,1) $did($1,2) $did($1,3),32) != 3) no-ipError $1 Please fill in all the boxes!
elseif (!$did($1,4)) {
no-ipError $1 Getting your ip Address. Click $+(",$did($1,$did),") when I am finished.
WhatIsMyIp
}
elseif ($did == 13) Getno-ipUpdate no-ipError $1 $did(1) $did(4) $encode_($+($did(2),:,$did(3)),m)
else {
hadd -m no-ipUpdate $did($1,1) $did($1,4) $encode_($+($did($1,2),:,$did($1,3)),m) $did($1,5).state 0
hsave no-ipUpdate no-ipUpdate.hsh
no-ipError $1 Saving $did($1,1)
}
}
alias -l no-ipError {
did -ra $1 10 $2-
.timerno-ipError 1 5 did -r $1 10
}
alias -l encode_ {
if ($version >= 7) {
bset -c &a 1 $regsubex($1, /(*UTF8)(.)/gs, $asc(\1) $chr(32))
noop $encode(&a, mb)
return $bvar(&a, 1-).text
}
else return $encode($1,m)
}
alias -l decode_ {
if ($version >= 7) {
bset -c &a 1 $regsubex($1, /(*UTF8)(.)/gs, $asc(\1) $chr(32))
noop $decode(&a, mb)
return $bvar(&a, 1-).text
}
else return $decode($1,m)
}
dialog -l no-ip {
title "no-ip Update"
size -1 -1 234 106
option dbu
combo 1, 7 20 216 11, edit drop
edit "", 2, 28 41 84 10, pass autohs
edit "", 3, 138 41 85 10, pass autohs
edit "", 4, 28 56 79 10, autohs
check "Update on Connect", 5, 139 58 60 10
text "Hosts:", 6, 7 10 25 8
text "User:", 7, 5 42 22 8, right
text "Pass:", 8, 114 42 23 8, right
text "IP:", 9, 5 57 22 8, right
text "", 10, 2 71 229 8
button "Add", 11, 51 89 37 12
button "Delete", 12, 96 89 37 12
button "Update Now", 13, 142 89 37 12
button "Save", 14, 187 89 37 12
}
@Teen You can try deleting it but the script may stop working at some point.
To use no-ip's api you must be accountable for your project.
Look here -->> https://www.no-ip.com/integrate/request
Quote from the api instructions::
Important: Setting the Agent
When making an update it is important that your http request include an HTTP User-Agent to help No-IP identify different clients that access the system. Clients that do not supply a User-Agent risk being blocked from the system.
Your user agent should be in the following format
User-Agent: NameOfUpdateProgram/VersionNumber maintainercontact@domain.com
For example:
User-Agent: Bobs Update Client WindowsXP/1.2 bob@somedomain.com
Thanks for the comment and score Teen :)