Thread: Scripted RC
View Single Post
  #82  
Old 08-13-2009, 04:31 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Well it was fun griefing my client-rc'ers on Zodiac but this should be dealt with.

It needs to filter out HTML tags sent through RC messages.

My current hack fix to prevent the tags from continuing to wreak havoc:

PHP Code:
//#CLIENTSIDE

/*
   Hack fix due to ScriptRCRCchat.onTextChanged not working.
*/

function ScriptedRCWindow.onWake() {
  
onWatchRC();
}

function 
ScriptedRCWindow.onShow() {
  
onWatchRC();
}

function 
onWatchRC() {
  
// Quits looping until onScrolled can takeover completely.
  
if (ScriptedRCScroll.scrollpos[1] > 0) return;
  
checkRC();
  
this.scheduleevent(0.05"WatchRC""");
}

function 
ScriptedRCScroll.onScrolled() {
  
checkRC();
}

/*
   Checks RC for new messages / text.
*/

function checkRC() {

  
// Prevent Scroll Looping
  
if (this.last == ScriptedRCRCchat.text.length()) return;
  
  
// Get Last Line
  
temp.rcchat ScriptedRCRCchat.text;
  for (
temp.temp.rcchat.length(); temp.0temp.i--) {
    
temp.char temp.rcchat.charat(temp.i);
    if (
temp.char == "\\" && temp.lastchar == "n") {
      
temp.lbpos temp.2;
      break;
    }
    
temp.lastchar temp.char;
  }
  
  
// Determine Last Message
  
temp.lastmsg temp.rcchat.substring(temp.lbpos);
  if (
temp.lastmsg.pos("</font>") >= 0) {
    
temp.from    temp.lastmsg.substring(0temp.lastmsg.pos("</font>")+7);
    
temp.textmsg temp.lastmsg.substring(temp.lastmsg.pos("</font>")+7);
    
temp.textmsg temp.from filter(temp.textmsg);
  }
  else 
temp.textmsg temp.lastmsg;
  
  
// Alter Text
  
temp.oldspos = @ScriptedRCScroll.scrollpos;
  
ScriptedRCRCchat.text ScriptedRCRCchat.text.substring(0temp.lbpos) @ temp.textmsg;
  if (
temp.oldspos != (@ScriptedRCScroll.scrollpos)) {
    
ScriptedRCScroll.scrolltobottom();
  }
  
  
// Record Length
  
this.last ScriptedRCRCchat.text.length();
}

// Filter's <font> tags.

function filter(msg) {
  
temp.mpos msg.pos("<font");
  if (
temp.mpos == -1) return msg;
  
temp.cpos msg.substring(temp.mpos).pos(">");
  while (
temp.mpos >= && temp.cpos >= 0) {
    
msg msg.substring(0temp.mpos) @ msg.substring(temp.mpos+temp.cpos+1);
    
temp.mpos msg.pos("<font");
    
temp.cpos msg.substring(temp.mpos).pos(">");
  }
  return 
" " msg.trim();

Attached Thumbnails
Click image for larger version

Name:	clientrc_exploit.png
Views:	1240
Size:	327.3 KB
ID:	49182  
__________________
Quote:

Last edited by fowlplay4; 08-13-2009 at 07:28 PM..
Reply With Quote