Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote code execution from WSL2 #16

Open
richardnm-2 opened this issue Oct 12, 2023 · 2 comments
Open

Remote code execution from WSL2 #16

richardnm-2 opened this issue Oct 12, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@richardnm-2
Copy link

richardnm-2 commented Oct 12, 2023

Would it be possible to implement remote code execution from WSL2 as well?
I've never worked with VSCode extensions, maybe with some guidance I can help implement it.

EDIT: I've been able to connect to the Windows UE5 instance from WSL2, changing TTL to 2 in the plugin and extension settings. Even so, when I try to run a script file, the UE5 output log displays:

LogPython: Error: Traceback (most recent call last):
LogPython: Error:   File "<string>", line 1, in <module>
LogPython: Error: OSError: [Errno 22] Invalid argument: '/home/richardnm/.vscode-server/extensions/nilssoderman.ue-python-1.1.0/python/execute/vscode_execute_entry.py'

It seems that it has the root for file execution on Windows, trying to access the WSL Ubuntu /home/... directory.

@nils-soderman
Copy link
Owner

Hi,

Interesting, I don't se why we shouldn't support this!

I haven't used WSL2 myself, I'll download it and give it a try, but any help in both testing & implementing this would be greatly appreciated!
I'm going to put together a contributing.md document in the coming days, with some info on how to run/debug the extension.

It seems the extension is installed on the WSL2 VM, which means we cannot share any files between the extension/unreal. All communication needs to happen through the socket.
There are currently some python scripts that the extension refers to by filepath (see src/modules/remote-handler::executeFile).
These python files will instead need to be read inside this executeFile method, and then pass along the code instead of the filepath.

Then comes the issue of vscode_execute_entry.py which does a relative import of vscode_execute.py. Worst case we could skip this and execute vscode_execute.py directly (only incase of WSL2).

Lastly, instead of passing in the filepath (fileToExecute) in src/scripts/execute::main, this file also needs to be read here and passed as code.

@nils-soderman nils-soderman added the enhancement New feature or request label Oct 18, 2023
@nils-soderman
Copy link
Owner

There is now a CONTRIBUTING.md with some info on how to setup the extension for development/debugging.

It will probably be some time before I have the time to look at this, but feel free to give it a go if you're feeling up to it.

Cheers,
Nils

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants