mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2006
Posts: 248
B
bwuser Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jul 2006
Posts: 248
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!

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
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.

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
If you need it for the DCC protocol:
Options > Connect > Options > Advanced

Joined: Jul 2006
Posts: 248
B
bwuser Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jul 2006
Posts: 248
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.)

Last edited by bwuser; 27/07/10 01:03 PM.
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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
}


Last edited by Horstl; 27/07/10 01:50 PM.
Joined: Jul 2006
Posts: 248
B
bwuser Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jul 2006
Posts: 248
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)?

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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?

Joined: Jul 2006
Posts: 248
B
bwuser Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jul 2006
Posts: 248
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?

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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?

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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
}


I am SReject
My Stuff
Joined: Jul 2006
Posts: 248
B
bwuser Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jul 2006
Posts: 248
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

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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
}


I am SReject
My Stuff
Joined: Jul 2006
Posts: 248
B
bwuser Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jul 2006
Posts: 248
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!

Joined: Sep 2011
Posts: 5
T
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
T
Joined: Sep 2011
Posts: 5
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
  }
}


Link Copied to Clipboard