Jump to content

Recommended Posts

I am currently making a custom debug menu to use on our Altis life server, but I am having issues with running functions globally and on the server.

 

Similar to using the default debug global and server exec buttons

 

I enter some code in the Rsceditbox (99007) and when I press the global button I get the system chat notification but code doesn't run and when I press the server button nothing happens at all.

 

Dialog

class RebornDBG
{
    idd = 99000;
    movingEnabled = 0;
    enableSimulation = 0;
    onLoad = "";
    onUnload = "";
    class Controls
    {
        class Maindebug: RDB2_RscEdit
        {
            idc = 99007;
            x = 0.298906 * safezoneW + safezoneX;
            y = 0.379 * safezoneH + safezoneY;
            w = 0.402187 * safezoneW;
            h = 0.484 * safezoneH;
        };

        class GlobalExec: RDB_RscButtonMenu
        {
            idc = 99028;
            text = "Global";
            onButtonClick = "[] call RR_fnc_runGlobal;";
            x = 0.298906 * safezoneW + safezoneX;
            y = 0.8652 * safezoneH + safezoneY;
            w = 0.128906 * safezoneW;
            h = 0.033 * safezoneH;
        };

        class ServerExecButton: RDB_RscButtonMenu
        {
            idc = 1013;
            text = "Server";
            onButtonClick = "[] call RR_fnc_runServer;";
            x = 0.432969 * safezoneW + safezoneX;
            y = 0.8652 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.033 * safezoneH;
        };
};

 

runGlobal.sqf

params ["_code"];

[_code] remoteExec ["RR_fnc_globalExec",0];

globalExec.sqf

_display = findDisplay 99900;
_ctrl = _display displayCtrl 99007;
_code = ctrlText _ctrl;

systemChat "RAN CODE ON: GLOBAL";

 

runServer.sqf

params ["_code"];

[_code] remoteExec ["RR_fnc_serverExec",2];

serverExec.sqf

_display = findDisplay 99900;
_ctrl = _display displayCtrl 99007;
_code = ctrlText _ctrl;

systemChat "RAN CODE ON: SERVER";

 

CfgRemoteExec

//Debug Exec
F(RR_fnc_globalExec,CLIENT)
F(RR_fnc_serverExec,CLIENT)

 

 

Share this post


Link to post
Share on other sites

You pass nothing from the buttons...

7 hours ago, General McTavish said:

onButtonClick = "[] call RR_fnc_runGlobal;";

 

...then pass nothing to the remoteExec...

7 hours ago, General McTavish said:

params ["_code"];
[_code] remoteExec ["RR_fnc_globalExec",0];

 

...then on the remote machine expect it to be able to pull information from the UI...

7 hours ago, General McTavish said:

_display = findDisplay 99900;
_ctrl = _display displayCtrl 99007;
_code = ctrlText _ctrl;

systemChat "RAN CODE ON: GLOBAL";

 

UI's are local, so on the remote machine the UI is 1) likely not shown 2) if shown will not have the same information in the RscEdit.

Instead pull the information before remoteExec and pass to remote machine.

 

Spoiler

UI


onButtonClick = "_this call RR_fnc_runGlobal;";

fn_runGlobal


disableSerialization;
params ["_button"];

_display = ctrlParent _button;
_ctrl = _display displayCtrl 99007;
_code = compile ctrlText _ctrl;

_code remoteExec ["BIS_fnc_call",0];

 

 

Share this post


Link to post
Share on other sites

Thank you very much for the help @Larrow

 

The only problem is that we don't have BIS_fnc_call / call whitelisted due to hackers visiting our server once in a while

 

Is there a workaround without allowing that function to be allowed

 

Thanks again

Share this post


Link to post
Share on other sites
7 hours ago, General McTavish said:

The only problem is that we don't have BIS_fnc_call / call whitelisted due to hackers visiting our server once in a while

Create your own function to call? Although I suppose this has the same problem, as in could be used by anyone.

I suppose making the server authoritative would be the best option.

 

Verified user( has access to your console ) presses Global Exec, sends code to server, server verifies clients authority to send remote code, if ok send code onto remote clients.

 

Just spit balling as Ive never had to worry about security, only ever making stuff for friends, closed communities or general code in the forums.

Surely having a Life server you already have some form of remote execution policy in place? Other than just blacklisting functions/commands?

 

Spoiler

//Global exec
[
	[ "Hello", "World" ],
	{
		params[ "_first", "_second" ];
		
		hint format[ "%1 %2", _first, _second ];
	},
	west
] remoteExec[ "TAG_fnc_remoteCode", 2 ];

//fn_remoteCode.sqf

params[ "_params", "_code", "_recipients" ];

if !( isServer ) exitWith {};

if ( isRemoteExecuted && { ( remoteExecutedOwner isEqualTo 2 || { remoteExecutedOwner in TAG_trustedClients } ) } ) then {
	[ _params, _code ] remoteExec[ "TAG_fnc_someFunctionToRunCode", _recipients ];
};

//fn_someFunctionToRunCode.sqf

params[ "_params", "_code" ];

if ( isRemoteExecuted && !{ remoteExecutedOwner isEqualTo 2 } ) exitWith {};

_params call _code;

 

Hopefully someone with more experience in securing community servers can help you.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks @Larrow I will give this a try

 

In terms of our remoteExec policy, if we need a function to be remoteExec then we add it to the CfgRemoteExec config

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×