Pages

Sunday, August 28, 2011

dns2.tcl

#--------------------------------------------------------------------------
# !Dns Version 3.1 Based on Script by I_strike - edited by DioN!
# Commands:
#                   !dns <adresse/host>
#                   !User@host <nick>
#                   !dnsnick <nick>
#                   !amsg <message>
#-------------------------------------------------------

# SET THE CHARACTER THAT WILL BE USED BEFORE PUBLIC QUERRIES
# EXAMPLE: "#" => #seen, #op .... DEFAULT: "!"

set dnshost(cmdchar) "!"


#-----------------please don't CHANGE ANY OF THE FOLLOWING LINES----------------------
bind pub - [string trim $dnshost(cmdchar)]dns dns:res
bind pub n|n [string trim $dnshost(cmdchar)]amsg pub:amsg
bind pub - [string trim $dnshost(cmdchar)]User@host pub:host
bind pub - [string trim $dnshost(cmdchar)]dnsver pub:ver
bind pub - [string trim $dnshost(cmdchar)]dnsnick dns:nick
bind raw * 311 raw:host
bind raw * 401 raw:fail

set dns_chan ""
set dns_host ""
set dns_nick ""
set dns_bynick ""

proc pub:host {nick uhost hand chan arg} {
global dns_chan
set dns_chan "$chan"
putserv "WHOIS [lindex $arg 0]"
}

proc raw:host {from signal arg} {
global dns_chan dns_nick dns_host dns_bynick
set dns_nick "[lindex $arg 1]"
set dns_host "*!*[lindex $arg 2]@[lindex $arg 3]"
foreach dns_say $dns_chan { puthelp "PRIVMSG $dns_say :15\[hOst4!15\]\017 The User@host of \037\002$dns_nick\017 is \037\002$dns_host\017 ." }
if {$dns_bynick == "oui"} {
                set hostip [split [lindex $arg 3] ]
                dnslookup $hostip resolve_rep $dns_chan $hostip
                set dns_bynick "non"
}
}

proc raw:fail {from signal arg} {
global dns_chan
set arg "[lindex $arg 1]"
foreach dns_say $dns_chan { puthelp "PRIVMSG $dns_say :15\[niCk4!15\]\017 \037\002$arg\017: No such nick." }
}

proc pub:ver {nick uhost hand chan text} {
putserv "PRIVMSG $chan :15\[dNs.tçL13!15\]\017 v9.3"
}

proc dns:res {nick uhost hand chan text} {
 if {$text == ""} {
            puthelp "privmsg $chan :15\[hOst7!15\]\017 Syntax: !dns <host or ip>"
        } else {
                set hostip [split $text]
                dnslookup $hostip resolve_rep $chan $hostip
        }
}

proc dns:nick {nick uhost hand chan arg} {
global dns_chan dns_bynick dnshost
 if {$arg == ""} {
 puthelp "privmsg $chan :15\[niCk7!15\]\017 Syntax: !dnsnick <nick>"
        } else {
set dns_chan "$chan"
set dns_bynick "oui"
putserv "WHOIS [lindex $arg 0]"
        }
}

proc resolve_rep {ip host status chan hostip} {
        if {!$status} {
                puthelp "privmsg $chan :15\[dNs04!15\]\017 Unable to resolve \037\002$hostip\017 ."
        } elseif {[regexp -nocase -- $ip $hostip]} {
                puthelp "privmsg $chan :15\[dNS12!15\]\017 Resolved \037\002$ip\017 to \037\002$host\017 ."
        } else {
                puthelp "privmsg $chan :15\[dnS04!15\]\017 Resolved \037\002$host\017 to \037\002$ip\017 ."
        }
}

putlog "dede dNs.tçL v9.3 LOADED!!"

No comments:

Post a Comment