rendered paste bodyon $*:TEXT:$(/^((?>\Q $+ $me $+ \E) +)?[!@.]kbase/Si):#:{
if ($1 == $me) { tokenize 32 $2- }
if ($cp($chan,bot) || $cp($chan,kbase) || $cp($chan,$me)) { halt }
if ($istok(#RShelp #RSPC #iKick,$chan,32)) && ($nick isreg $chan) && ($left($1,1) == @) halt
if ($regex($2-,/[%$]/)) { .notice $nick Bot exploit detected and logged. | msg $readini(Config.ini,settings,msgnick) [Exploit] $c2($nick) $c1(in) $c2($+($chan,:)) $+(<,$nick,>) $1- | halt }
if (($2 == $null) || ($3 == $null && #* iswm $2)) {
notice $nick $logo(Syntax Error) [!@]Kbase (#ID) Word
}
else {
var %Display = $iif(@* iswm $1 && !$cp($chan,public),msg $chan,.notice $nick)
sockopen $+(KBase.,$ticks,.,$nick) runescape.com 80
if (#* iswm $2) {
if ($remove($2,$chr(35)) !isnum) {
notice $nick $logo(Error) $c1($remove($2,$chr(35))) is not a number
}
else {
sockmark $+(KBase.,$ticks,.,$nick) $+(%Display,*,$replace($3-,$chr(32),_,+,_),*,$remove($2,$chr(35)))
}
}
else {
sockmark $+(KBase.,$ticks,.,$nick) $+(%Display,*,$replace($2-,$chr(32),_,+,_),*,1))
}
}
}
on *:SOCKOPEN:KBase.*: {
tokenize 42 $sock($sockname).mark
sockwrite -nt $sockname GET $+(/kbase/search.ws?search_query=,$2,&category=null&subcat=null&title_chk=1& $+ $&
keywords_chk=1&description_chk=1&body_chk=1&and_rad=1&submit=Search+Again) HTTP/1.1
sockwrite -nt $sockname Host: runescape.com
sockwrite -nt $sockname $str($crlf,2)
}
on *:SOCKREAD:KBase.*: {
tokenize 42 $sock($sockname).mark
var %ID $gettok($sockname,2,46), %Display $iif($1,$1,notice $gettok($sockname,3,46)), %Nick == $gettok($sockname,3,46), %Socket
sockread %Socket
if ($sockerr) { %target Socket Error | unset %players.*. [ $+ [ %x ] ] | halt }
else {
if ($regex(%Socket,/Your search for <i>"(.*)"<\/i>/)) {
%Display $Logo(KBase) $CC1(%Nick,No matches found for) $QT($CC2(%Nick,$2))
unset %KBase. [ $+ [ %ID ] ] $+ *
sockclose $sockname
}
if ($regex(%Socket,/<p><b>(.*)<\/b>/)) {
set $+(%,KBase.,%ID,.Info) $CC1(%Nick,Results:) $CC2(%Nick,$regml(1)) $X
}
if ($regex(%Socket,/<a style="margin-left: 6px" href="(.*)">(.*)<\/a>/)) {
inc $+(%,KBase.,%ID,.INC2)
if ($($+(%,KBase.,%ID,.INC2),2) == $3) {
set $+(%,KBase.,%ID,.Info) $($+(%,KBase.,%ID,.Info),2) $QT($CC2(%Nick,$regml(2))) $X $&
$$C1(%Nick,$remove($regml(1),/p=pawYZ6Ill12N6D3mDdihco3oPeYN2KFyD*I0GDTU5oc)) $X
}
}
if ($regex(%Socket,/<td colspan="2">(.*)/)) {
if ( !isin $regml(1)) {
inc $+(%,KBase.,%ID,.INC)
if ($($+(%,KBase.,%ID,.INC),2) == $3) {
%Display $Logo(KBase) $($+(%,KBase.,%ID,.Info),2) $CC1(%Nick,Desc:) $CC2(%Nick,$HTMLFree($regml(1)))
unset %KBase. [ $+ [ %ID ] ] $+ *
sockclose $sockname
}
}
}
}
}