Code: Select all
bind pub -|- "!whois" whoisinfo
proc whoisinfo { nick uhost hand chan rest } {
set mask {[^A-Za-z\. 0-9 \-]}
set pau [regexp $mask $rest]
if {$pau==0} {
set paupau [eval [concat exec -- whois $rest]]
set blabla [split $paupau \r\n]
foreach {i} $blabla {
putserv "PRIVMSG $nick :$i"
}
} else {putserv "PRIVMSG $nick :String $arg contains not allowed symbols,rejected"}
return 0
}
putlog "whois tcl loaded"without any warrenty or support:gL0oM wrote:De Kus, upload your script to some web site please...
Code: Select all
#De Kus' kleines whoisscript :)
set whoisinuse 0
set re(whois1) {(?ni)inetnum: (.*)\n}
set re(whois2) {(?ni)descr: (.*)\n}
set re(whois3) {(?ni)country: (.*)\n}
set re(whois4) {(?ni)source: (.*)\n}
set re(whois5) { ([A-Za-z0-9\.\-]+@[A-Za-z0-9\.\-]+)}
set re(whois6) {(?ni)route: (.*)\n}
set re(whois7) {Registrant:\n([^\n]+)\n[^\n]+\n[^\n]+\n +([^\n]+)\n}
bind pub ol|ol ?whois whoisquery
proc whoisquery {nick uhost hand chan query} {
if { $::whoisinuse == 1 } {
puthelp "NOTICE $nick :Befehl darf nur 1mal/minute benutzt werden."
} elseif { [scan $query "%s" hostip] != 1 } {
puthelp "NOTICE $nick :Fehler: Anzahl der Argumente ungültig."
} else {
set ::whoisinuse 1
timer 1 [list set ::whoisinuse 0]
dnslookup [split $hostip] whoisquery_cb [split $nick] [split $chan] [split [string map {| "" < "" > ""} $query]]
return 1
}
}
proc whoisquery_cb {ipaddress hostname status nick chan query} {
if { $hostname == $ipaddress && $ipaddress != "0.0.0.0" || $hostname == "" } {
set hostname ""
} elseif { $ipaddress != "0.0.0.0" } {
set hostname "($hostname)"
set query $ipaddress
} else {
set ipaddress ""
}
if {[catch {set sock [open "|bash -c "whois $query"" r]} err] } {
puthelp "NOTICE $nick :Fehler: $err"
} else {
fconfigure $sock -blocking 0
fileevent $sock readable [list whoisquery_cb2 $sock $ipaddress $hostname $nick $chan]
}
return 0
}
proc whoisquery_cb2 {sock ipaddress hostname nick chan} {
global re
set nick [join $nick]
set chan [join $chan]
set description ""
set country ""
set source ""
set netblock ""
set abuse ""
set input [read $sock]
close $sock
regexp $re(whois1) $input {} netblock
regexp $re(whois2) $input {} description
regexp -all $re(whois3) $input {} country
regexp $re(whois4) $input {} source
foreach line [split $input "\n"] {
if { [string match -nocase *abuse* $line] } {
if { [regexp $re(whois5) $line {} abuse] } {
break
}
}
}
if { $abuse != "" } {
set abuse " - Abuse eMail: $abuse"
}
if { $netblock == "" } {
regexp $re(whois7) $input {} netblock
}
if { $country == "" } {
if { ![regexp $re(whois7) $input {} description country] } {
puthelp "NOTICE $nick :Fehler: Unzureichendes Suchergebnis um es wiederzugeben."
return 0
}
}
puthelp "PRIVMSG $chan :[string trim $source] meldet für $ipaddress$hostname im NetBlock [string trim $netblock]:"
puthelp "PRIVMSG $chan :Ländercode: [string trim $country] - Beschreibung: [string trim $description]$abuse"
return 0
}