Background
So, i’m making a remote console thing, as a bit of a personal project for a minecraft server, its a kind of alternative to RCON, not really important but its just some context.
I want my console to have the feature to run code remotely, so the client (console) can run code on the server program.
I have a networking system with packet objects, that consist of a header and a payload. Headers are strings but refer to codes that the client sends to the server program, the server program can also send packets back using the same concept.
Question
I would like the code that the client can send, be a script that would integrate seamlessly with the server, so it would be able to see the currently running script and “send” code over that can be run as if it were part of the script. So essentially it would have access to that current scope and not just run globally as it if were in a shell.
The code that runs doesn’t necessarily have to be part of the current running script but it should at least be able to add on to it. How is this possible, if at all?
I’ve used the python code
library to get access to functions such as InteractiveTerminal()
, eval()
and exec()
but this doesn’t seem to run the way I intend, and from my knowledge, it doesn’t seem to have access to scope or the variable in the current running script.
RedEgs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.