Skip to content

Instantly share code, notes, and snippets.

@AgentRev
Created October 17, 2014 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AgentRev/53ee67d44ae93e1fa1e5 to your computer and use it in GitHub Desktop.
Save AgentRev/53ee67d44ae93e1fa1e5 to your computer and use it in GitHub Desktop.
filterExecAttempt.sqf for Zeus
// @file Version: 1.0
// @file Name: filterExecAttempt.sqf
// @file Author: AgentRev
// @file Created: 14/07/2013 13:10
if (!isServer) exitWith {};
private "_packetName";
_packetName = [_this, 0, "", [""]] call BIS_fnc_param;
if (_packetName == "BIS_fnc_MP_packet") then
{
private ["_values", "_code", "_function", "_whitelisted", "_filePath", "_args2", "_buffer"];
_values = +(_this select 1);
_values deleteAt 0;
_code = _values select 0;
_function = _values select 1;
_whitelisted = false;
if (_function == "BIS_fnc_execVM") then
{
_filePath = [_code, 1, "", [""]] call BIS_fnc_param;
{
if (_filePath == _x) exitWith
{
_whitelisted = true;
};
}
forEach
[
"client\functions\defineServerRules.sqf",
"territory\client\updateTerritoryMarkers.sqf",
"initPlayerServer.sqf"
];
};
if (!_whitelisted) then
{
{
if (_function == _x) exitWith
{
_whitelisted = true;
};
}
forEach
[
"BIS_fnc_effectKilledAirDestruction",
"BIS_fnc_effectKilledAirDestructionStage2",
"BIS_fnc_effectKilledSecondaries"/*,
"JTS_FNC_SENT"*/ // PM Compact by JTS
];
};
if (!_whitelisted) then
{
scopeName "zeusFunc";
private ["_zeusFuncCfg", "_zeusFuncPrefix", "_i", "_catCfg", "_j"];
_zeusFuncCfg = configfile >> "CfgFunctions" >> "A3_Functions_F_Curator";
_zeusFuncPrefix = getText (_zeusFuncCfg >> "tag") + "_fnc_";
for "_i" from 0 to (count _zeusFuncCfg - 1) do
{
_catCfg = _zeusFuncCfg select _i;
for "_j" from 0 to (count _catCfg - 1) do
{
if (_function == _zeusFuncPrefix + configName (_catCfg select _j)) then
{
_whitelisted = true;
breakOut "zeusFunc";
};
};
};
};
if (_whitelisted) then
{
_this call BIS_fnc_MPexec;
}
else
{
_values deleteAt 0;
_args2 = if (typeName _code == "STRING") then { "'" + _code + "'" } else { str (if (typeName _code in ["BOOL","SCALAR","ARRAY","SIDE"]) then { _code } else { str _code }) };
_buffer = toArray ("ANTI-HACK: Blocked remote execution: params=" + str _values + " args=" + _args2);
while {count _buffer > 0} do
{
diag_log toString (_buffer select [0, 1024]);
_buffer deleteRange [0, 1024];
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment