mIRC Homepage

local info shows wrong ip address

Posted By: bwuser

local info shows wrong ip address - 27/07/10 10:30 AM

Hi!

Under connect -> local info my IP Address is always showing my internal lan ip. No matter which options I choose, local host / ip adress / normal / server. It's always the same.

I am behind a normal nat adsl router and I need my external ip adress (whatismyipadress.com) in this field.

How can I accomplish that?

Thanks!
Posted By: Collective

Re: local info shows wrong ip address - 27/07/10 10:45 AM

Did you reconnect to IRC after changing Lookup Method to Server? mIRC only updates its Local Info when it connects unless you trigger an update manually with /localinfo.
Posted By: 5618

Re: local info shows wrong ip address - 27/07/10 10:46 AM

If you need it for the DCC protocol:
Options > Connect > Options > Advanced
Posted By: bwuser

Re: local info shows wrong ip address - 27/07/10 01:01 PM

Originally Posted By: Collective
Did you reconnect to IRC after changing Lookup Method to Server? mIRC only updates its Local Info when it connects unless you trigger an update manually with /localinfo.

I always used /localinfo.

Worth to mention maybe additionally: I am connected through a bouncer. (But I am sure it shows internal lan ip's, not the bouncer's ip.)
Posted By: Horstl

Re: local info shows wrong ip address - 27/07/10 01:49 PM

I found this small script made for a friend of mine with similar BNC issues some time ago... might be of help although it does not solve the /localinfo issue, but merely works arround it.
Code:
; allows to set mIRC's 'local info' to your "true" external IP regardless of network setup
; by Horstl with help from deegee :)

on *:connect: { getip }

alias -l getip {
  if ($sock(getip)) { sockclose getip } 
  sockopen getip www.whatismyip.com 80
  sockmark getip $1
}

on *:sockopen:getip:{
  if ($sockerr) { echo -s * Cannot resolve your ip: $sock(getip).wsmsg | return }
  sockwrite getip GET $+(/automation/n09230945.asp HTTP/1.0,$lf,HOST: whatismyip.com,$str($lf,2))
}

