mIRC Home    About    Download    Register    News    Help

Print Thread
#216483 16/11/09 11:32 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In the help file under ON DNS the following code is given as an example.
Code:
on 1:DNS:{
 var %n = $dns(0)
 echo 4 Found %n addresses
 while (%n > 0) {
   echo 4 dns: $dns(%n) nick: $dns(%n).nick addr: $dns(%n).addr ip: $dns(%n).ip
   dec %n
 }
}

The issue I'm having, is that I never see a return for $dns(%n).nick

Can anyone tell me why that never seems to have a valid return? I have a situation where being able to see the nick(s) associated with an IP address would be very helpful.

RusselB #216493 17/11/09 07:39 AM
Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
/help /dns

/dns [-ch] [nick|address]

The documentation doesn't entirely specify this behaviour but my guess would be, if you /dns a nickname, you get $dns(n).nick. Just a guess, but the code seems to display nick correctly when I do this.

s00p #216499 17/11/09 03:10 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for that. I was looking for a way to enter an IP address and get the nick(s) that are online and using that address.

guess I need to find another way, if possible.

RusselB #216500 17/11/09 03:22 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
In case you're on Unreal and o-lined, you could "who +h[I] <dns'd host>" or directly "who +i[I] <IP>". A different IRCd most likely features similar switches.

Horstl #216507 17/11/09 09:22 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks, I meet both of the qualifications you stated (ie: IRCd is Unreal and I am o-lined), so I'll give that a try.

RusselB #216571 20/11/09 04:33 AM
Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
You could...

eg:
Code:
; 1 problem with the following event: it has no way of tracking nick changes.
on 1:OPEN:?:*: who $nick
on 1:JOIN:#: who $chan

alias GetNicksByHostname {
  var %hostname = $+(*!*@,$1)
  var %r, %x = $ial(%hostname,0).nick

  while (%x) {
    %r = %r $ial(%hostname,%x).nick
    inc %x
  }

  return %r
}

alias GetNicksByHostname_TestCase {
  ; you need to run it on both, because the IRCd might use either hostname or IP...
  echo -a 127.0.0.1: $GetNicksByHostname(127.0.0.1)
  echo -a localhost: $GetNicksByHostname(localhost)

  var %myhost = $gettok($ial($me,1),2,$asc(@))
  echo -a %myhost $+ : $GetNicksByHostname(%myhost)
}

s00p #216573 20/11/09 06:02 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for your suggestion, Soop. I will consider incorporating it for the networks where I don't have IRCops access, and yet want to obtain the same information.


Link Copied to Clipboard