bind pub - !xswhois xswhois bind pub - !whois whois # # xswhois resolves IP-address for webchat.xs4all.nl users... # # v0.1 - nostromo, Tue May 25 16:08:19 2005 # v0.2 - nostromo, Thu Jul 21 20:00:14 2005 # v0.3 - nostromo, Sat Apr 22 13:03:42 2006 (!whois added) # # +----------------------------------------------------------+ # | EGGDROP_HOME/scripts/xs4all_helper.sh: | # +----------------------------------------------------------+ # | | # | #!/bin/sh | # | | # | /usr/bin/whois $1 | /usr/bin/awk '/(netname|OrgName):/ \ | # | { $1=""; print }' | # | | # +----------------------------------------------------------+ # proc whois {nick uhost hand chan rest} { set whois_ip "" set rest [string trim $rest] set first "" set second "" set third "" set fourth "" set octet {(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])} set RE "^[join [list $octet $octet $octet $octet] {\.}]\$" regexp $RE $rest all first second third fourth if { ($first != "") && ($second != "") && ($third != "") && ($fourth != "") } then { set whois_ripe [string trim [get_ripe $all]] if { $whois_ripe != ""} then { putchan $chan "$nick, $all is registered to \'$whois_ripe\'" } else { putchan $chan "$nick, $all somehow seems unregistered..." } } else { putchan $chan "$nick, you should at least provide a valid IP (of version 4)..." } } proc xswhois {nick uhost hand chan rest} { set xs4host "" set xs4hostmask "" set rest [string trim $rest] if {[onchan $rest $chan]} { set xs4hostmask [getchanhost $rest $chan] regexp {(.{8})\@webchat.xs4all.nl} $xs4hostmask all xs4host if { $xs4host != "" } { regexp {(.{2})(.{2})(.{2})(.{2})} $xs4hostmask all fioc seoc thoc fooc set fioc "0x$fioc" set seoc "0x$seoc" set thoc "0x$thoc" set fooc "0x$fooc" set xs_ip "[format "%d.%d.%d.%d" $fioc $seoc $thoc $fooc]" putchan $chan "[format "%s, %s is coming from %s" $nick $rest $xs_ip]" set xs_ripe [get_ripe $xs_ip] if { $xs_ripe != "" } then { putchan $chan "$nick, $xs_ip is registered to \'$xs_ripe\'" } } else { putchan $chan "$nick, $rest is not a webchat-user..." } } else { putchan $chan "$nick?" } } proc get_ripe { xs_ip } { return [exec ./scripts/xs4all_helper.sh $xs_ip ] } putlog "nostromos xs4all_whois + ripe scripts loaded...."