mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2012
Posts: 1
J
j_shutz Offline OP
Mostly harmless
OP Offline
Mostly harmless
J
Joined: Sep 2012
Posts: 1
Hi guys,

I am trying to write a script that does a /DNS lookup on an IP address, and I would like to set the result as a variable.

is this a RAW, or how would I parse the result as a variable,
so that when I do a look up I can /msg $chan %variable ?

I appreciate your help, I was unable to find the answer via google.


Thanks in advance

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Usage: /msgdns google.com #mychan

Code:
alias msgdns {
  var %host = $1, %chan = $$2
  set -u5 %dns $+ %host %chan
  .dns %host
}

on *:dns:{
  var %chan = %dns [ $+ [ $dns(0).addr ] ]
  unset %dns [ $+ [ $dns(0).addr ] ]

  if (!%chan) { return }

  if ($dns(1)) {
    msg %chan Dns resolved $dns(1).addr to $dns(1).ip
  }
  else {
    msg %chan Dns unable to resolve address $dns(0).addr
  }
}


Link Copied to Clipboard