#!whois on on *:text:!whois*:#: { whoisd $2 } #!whois end alias whoisd { if (!$1) { whoisd.out Usage: /whoisd | halt } var %i ^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$ if ($regex($1,%i) != 1) { whoisd.out Invalid domain | halt } whoisd.open $whoisd.main $1 } alias whoisd.out { $iif($chan($gettok($sock($sockname).mark,3,32)),msg $ifmatch,$iif($chan,msg $chan,echo -a)) whois: $1- } alias whoisd.main { return whois.iana.org } alias whoisd.open { if (!$1) { whoisd.out Usage: /whoisd.open | halt } if ($sock($whoisd.id($2))) { sockclose $whoisd.id($2) } if ($1) { sockopen $whoisd.id($2) $iif(: isin $1,$replace($1,:,$chr(32)),$1 43) } else { whoisd.out Usage: /whoisd.open | halt } if (. isin $2) sockmark $whoisd.id($2) $1 $strip($2) $iif($chan,$chan,$3) else { whoisd.out Usage: /whoisd.open | sockclose $whoisd.id($2) | halt } } alias -l whoisd.id { return whoisd_ $+ $md5($strip($1)) } on *:sockopen:whoisd_*: { if ($sockerr > 0) { return } if ($whoisd.main isin $gettok($sock($sockname).mark,1,32)) { $iif($numtok($gettok($sock($sockname).mark,2,32),46),.sockwrite -nt $sockname $gettok($gettok($sock($sockname).mark,2,32),$ifmatch,46),) } else { .sockwrite -nt $sockname $gettok($sock($sockname).mark,2,32) } } on *:sockread:whoisd_*: { if ($sockerr > 0) { return } :i if ($sock($sockname)) { sockread -f %y } if ($sockbr == 0) { return } ;This is for debug mode only ;if ($window(@whoisd) == $null) { window @whoisd } ;if (%y) { aline @whoisd $sock($sockname).mark %y } if ($whoisd.main isin $gettok($sock($sockname).mark,1,32)) { if (Whois Server == $gettok(%y,1-2,32)) { .timer 1 1 whoisd.open $+($gettok(%y,5,32),:,$remove($gettok(%y,4,32),:,$chr(41))) $gettok($sock($sockname).mark,2,32) $gettok($sock($sockname).mark,3,32) if ($sock($sockname)) sockclose $sockname halt } elseif (*URL for registration services:* iswm %y) { } if (*not found* iswm %y) { whoisd.out Invalid TLD sockclose $sockname halt } } if ((*Error for* iswm %y) || (*ERROR: Invalid search string.* iswm %y) || (*Bad Characters in query* iswm %y) || (*Domain error* iswm %y)) { whoisd.out $gettok($sock($sockname).mark,2,32) caused an error... sockclose $sockname halt } if ((*No match* iswm %y) || (*Not found* iswm %y)) { whoisd.out $gettok($sock($sockname).mark,2,32) is available! sockclose $sockname halt } goto i } on *:sockclose:whoisd_*: { if ($whoisd.main !isin $gettok($sock($sockname).mark,1,32)) { whoisd.out $gettok($sock($sockname).mark,2,32) is taken! } else { whoisd.out could not lookup data for $gettok($sock($sockname).mark,2,32) } }