also the main reason, its not because I don't trust you. you're cool. The problem is that ANY admin can crash a client in annihilation using the center print or bottom print functions. Bob explained to me how this works, so I believe that if I keep the incident from ever occurring this could be a step forward in Tribes client security.
Another thing is the hex crash exploit. I've noticed a lot of people use custom chat scripts, some of which cause false flags in crash detection scripts.
anyway i found the script.
Code: Select all
// No-Crash script by Kigen for Annihilation
// Copyright (c) 2006 Max Krivanek
// Configuration
// Displays the fact that your running this pack to the server. 30 seconds after connection accepted.
// Leave empty to disable.
$NoCrash::Display = "I'm running Kigen's NoCrash Pack!";
// Code - DO NOT EDIT BELOW THIS LINE UNLESS YOU ABSOLUTELY KNOW WHAT YOUR DOING!!!
function NoCrash::isCrashString(%string)
{
%tab = 0;
%nl = 0;
%hex = 0;
%crash = FALSE;
for (%i=0; (%letter = String::getSubStr(%string, %i, 1)) != ""; %i++)
{
if (%letter == "\t")
%tab++;
else if (%letter == "\n")
%nl++;
else if (String::findSubStr(escapeString(%letter), "\\x") == 0)
%hex++;
}
if(%tab + %nl + %hex >= 50)
%crash = TRUE;
return %crash;
}
// Plasmatic deserves credit for Replace and StrLen
function NoCrash::Replace(%string, %search, %replace)
{
%len = NoCrash::StrLen(%search);
for (%i = 0; (%char = String::getSubStr(%string, %i, %len)) != ""; %i++)
{
if (%char @ "s" == %search @ "s") %string = String::getSubStr(%string, 0, %i) @ %replace @ String::getSubStr(%string, %i + %len, 255);
}
return %string;
}
function NoCrash::StrLen(%string)
{
for(%i=0; String::getSubStr(%string, %i, 1) != "";%i++)
%length = %i;
%length++;
return %length;
}
function NoCrash::CleanString(%string)
{
if (NoCrash::isCrashString(%string) == FALSE)
return %string;
%newstring = "";
for (%i=0; (%letter = String::getSubStr(%string, %i, 1)) != ""; %i++)
{
if (%letter != "\t" && %letter != "\n" && String::findSubStr(escapeString(%letter), "\\x") != 0)
%newstring = %newstring @ %letter;
// else
// %newstring = %newstring @ "?";
}
return %newstring;
}
// Replacement for echo as to prevent crashing. - Kigen
function NoCrash::echo(%message)
{
%message = NoCrash::CleanString(%message);
if (%message != "" && NoCrash::StrLen(escapeString(%message)) < 1023)
echo(%message);
}
// Something for people with < in their name. (Or them evil client crashers) - Kigen
function NoCrash::ReadyMessage(%string)
{
%string = String::getSubStr(%string, 0, 500);
%newstring = "";
for (%i=0; (%letter = String::getSubStr(%string, %i, 1)) != ""; %i++)
{
if (%letter != "<")
%newstring = %newstring @ %letter;
else
%newstring = %newstring @ "<<";
}
%newstring = NoCrash::Replace(%newstring, "<<jc>", "<jc>");
%newstring = NoCrash::Replace(%newstring, "<<jl>", "<jl>");
%newstring = NoCrash::Replace(%newstring, "<<jr>", "<jr>");
%newstring = NoCrash::Replace(%newstring, "<<f0>", "<f0>");
%newstring = NoCrash::Replace(%newstring, "<<f1>", "<f1>");
%newstring = NoCrash::Replace(%newstring, "<<f2>", "<f2>");
%newstring = NoCrash::Replace(%newstring, "<<f3>", "<f3>");
// The Generator bmp.
%newstring = NoCrash::Replace(%newstring, "<<bitem_damaged.bmp>", "<bitem_damaged.bmp>");
%newstring = NoCrash::Replace(%newstring, "<<<<", "<<");
return %newstring;
}
function centerprint(%clientId, %msg, %timeout)
{
if(%timeout == "")
%timeout = 5;
remoteEval(%clientId, "CP", NoCrash::ReadyMessage(%msg), %timeout);
}
function bottomprint(%clientId, %msg, %timeout)
{
if(%timeout == "")
%timeout = 5;
remoteEval(%clientId, "BP", NoCrash::ReadyMessage(%msg), %timeout);
}
function topprint(%clientId, %msg, %timeout)
{
if(%timeout == "")
%timeout = 5;
remoteEval(%clientId, "TP", NoCrash::ReadyMessage(%msg), %timeout);
}
function centerprintall(%msg, %timeout)
{
if(%timeout == "")
%timeout = 5;
for(%clientId = Client::getFirst(); %clientId != -1; %clientId = Client::getNext(%clientId))
remoteEval(%clientId, "CP", NoCrash::ReadyMessage(%msg), %timeout);
}
function bottomprintall(%msg, %timeout)
{
if(%timeout == "")
%timeout = 5;
for(%clientId = Client::getFirst(); %clientId != -1; %clientId = Client::getNext(%clientId))
remoteEval(%clientId, "BP", NoCrash::ReadyMessage(%msg), %timeout);
}
function topprintall(%msg, %timeout)
{
if(%timeout == "")
%timeout = 5;
for(%clientId = Client::getFirst(); %clientId != -1; %clientId = Client::getNext(%clientId))
remoteEval(%clientId, "TP", NoCrash::ReadyMessage(%msg), %timeout);
}
function Ann::Clean::string(%string)
{
return NoCrash::CleanString(%string);
}
function remoteCP(%manager, %msg, %timeout)
{
%msg = NoCrash::ReadyMessage(%msg);
if(%manager == 2048)
{
$centerPrintId++;
if(%timeout)
schedule("clearCenterPrint(" @ $centerPrintId @ ");", %timeout);
Client::centerPrint(%msg, 0);
}
}
function remoteBP(%manager, %msg, %timeout)
{
%msg = NoCrash::ReadyMessage(%msg);
if(%manager == 2048)
{
$centerPrintId++;
if(%timeout)
schedule("clearCenterPrint(" @ $centerPrintId @ ");", %timeout);
Client::centerPrint(%msg, 1);
}
}
function remoteTP(%manager, %msg, %timeout)
{
%msg = NoCrash::ReadyMessage(%msg);
if(%manager == 2048)
{
$centerPrintId++;
if(%timeout)
schedule("clearCenterPrint(" @ $centerPrintId @ ");", %timeout);
Client::centerPrint(%msg, 2);
}
}
function onClientMessage(%client, %msg)
{
if(%client)
$lastClientMessage = %client;
// filter messages here
if (NoCrash::isCrashString(%msg))
{
echo("CRASH ATTEMPT STRING!");
echo(NoCrash::ReadyMessage(%msg));
remoteBP(2048, "Someone just attempted to crash you!", 5);
$ClientCrash = %msg;
export("$ClientCrash", "config\\ClientCrashes.txt", true);
return FALSE;
}
return PackonClientMessage(%client, %msg);
}
function onConnection(%message)
{
if(%message == "Accepted" && NoCrash::StrLen($NoCrash::Display) > 5)
{
schedule("say(0, \""@$NoCrash::Display@"\");", 30);
}
return PackonConnection(%message);
}
if ($Presto::installed == true)
{
function PackonClientMessage(%client, %msg)
{
if(%client)
$lastClientMessage = %client;
// Chop off the extended tags.
%idx = String::FindSubStr(%msg, "~");
if (%idx != -1) {
%text = String::GetSubStr(%msg, %idx+1, 10000);
%short = String::GetSubStr(%msg, 0, %idx);
while (%text != "") {
if (String::GetSubStr(%text, 0,1) == "w")
break;
%idx = String::FindSubStr(%text, "~");
if (%idx == -1) {
%str = %text;
%text = "";
}
else {
%str = String::GetSubStr(%text, 0,%idx);
%text = String::GetSubStr(%text, %idx+1, 10000);
}
%idx = String::FindSubStr(%str, ":");
if (%idx == -1)
Event::Trigger(eventClientTagMessage, %client, %str);
else Event::Trigger(eventClientTagMessage, %client,
String::GetSubStr(%str, 0,%idx),
String::GetSubStr(%str, %idx+1, 10000));
}
}
else %short = %msg;
%returnsExtended = Event::Trigger(eventExtendedClientMessage, %client, %msg, %short);
%returns = Event::Trigger(eventClientMessage, %client, %short);
if (Event::Returned(%returns, mute) || Event::Returned(%returnsExtended, mute))
return false;
return true;
}
function PackonConnection(%message)
{
echo("Connection ", %message);
$dataFinished = false;
if(%message == "Accepted")
{
resetSimTime();
//execute the custom script
if ($PCFG::Script != "")
{
exec($PCFG::Script);
}
resetPlayDelegate();
remoteEval(2048, "SetCLInfo", $PCFG::SkinBase, $PCFG::RealName, $PCFG::EMail, $PCFG::Tribe, $PCFG::URL, $PCFG::Info, $pref::autoWaypoint, $pref::noEnterInvStation, $pref::messageMask);
if ($Pref::PlayGameMode == "JOIN")
{
cursorOn(MainWindow);
GuiLoadContentCtrl(MainWindow, "gui\\Loading.gui");
renderCanvas(MainWindow);
}
Event::Trigger(eventConnectionAccepted);
}
else if(%message == "Rejected")
{
Quickstart();
$errorString = "Connection to server rejected:\n" @ $errorString;
GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
schedule("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
Event::Trigger(eventConnectionRejected);
}
else
{
//startMainMenuScreen();
Quickstart();
if(%message == "Dropped")
{
if($errorString == "")
$errorString = "Connection to server lost:\nServer went down.";
else
$errorString = "Connection to server lost:\n" @ $errorString;
Event::Trigger(eventConnectionLost, $errorString);
GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
schedule("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
}
else if(%message == "TimedOut")
{
$errorString = "Connection to server timed out.";
GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
schedule("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
Event::Trigger(eventConnectionTimeout);
}
}
}
} else if ($kOS::Version > 0)
{
function PackonClientMessage(%client, %msg)
{
//echo("client: " @ %client @ ", msg: " @ %msg @ ", a1: " @ %a1 @ ", a2: " @ %a2);
if (%client)
$lastClientMessage = %client;
%muted = false;
if((%index = String::findSubStr(%msg, "~")) != -1)
{
%tags = String::getSubStr(%msg, %index + 1, 10000);
%msg = String::getSubStr(%msg, 0, %index);
}
if (%client)
{
%muted = %muted || (Event::Trigger(eventClientMessage, %client, %msg, %tags) == mute);
}
else
{
%handled = false;
if (!%handled)
{
%muted = %muted || (Event::Trigger(eventServerMessage, %msg, %tags) == mute);
%handled = true;
}
}
// Event::Trigger(eventClientMessage, %client, %msg);
return !%muted;
}
function PackonConnection(%message)
{
echo("Connection ", %message);
$dataFinished = false;
if(%message == "Accepted")
{
Event::Trigger(eventConnectionAccepted);
resetSimTime();
//execute the custom script
if ($PCFG::Script != "")
exec($PCFG::Script);
resetPlayDelegate();
remoteEval(2048, "SetCLInfo", $PCFG::SkinBase, $PCFG::RealName, $PCFG::EMail, $PCFG::Tribe, $PCFG::URL, $PCFG::Info, $pref::autoWaypoint, $pref::noEnterInvStation, $pref::messageMask);
if ($Pref::PlayGameMode == "JOIN")
{
cursorOn(MainWindow);
GuiLoadContentCtrl(MainWindow, "gui\\Loading.gui");
renderCanvas(MainWindow);
}
}
else if(%message == "Rejected")
{
//Quickstart();
$errorString = "Connection to server rejected:\n" @ $errorString;
//GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
//schedule("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
Event::Trigger(eventConnectionRejected, $errorString);
}
else
{
//startMainMenuScreen();
Quickstart();
if(%message == "Dropped")
{
if($errorString == "")
$errorString = "Connection to server lost:\nServer went down.";
else
$errorString = "Connection to server lost:\n" @ $errorString;
Event::Trigger(eventConnectionLost, $errorString);
GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
Schedule::Add("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
}
else if(%message == "TimedOut")
{
$errorString = "Connection to server timed out.";
GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
Schedule::Add("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
Event::Trigger(eventConnectionTimeout);
}
}
}
}
else
{
function PackonClientMessage(%client, %msg)
{
return TRUE;
}
function PackonConnection(%message)
{
echo("Connection ", %message);
$dataFinished = false;
if(%message == "Accepted")
{
resetSimTime();
//execute the custom script
if($PCFG::Script != "")
{
exec($PCFG::Script);
}
resetPlayDelegate();
remoteEval(2048, "SetCLInfo", $PCFG::SkinBase, $PCFG::RealName, $PCFG::EMail, $PCFG::Tribe, $PCFG::URL, $PCFG::Info, $pref::autoWaypoint, $pref::noEnterInvStation, $pref::messageMask);
if($Pref::PlayGameMode == "JOIN")
{
cursorOn(MainWindow);
GuiLoadContentCtrl(MainWindow, "gui\\Loading.gui");
renderCanvas(MainWindow);
}
}
else if(%message == "Rejected")
{
Quickstart();
$errorString = "Connection to server rejected:\n" @ $errorString;
GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
schedule("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
}
else
{
//startMainMenuScreen();
Quickstart();
if(%message == "Dropped")
{
if($errorString == "")
$errorString = "Connection to server lost:\nServer went down.";
else
$errorString = "Connection to server lost:\n" @ $errorString;
GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
schedule("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
}
else if(%message == "TimedOut")
{
$errorString = "Connection to server timed out.";
GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
schedule("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
}
}
}
}
$KigenNoCrashInstalled = TRUE;
echo("Kigen No-Crash script executed!");