cea-sec / sanzu

Graphical remote desktop solution
GNU General Public License v3.0
179 stars 27 forks source link

Verbosity of sanzu's windows binaries #133

Closed mcff2 closed 1 year ago

mcff2 commented 1 year ago

My windows sanzu binaries are not verbose at all: they do not output anything on the console (no error, no warning, nothing). Even the help message is not printed on the console.

Is it the normal behavior on windows?

serpilliere commented 1 year ago

Hi @mcff2

In windows environment, if I am correct, you can have two types of applications:

In sanzu, since the commit 76624d4e we have transformed the sanzu_client into a gui application. This avoids a console popping additionally to the sanzu window. The side effect is that sanzu doesn't interact with the console anymore.

If you want to have the console again, you can remove the line in the file sanzu_client.rs: https://github.com/cea-sec/sanzu/blob/b179a90f43b8343b8d47649326eab768374a6e84/sanzu/src/bin/sanzu_client.rs#L1 and recompile the binaries. This will make sanzu_client.exec -h display again.

Moreover, if you now want the logs to appear in the console, you must activate them by doing (you can also follow steps here https://www.tenforums.com/tutorials/121855-edit-user-system-environment-variables-windows.html):

At the moment, I don't know if we can compile a windows program as a GUI application, but keeping the console output in the case that we run the program from a console.

serpilliere commented 1 year ago

Ok, after some documentation reading, a call to AttachConsole seems to do the trick: With a sanzu compiled as GUI application, the console output seems to be honored. The PR #134 should to the trick.

serpilliere commented 1 year ago

The PR merge automatically closes the issue, but fell free to reopen it / comment it if something goes wrong regarding the fix!