All pastes #23579 Raw Edit

Untitled

public text v1 · immutable
#23579 ·published 2005-09-22 03:32 UTC
rendered paste body
; WhatIsMyWanIp v1.0 - By Ñãzã®78 (MetalasiA) @ www.malayX.Tech.nu
;
; A simple mIRC socket trick to find out your current WAN IP numeric address
; Works like a charm if you're on or even not on NICs/NATs/Routers/BNCs
; End your DCC SEND/CHAT failures just because mIRC can't find your external ip
; Just place`em on your mIRC root directory & type: /load -rs whatismywanip.mrc
; No configurations needed, auto detection everytime you connects to a server/bnc
;
; Notes: You still have to open/foward ports on your router for DCCs
; I've been using this snippet for personal use and found it very useful
; especially for servers thus sharing it with you guys.
; Distribute`em freely but please "AS IT IS" I hate rippers, be original :P
;
; Cheers, Ñãzã®78 (MetalasiA)..._\m/

on *:sockopen:whatismywanip: {
  if ($sockerr) echo 4 -est [WhatIsMyWanIp v1.0] Ops, an error has occured! You might not be connected or the service is down? " $+ $sock($sockname).wsmsg $+ "...\m/
  else {
    echo 4 -est [WhatIsMyWanIp v1.0] Tryin` to find $me $+ 's new WAN IP if there's any...\m/
    sockwrite -n $sockname GET / HTTP/1.0 $+ $crlf $+ $crlf
  }
}

on *:sockread:whatismywanip: {
  if ($sockerr) echo 4 -est [WhatIsMyWanIp v1.0] Ops, an error has occured! You might not be connected or the service is down? " $+ $sock($sockname).wsmsg $+ "...\m/
  else {
    var %tmp
    sockread %tmp
    if ($regex(%tmp,/^.+Current\sIP\sAddress\:\s(.+\d).+/sig)) {
      if ($regml(1) != $ip) {
        echo 4 -est [WhatIsMyWanIp v1.0] Found a new WAN IP " $+ $regml(1) $+ "! Registerin` to mIRC's Localinfo...\m/
        localinfo $iif($host,$ifmatch,LOCALHOST) $regml(1)
      }
      else echo 4 -est [WhatIsMyWanIp v1.0] No new WAN IP found $+ $iif($ip,$chr(44) stickin` to " $+ $ip $+ ") $+ ...\m/
    }
  }
}

alias -l whatismywanip if ($sock(whatismywanip)) sockclose whatismywanip | var %tmp = 28VAE8VMI<"YD>6YD;G,N;W)G```` | sockopen whatismywanip $decode(%tmp) 8245

raw 001:*:return $whatismywanip

on *:start:echo 4 -est [WhatIsMyWanIp v1.0] WhatIsMyWanIp v1.0 - By Ñãzã®78 (MetalasiA) @ www.malayX.Tech.nu ...\m/ | return $whatismywanip