Author Topic: .dso test: GVarAccess.cs.dso - modify arbitrary global variables without eval  (Read 910 times)

This library is mainly intended as a proof of concept to demonstrate that the .dso file format can be used to perform tasks that would be slow, cumbersome, or impossible with pure TorqueScript code.

GVarAccess.cs.dso implements two functions: getGlobalVar(%name) and setGlobalVar(%name, %value). They can be used like so:
Code: [Select]
==>$test = "Hello World!";
==>echo(getGlobalVar("$test"));
Hello World!
==>setGlobalVar("$value", "text");
==>echo($value);
text
==>echo(getGlobalVar("%name"));
%name
To execute the file, call exec("./GVarAccess.cs"); as with any other script file.

While getGlobalVar and setGlobalVar are not vulnerable to injection exploits like a naive eval-based implementation, they are capable of reading and writing any global variable.  Use appropriate caution about using untrusted inputs in calls to these functions.


Using .dso here is not intended for obfuscation.  As such, I've also included a text file which breaks down the GVarAccess.cs.dso binary.
Torque 3D has been publicly available under the MIT license for eight years now, so this doesn't reveal anything which could reasonably be considered secret.

GVarAccess.zip download