on *:sockread:getip:{
  sockread -f &a
  set -e %external.ip $gettok($bvar(&a,1-).text,-1,10)
  if (($group(#set.ip.auto) == on) || ($sock($sockname).mark)) {
    echo -snc info * Resolved external IP: %external.ip (set at 'local info')
    localinfo $host %external.ip
  }
}

#set.ip.auto off
#set.ip.auto end

menu status {
  Set 'local info' to external IP $+([,auto,$chr(58) $replace($group(#set.ip.auto).status,on,enabled,off,disabled),])
  .$iif(($group(#set.ip.auto) == on),$style(1)) Auto on connect
  ..$iif(($group(#set.ip.auto) == on),disable,enable) automation : $iif(($group(#set.ip.auto) == on),.disable,.enable) #set.ip.auto
  .&Set 'local info' to ext. IP now : { getip verbose }
  .-
  .&Reset 'local info'
  ..&normal (winsock) lookup : localinfo -h
  ..$iif(($status != connected),$style(2)) &userhost (server) lookup: localinfo -u
  .-
  .Current ext. IP $+ $chr(58) $iif((%external.ip),$v1,not resolved yet) : noop
}

Posted By: bwuser

Re: local info shows wrong ip address - 26/09/10 03:22 AM

The script is great.

Unfortunately whatismyip.com changed something on their site, so it's no longer working. Can you update it please?

Or is there a more suitable service for this kind of information? A website which is made for automatic requests (the script)?
Posted By: Horstl

Re: local info shows wrong ip address - 26/09/10 10:41 AM

Code:
on *:connect: { getip }

alias getip {
  if ($sock(getip)) { sockclose getip } 
  sockopen getip www.whatismyip.com 80
  sockmark getip $1
}

on *:sockopen:getip:{
  if ($sockerr) { echo -snc info * [GetIP] Cannot resolve your ip: $sock($sockname).wsmsg | return }
  sockwrite $sockname GET $+(/automation/n09230945.asp HTTP/1.0,$lf,HOST: $sock($sockname).addr,$str($lf,2))  
}

on *:sockread:getip:{
  sockread -f &a
  var %s = $gettok($bvar(&a,1-).text,-1,10), %r =  /^(?:\d{1,3}\.){3}\d{1,3}$/
  if (!$regex(%s,%r)) { echo -snc info * [GetIP] Error parsing socket reply: $bvar(&a,1-).text }
  else {
    set -e %external.ip %s
    if (($group(#set.ip.auto) == on) || ($sock($sockname).mark)) {
      .localinfo $host %s
      echo -snc info * [GetIP] Resolved external IP: %s (set at 'local info')
    }
  }
}

#set.ip.auto off
#set.ip.auto end

menu status {
  Set 'local info' to external IP $+([,auto,$chr(58) $replace($group(#set.ip.auto).status,on,enabled,off,disabled),])
  .$iif(($group(#set.ip.auto) == on),$style(1)) Auto on connect
  ..$iif(($group(#set.ip.auto) == on),disable,enable) automation : $iif(($group(#set.ip.auto) == on),.disable,.enable) #set.ip.auto
  .&Set 'local info' to ext. IP now : { getip verbose }
  .-
  .External IP $+ $chr(58) $iif((%external.ip),$v1,not resolved yet) : clipboard %external.ip
  .Local info IP $+ $chr(58) $ip : clipboard $ip
  .-
  .&Reset 'local info'
  ..&normal (winsock) lookup : localinfo -h
  ..$iif(($status != connected),$style(2)) &userhost (server) lookup: localinfo -u
}
Does this work for you?
Posted By: bwuser

Re: local info shows wrong ip address - 04/10/10 03:33 PM

Thank you very much for your effort!

I get the following.

Quote:

[17:30:22] * Error: adresses from #5on5.et not saved. (too many users)
* [GetIP] Error parsing socket reply: Date: Mon, 04 Oct 2010 15:30:19 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: http://nnscript.com
Cache-Control: private
Content-Length: 0

Seams to conflict with nnscript 3.81.

Can it be fixed or no way?
Posted By: Horstl

Re: local info shows wrong ip address - 05/10/10 12:03 PM

I'm not able to reproduce this. The socket reply you get is weird (i.e. the "location: nnscript" thing - yet I cannot think of how nnscript could interfere with the setting of &a in the sockread event). Does the error always contain "content-length: 0"? Does www.whatismyip.com/automation/n09230945.asp produce the correct IP in your browser? What mIRC version do you use?
Posted By: FroggieDaFrog

Re: local info shows wrong ip address - 05/10/10 02:57 PM

Code:
alias -l getip {
  if ($sock(getip)) { sockclose getip } 
  sockopen getip www.whatismyip.com 80
  sockmark getip $1
  echo $color(info).dd -s * [GetIP] Resolving your IP address...
}
on *:CONNECT:{ getip }

on *:sockopen:getip:{
  if ($sockerr) { 
    echo color(info).dd -s * [GetIP] Cannot resolve your ip: $sock($sockname).wsmsg 
  }
  else {
    var %s = sockwrite -n $sockname
    %s GET /automation/n09230945.asp HTTP/1.0
    %s Host: $sock($sockname).addr
    %s 
  }
}
on *:SOCKWRITE:GETIP:{
  If ($sockerr) {
    echo $color(info).dd -s * [GetIP] Cannot resolve your ip: $sock($sockname).wsmsg 
  }
}
on *:sockread:getip:{
  if ($sockerr) { 
    echo $color(info).dd -s * [GetIP] Cannot resolve your ip: $sock($sockname).wsmsg 
  }
  else {
    sockread -f &a
    var %s = $gettok($bvar(&a,1-).text,-1,10), %r =  /^(?:\d{1,3}\.){3}\d{1,3}$/
    if (!$regex(%s,%r)) { 
      echo $color(info).dd -s * [GetIP] Error parsing socket reply: $bvar(&a,1-).text 
    }
    else {
      set -e %external.ip %s
      if (($group(#set.ip.auto) == on) || ($sock($sockname).mark)) {
        .localinfo $host %s
        echo $color(info).dd -s * [GetIP] Resolved external IP: %s (set at 'local info')
      }
    }
  }
}
on *:SOCKCLOSE:GETIP:{
  if ($sockerr) { 
  echo $color(info).dd -s * [GetIP] Cannot resolve your ip: $sock($sockname).wsmsg }
}
#set.ip.auto off
#set.ip.auto end

menu status {
  Set 'local info' to external IP $+([,auto,$chr(58) $replace($group(#set.ip.auto).status,on,enabled,off,disabled),])
  .$iif(($group(#set.ip.auto) == on),$style(1)) Auto on connect
  ..$iif(($group(#set.ip.auto) == on),disable,enable) automation : $iif(($group(#set.ip.auto) == on),.disable,.enable) #set.ip.auto
  .&Set 'local info' to ext. IP now : { getip verbose }
  .-
  .External IP $+ $chr(58) $iif((%external.ip),$v1,not resolved yet) : clipboard %external.ip
  .Local info IP $+ $chr(58) $ip : clipboard $ip
  .-
  .&Reset 'local info'
  ..&normal (winsock) lookup : localinfo -h
  ..$iif(($status != connected),$style(2)) &userhost (server) lookup: localinfo -u
}
Posted By: bwuser

Re: local info shows wrong ip address - 06/10/10 02:46 PM

I tried FroggieDaFrog's version, but same error.

Originally Posted By: Horstl
I'm not able to reproduce this. The socket reply you get is weird (i.e. the "location: nnscript" thing - yet I cannot think of how nnscript could interfere with the setting of &a in the sockread event). Does the error always contain "content-length: 0"?

On connect it shows
Quote:
* [GetIP] Resolving your IP address...
* [GetIP] Error parsing socket reply: Date: Wed, 06 Oct 2010 14:38:11 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: http://nnscript.com
Cache-Control: private
Content-Length: 0

And if I do /getip manually. I get
Quote:
* [GetIP] Error parsing socket reply: Location: http://www.nnscript.com/
Content-Length: 0
Date: Wed, 06 Oct 2010 14:43:01 GMT
Server: lighttpd/1.4.26


* [GetIP] Error parsing socket reply: Location: http://www.nnscript.com/automation/n09230945.asp
Content-Length: 0
Connection: close
Date: Wed, 06 Oct 2010 14:43:01 GMT
Server: lighttpd/1.4.26


Quote:
Does www.whatismyip.com/automation/n09230945.asp produce the correct IP in your browser?

http://www.whatismyip.com/automation/n09230945.asp shows my correct IP. It's same like on wieistmeineip.de. I am sure it's the right one, because if I set it manually everything (like dcc chat with eggdrop) works.

Quote:

What mIRC version do you use?

mirc 6.21
nnscript 3.81
Posted By: Riamus2

Re: local info shows wrong ip address - 06/10/10 05:43 PM

You might try a newer version of mIRC just to see if that helps.

Beyond that, the fact that nnscript is messing this up seems strange. Somehow, it's trying to access nnscript for the site instead of whatismyip. Does nnscript have a GETIP socket name? Ignore any matches from the script that you're getting here, but just scan the entire nnscript.
Posted By: FroggieDaFrog

Re: local info shows wrong ip address - 07/10/10 06:03 AM

I am thinking /GETIP might be an alias used with nnscript, or the script has rewrote one of the sock commands, so try this:

Code:
alias SRGIP {
  if ($sock(SRGIP)) { sockclose SRGIP } 
  !sockopen SRGIP www.whatismyip.com 80
  !sockmark SRGIP $1
  echo $color(info).dd -s * [SRGIP] Resolving your IP address...
}
on *:CONNECT:{ SRGIP }

on *:sockopen:SRGIP:{
  if ($sockerr) { echo color(info).dd -s * [SRGIP] Cannot resolve your ip: $sock($sockname).wsmsg }
  else {
    var %s = sockwrite -n $sockname
    %s GET /automation/n09230945.asp HTTP/1.0
    %s Host: $sock($sockname).addr
    %s 
  }
}
on *:SOCKWRITE:SRGIP:{ If ($sockerr) { echo $color(info).dd -s * [SRGIP] Cannot resolve your ip: $sock($sockname).wsmsg } }
on *:sockread:SRGIP:{
  if ($sockerr) { echo $color(info).dd -s * [SRGIP] Cannot resolve your ip: $sock($sockname).wsmsg }
  else {
    !sockread -f &a
    var %s = $gettok($bvar(&a,1-).text,-1,10), %r =  /^(?:\d{1,3}\.){3}\d{1,3}$/
    if (!$regex(%s,%r)) { echo $color(info).dd -s * [SRGIP] Error parsing socket reply: $bvar(&a,1-).text }
    else {
      set -e %external.ip %s
      if (($group(#set.ip.auto) == on) || ($sock($sockname).mark)) { .localinfo $host %s | echo $color(info).dd -s * [SRGIP] Resolved external IP: %s (set at 'local info') }
    }
  }
}
on *:SOCKCLOSE:SRGIP:{ if ($sockerr) { echo $color(info).dd -s * [SRGIP] Cannot resolve your ip: $sock($sockname).wsmsg } }


#set.ip.auto off
#set.ip.auto end

menu status {
  Set 'local info' to external IP $+([,auto,$chr(58) $replace($group(#set.ip.auto).status,on,enabled,off,disabled),])
  .$iif(($group(#set.ip.auto) == on),$style(1)) Auto on connect
  ..$iif(($group(#set.ip.auto) == on),disable,enable) automation : $iif(($group(#set.ip.auto) == on),.disable,.enable) #set.ip.auto
  .&Set 'local info' to ext. IP now : { SRGIP verbose }
  .-
  .External IP $+ $chr(58) $iif((%external.ip),$v1,not resolved yet) : clipboard %external.ip
  .Local info IP $+ $chr(58) $ip : clipboard $ip
  .-
  .&Reset 'local info'
  ..&normal (winsock) lookup : localinfo -h
  ..$iif(($status != connected),$style(2)) &userhost (server) lookup: localinfo -u
}
Posted By: bwuser

Re: local info shows wrong ip address - 08/10/10 11:33 AM

Also the menu with /status didn't work. Same also for the most recent mirc.

Anyhow, I modified the script a little without knowing what I am doing.

Code:
on *:connect: { getip }

alias getip {
  if ($sock(getip)) { sockclose getip } 
  sockopen getip www.whatismyip.com 80
  sockmark getip $1
}

on *:sockopen:getip:{
  if ($sockerr) { echo -snc info * [GetIP] Cannot resolve your ip: $sock($sockname).wsmsg | return }
  sockwrite $sockname GET $+(/automation/n09230945.asp HTTP/1.0,$lf,HOST: $sock($sockname).addr,$str($lf,2))  
}

on *:sockread:getip:{
  sockread -f &a
  var %s = $gettok($bvar(&a,1-).text,-1,10), %r =  /^(?:\d{1,3}\.){3}\d{1,3}$/
  echo aa
  if (!$regex(%s,%r)) {
    echo c
    echo -snc info * [GetIP] Error parsing socket reply: $bvar(&a,1-).text
    echo d
  }
  else {
    set -e %external.ip %s
    echo -snc info * [GetIP] Resolved external IP: %s (set at 'local info')
    .localinfo $host %s
  }
}


Now I get
Code:
aa
c
* [GetIP] Error parsing socket reply: Date: Fri, 08 Oct 2010 11:27:48 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: http://nnscript.com
Cache-Control: private
Content-Length: 0


d
aa
* [GetIP] Resolved external IP: .....(modified by me)....... (set at 'local info')


And it works. Correct IP is set every time. Also the eggdrop partyline (dcc chat) is works now.

Thank you again for your effort!
Posted By: throndo

Re: local info shows wrong ip address - 13/09/11 11:26 AM

I updated the script because there were some changes on whatismyip.com. Also changed some names, in order not to conflict with nnscript. At the moment it works for me.

Code:
on *:connect: { newgetip }

alias newgetip {
  if ($sock(newgetip)) { sockclose newgetip } 
  sockopen newgetip automation.whatismyip.com 80
  sockmark newgetip $1
}

on *:sockopen:newgetip:{
  if ($sockerr) {
    echo sockopen:newgetip sockerr
    echo -snc info * [newgetip] Cannot resolve your ip: $sock($sockname).wsmsg
    return
  }
  echo sockopen:newgetip ok
  sockwrite $sockname GET $+(/n09230945.asp HTTP/1.0,$lf,HOST: $sock($sockname).addr,$str($lf,2))  
}

on *:sockread:newgetip:{
  sockread -f &a
  var %s = $gettok($bvar(&a,1-).text,-1,10), %r =  /^(?:\d{1,3}\.){3}\d{1,3}$/
  echo sockread:newgetip
  echo %s
  if (!$regex(%s,%r)) {
    echo sockread:newgetip error
    echo -snc info * [newgetip] Error parsing socket reply: $bvar(&a,1-).text
  }
  else {
    set -e %external.ip %s
    echo -snc info * newgetip Resolved external IP: %s (set at 'local info')
    .localinfo $host %s
  }
}
© 2021 mIRC Discussion Forums