Administrators coders-irc_Bot Posted July 12 Administrators Report Share Posted July 12 ; filename: r_dns.mrc ; ---------------------------------------------- ; Multi DNS Reverse DNS Lookup. By Raccoon 2016 ; ---------------------------------------------- ; Usage: /dns <address/ip> (like normal) ; Suppliments regular /dns lookups if an address returns more than one IP result. ; ; Usage: /rdns <address/ip> ; Resolves all IPs associated with an address, and performs a reverse NS lookup on each IP. ; You can use optional switches from the /dns command [-46ch]. ; ; Examples: ; ; /dns irc.efnet.org ; ; * Dns resolved irc.efnet.org to 141.213.238.252 91.217.189.5 66.225.225.225 128.39.65.230 193.163.220.3 67.218.118.62 ; 209.222.22.22 198.47.99.99 194.126.217.2 195.140.202.142 ; ; /rdns irc.efnet.org ; ; * RDNS (421ms) irc.efnet.org (10): 128.39.65.230[irc.underworld.no] 195.140.202.142[efnet.port80.se] ; 91.217.189.5[efnet.portlane.se] 141.213.238.252[pegasus.us.itd.umich.edu] 66.225.225.225[irc.servercentral.net] ; 194.126.217.2[irc.efnet.fr] 193.163.220.3[irc.inet.tele.dk] 209.222.22.22[irc.choopa.net] 67.218.118.62[no-rdns] ; 198.47.99.99[irc.mzima.net] ALIAS RDNS { var %switches if (-* iswm $1) { %switches = $1 | tokenize 32 $2- } if (%RDNS) { echo -stic info * RDNS: There is already an RDNS being processed. | return } if ($0 == 0) { echo -stic info * Usage: /rdns <address/ip> or /rdns [-46ch] <address/ip> (see: /help /dns) | return } set -eu120 %RDNS $$1 set -eu120 %RDNS.tries 5 set -eu120 %RDNS.ticks $ticks set -eu120 %RDNS.queue 1 .dns -c .dns %switches %RDNS } ; by Raccoon 2016 On *:DNS: { if (%RDNS) && ( ($dns(0).addr == %RDNS) || ($v1 isin %RDNS.output) || ($dns(0).ip == %RDNS) || ($istok(%RDNS.ips,$v1,32)) ) { if (!%RDNS.addr) set -eu120 %RDNS.addr $dns(0).addr dec -eu120 %RDNS.queue var %i = 1, %n = $dns(0), %ip, %addr while (%i <= %n) { var %ip = $dns(%i).ip var %addr = $dns(%i).addr if (!$istok(%RDNS.ips,%ip,32)) { set -eu120 %RDNS.ips %RDNS.ips %ip set -eu120 %RDNS.output %RDNS.output %ip var %newipfound = $true inc %RDNS.queue 1 .dns %ip } elseif ($istok(%RDNS.output,%ip,32)) { if (%n == 1) { set -eu120 %RDNS.output $reptok(%RDNS.output,%ip,%ip $+ [[ $+ $iif(%addr,$v1,no-rdns) $+ ]],0,32) } else { noop ; not an rdns but a round robin because n > 1 } } else { noop ; discard. } inc %i } if (%newipfound) { inc %RDNS.queue 1 .dns %RDNS.addr } elseif (%RDNS.tries > 0) { if ((%RDNS.queue > 0) && (%addr == %RDNS.addr)) || (%RDNS.queue <= 0) { dec -eu120 %RDNS.tries 1 inc -eu120 %RDNS.queue 1 .dns %RDNS.addr } } elseif (%RDNS.queue <= 0) { var %ticks = $calc($ticks - %RDNS.ticks) echo -atic notice * RDNS ( $+ %ticks $+ ms) %RDNS.addr ( $+ $numtok(%RDNS.output,32) $+ ): %RDNS.output unset %RDNS.* unset %RDNS } haltdef } ; Multi-DNS -- automatically replace regular /dns output if multiple IP results. elseif ($dns(0) > 1) { var %i = 1, %n = $v1 var %address = $dns(0).addr, %ip = $dns(0).ip while (%i <= %n) { var %address = $addtok(%address,$dns(%i).addr,32) var %ip = $addtok(%ip,$dns(%i).ip,32) inc %i } echo -stic other * Dns resolved %address to %ip haltdef } } ; by Raccoon 2016 ; End of Script. Quote Link to comment Share on other sites More sharing options...