mIRC Home    About    Download    Register    News    Help

Print Thread
#133125 17/10/05 02:55 PM
A
Abuser__
Abuser__
A
I am trying to script something but I can't do it. It should be very easy, the site is nice coded...i want a ipv6dns resolver wich will lookup for ipv6 hosts using this site http://www.dnsstuff.com/tools/lookup.ch?name=hostname.i.want.to.resolve.com&type=AAAA and then return the result of resolved hostname. For example:

<nick> !ipv6dns master.abusers.name
<bot> Resolved master.abusers.name to ipv6 address 3ffe:80ee:361e:0:0:0:0:3

Thanks smile

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Code:
on *:input:*: {
  if ($1 == !ipv6dns) {
    ipv6dns $2
    [color:green]; set %ipv6output $active[/color]
  }
}

alias ipv6dns {
  set %ipv6host $1
  sockopen ipv6 www.dnsstuff.com 80
}

on *:sockopen:ipv6: {
  sockwrite -n $sockname get /tools/lookup.ch?name= $+ %ipv6host $+ &amp;type=AAAA HTTP/1.0
  sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
  sockwrite -n $sockname Host: www.dnsstuff.com $+ $crlf $+ $crlf
  sockwrite -n $sockname Accept-Language: en-us
  sockwrite -n $sockname Accept-Encoding: gzip, deflate
  sockwrite -n $sockname Accept: */*
}

on *:sockread:ipv6: {
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    var %temptext
    sockread %temptext
    if (*&lt;TR&gt;&lt;TD&gt; $+ %ipv6host $+ * iswm %temptext) {
      echo -a Resolved %host to ipv6 address $left($gettok(%temptext,11,62),-4)
      unset %host
      sockclose ipv6
    }
    if (*No AAAA records* iswm %temptext) {
      echo -a No ipv6 entry found.
      unset %host
      sockclose ipv6
    }
  }
}

Use: !ipv6dns host.com
Or: /ipv6dns host.com

If you want the bot to not echo the text, then remove the semicolon in the Green text above and either leave it as $active or replace it with $chan or $me. You can also make a similar on text event if you want others to do it. Then, change the two echo lines on the bot to msg or notice the variable.


Link Copied to Clipboard