/getip - Local info

By Lindrian on Sep 16, 2007

I made this script for my own purpose, which was to update my Host menually, since sometimes MIRC's fails.
Simply paste into remotes and it does whats needed.

It doesnt include any error checking, non mayor one atleast, so be sure to use it correctly or add error checking yourself!

on *:sockopen:getip:{
  if ($sockerr) { echo -s Could not get your external IP address. }
  else {
    sockwrite -n $sockname GET / HTTP/1.1
    sockwrite -n $sockname Host: www.whatsmyipaddress.com
    sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8)
    sockwrite -n $sockname
  }
}
on *:sockread:getip: {
  if ($sockerr) { echo -s Could not get your external IP address. }
  else {
    var %r
    sockread -f %r
    if ($regex($sockname,%r,/<title>Your IP (.+)</title>/gi)) {
      set %getip.do $iif($regml(getip,2),$v1,$iif($host,$host,$me)) $gettok($regml(getip,1),3,32)
      var %x = $gettok($regml(getip,1),3,32)
      echo -s External IP updated: $iif($host,%x $+ / $+ $v1,%x)
      scon -a getip.do
      sockclose $sockname
    }
  }
}
alias -l nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  return $remove(%x,&nbsp;,$chr(9))
}
alias getip.do { .localinfo %getip.do }
alias getip { sockopen getip www.whatsmyipaddress.com 80 }
raw 001:*: .signal -n connect
on *:SIGNAL:connect: getip

Comments

Sign in to comment.
Lindrian   -  Nov 22, 2007

You use this to update your local info, for a more accurate version. mIRC\'s sometimes fail.

 Respond  
Korvin   -  Nov 22, 2007

lool, this is a good idea and good job, but needs updating, because mozilla isnt the #1 browser yet. i dont think this is really usefull tho, i dont know why i would use this

 Respond  
brinxy   -  Nov 22, 2007

Nice job. I\'d just make it compatible with IE.

 Respond  
Lindrian   -  Nov 22, 2007

No one acually had any use for this?

 Respond  
Lindrian   -  Sep 17, 2007

Time to Change to firefox then I guess ;).

 Respond  
kerstt   -  Sep 16, 2007

you\'ll get loads of guys saying it wont work cause they use IE

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.