Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.25k stars 569 forks source link

Terminal Emulation on Windows without ConPTY results in ANSI Escape Code flooding #4435

Open rowds15 opened 2 years ago

rowds15 commented 2 years ago

Describe the bug Terminal Emulation on Windows 7 and Server 2008R2 not rendering correctly image

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Open Terminal'
  2. See error

Expected behavior A clear and concise description of what you expected to happen.

Server Software (please complete the following information):

Client Device (please complete the following information):

Remote Device (please complete the following information):

Issue started with version 1.0.70 and yes I know Windows 7 and server 2008 are EOL but.....

Matt-CyberGuy commented 2 years ago

I have success!

Unfortunately disabling minifi was not enough. I decided to go in and remove modules_meshcore_min. Once I did that and rebooted, I was able to get a prompt on one of our Windows 7 machines!!

I don't care what Ylian says, you're the best Brian!! ;)

Cheers!

krayon007 commented 2 years ago

I have success!

Unfortunately disabling minifi was not enough. I decided to go in and remove modules_meshcore_min. Once I did that and rebooted, I was able to get a prompt on one of our Windows 7 machines!!

I don't care what Ylian says, you're the best Brian!! Cheers!

Sweet! I'll have to talk to Ylian when he gets back. It may be like the signed agents thing, where if the file exists, the server always uses that...

si458 commented 2 years ago

I have success!

Unfortunately disabling minifi was not enough. I decided to go in and remove modules_meshcore_min. Once I did that and rebooted, I was able to get a prompt on one of our Windows 7 machines!!

I don't care what Ylian says, you're the best Brian!! Cheers!

beat me to it! i just did the exact same thing! just removed the modules_meshcore_min folder, then restarted meshcentral

si458 commented 2 years ago

@krayon007 might be helpful

meshcentral.js:2661:            if (obj.args.minifycore !== false) { try { moduleDirPath = obj.path.join(meshcorePath, 'modules_meshcore_min'); modulesDir = obj.fs.readdirSync(moduleDirPath); } catch (ex) { } } // Favor minified modules if present.
pluginHandler.js:152:            //if (obj.args.minifycore !== false) { try { moduleDirPath = obj.path.join(obj.pluginPath, 'modules_meshcore_min'); modulesDir = obj.fs.readdirSync(moduleDirPath); } catch (e) { } } // Favor minified modules if present.
krayon007 commented 2 years ago

I have success!

Unfortunately disabling minifi was not enough. I decided to go in and remove modules_meshcore_min. Once I did that and rebooted, I was able to get a prompt on one of our Windows 7 machines!!

I don't care what Ylian says, you're the best Brian!! ;)

Cheers!

By the way @Matt-CyberGuy earlier I installed an agent on your test system you gave me access to, called: BryanAgentTest, feel free to delete/uninstall that service and remove my access.

Matt-CyberGuy commented 2 years ago

Oh right haha! Thanks

si458 commented 2 years ago

@krayon007 fixed the default for you! #4594 it was checking if it was 0 instead of null for some reason? so if null (not set) then set to false, which then skips the minifycore! unless minifycore is set to true then minifycore @silversword411 could you please add minifycore to the scheme and the docs as its not listed

rowds15 commented 2 years ago

@krayon007 I can confirm that, 1, changing Minify to 0 or false, alone, does not resolve the issue. 2, removing the modules_meshcore_min folder and restarting the server service does fix the issue.

silversword411 commented 2 years ago

@si458 If you're referring to

https://ylianst.github.io/MeshCentral/meshcentral/config/

I literally just copy/paste the raw file from here: https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json

It's currently up to date, and I periodically copy/paste it over to update. I only created that page so that all the config items are automatically added to the search index in mkdocs.

I don't feel comfortable with updating the source, not sure what to modify about minify (other than typos: https://github.com/Ylianst/MeshCentral/commit/dee3f58892fc3473a7a1bd92ca5b757d46453c37 :) )

If we need another section about minifycore in here somewhere I'm not sure what to put in there.

shadyslim2018 commented 2 years ago

There is still a problem with the terminal on Windows Server 2012 R2, even after modify win-terminal.min.js return Buffer.from("[" + t.join(";") + e) to return Buffer.from("\x1B[" + t.join(";") + e)

When I press the arrow keys or del key, backspace is fine. These are the characters that show up.


[3~ DEL
[A UP
[B DOWN
[C RIGHT
[D LEFT

I also changed if (obj.args.minifycore === 0) obj.args.minifycore = false; to if (obj.args.minifycore == null) obj.args.minifycore = false; and it didn't make a difference.

silversword411 commented 2 years ago

There is still a problem

You did say you deleted the files necessary, did you?

krayon007 commented 2 years ago

Hopefully with disabling minification fixes this issue for most people. The issue with the arrow keys is a separate issue caused by the terminal not being an actual pseudo console. That particular issue will require some investigation on my part to find a solution, but I'm not sure if that can be solved, because normally it's the console that handles that, but in this scenario we're not using a real console, which is why up-arrow to show previous commands doesn't work, etc.

shadyslim2018 commented 2 years ago

There is still a problem

You did say you deleted the files necessary, did you?

Yes

shadyslim2018 commented 2 years ago

Hopefully with disabling minification fixes this issue for most people. The issue with the arrow keys is a separate issue caused by the terminal not being an actual pseudo console. That particular issue will require some investigation on my part to find a solution, but I'm not sure if that can be solved, because normally it's the console that handles that, but in this scenario we're not using a real console, which is why up-arrow to show previous commands doesn't work, etc.

All other Windows OS is working fine other than Windows 2012 R2

si458 commented 2 years ago

Hopefully with disabling minification fixes this issue for most people. The issue with the arrow keys is a separate issue caused by the terminal not being an actual pseudo console. That particular issue will require some investigation on my part to find a solution, but I'm not sure if that can be solved, because normally it's the console that handles that, but in this scenario we're not using a real console, which is why up-arrow to show previous commands doesn't work, etc.

All other Windows OS is working fine other than Windows 2012 R2

I have the arrow key issue with windows 7 but i think @krayon007 is right, we can close this issue as its fixed but open another issue for the arrow keys to be investigated