mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-11-25 20:11:40 +01:00
Disable color output on Windows 8 and Windows Server 2012.
This commit is contained in:
parent
3c0fc8ead4
commit
1b7cfbec71
@ -1026,6 +1026,12 @@ def main() -> int:
|
|||||||
if (sys.platform == 'win32') and ('colorama' not in sys.modules):
|
if (sys.platform == 'win32') and ('colorama' not in sys.modules):
|
||||||
out.v("WARNING: colorama module not found. Colorized output will be ddisabled.", write_now=True)
|
out.v("WARNING: colorama module not found. Colorized output will be ddisabled.", write_now=True)
|
||||||
|
|
||||||
|
# Disable color output on Windiows 8 and Windows Server 2012, as they are still supported by Microsoft (until Jan. 2023 and Oct. 2023, respectively); they do not support ANSI color codes. According to https://docs.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version, the major versions of Server 2016, Server 2019, and Windows 10 are all 10.
|
||||||
|
if (sys.platform == 'win32') and (sys.getwindowsversion().major < 10): # pylint: disable=no-member
|
||||||
|
aconf.colors = False
|
||||||
|
out.use_colors = False
|
||||||
|
out.v("Disabling color output on this platform since it is not supported (Windows major version: %d)." % sys.getwindowsversion().major) # pylint: disable=no-member
|
||||||
|
|
||||||
# If we're outputting JSON, turn off colors and ensure 'info' level messages go through.
|
# If we're outputting JSON, turn off colors and ensure 'info' level messages go through.
|
||||||
if aconf.json:
|
if aconf.json:
|
||||||
out.json = True
|
out.json = True
|
||||||
|
Loading…
Reference in New Issue
Block a user