From a090bed6c004c2b98b759105776c67bacc292779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 15 Oct 2022 23:46:00 +0800 Subject: [PATCH] Logo: try printing logo on Windows Server Completely untested --- src/detection/os/os_windows.cpp | 14 +++++++++++++- src/logo/builtin.c | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/detection/os/os_windows.cpp b/src/detection/os/os_windows.cpp index aa04bb976..c6dd9977e 100644 --- a/src/detection/os/os_windows.cpp +++ b/src/detection/os/os_windows.cpp @@ -51,6 +51,18 @@ void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance) uint32_t index = ffStrbufFirstIndexC(&os->variant, ' '); ffStrbufAppendNS(&os->version, index, os->variant.chars); ffStrbufSubstrAfter(&os->variant, index); + + // Windows Server 20xx Rx + if(ffStrbufEndsWithC(&os->prettyName, 'r')) + { + if(os->variant.chars[0] == 'R' && + isdigit(os->variant.chars[1]) && + (os->variant.chars[2] == '\0' || os->variant.chars[2] == ' ')) + { + ffStrbufAppendF(&os->version, " R%c", os->variant.chars[1]); + ffStrbufSubstrAfter(&os->variant, strlen("Rx ") - 1); + } + } } else { @@ -59,7 +71,7 @@ void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance) ffStrbufClear(&os->variant); } - ffStrbufAppendF(&os->id, "Windows %*s", os->version.length, os->version.chars); + ffStrbufAppendF(&os->id, "%*s %*s", os->prettyName.length, os->prettyName.chars, os->version.length, os->version.chars); ffGetWmiObjString(pclsObj, L"BuildNumber", &os->buildID); ffGetWmiObjString(pclsObj, L"OSArchitecture", &os->architecture); diff --git a/src/logo/builtin.c b/src/logo/builtin.c index 86376c7fa..e11dc0954 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -1280,7 +1280,7 @@ static const FFlogo* getLogoMsys2() static const FFlogo* getLogoWindows11() { FF_LOGO_INIT - FF_LOGO_NAMES("Windows 11") + FF_LOGO_NAMES("Windows 11", "Windows Server 2022") FF_LOGO_LINES( "$1\n" "################ ################\n" @@ -1310,7 +1310,7 @@ static const FFlogo* getLogoWindows11() static const FFlogo* getLogoWindows8() { FF_LOGO_INIT - FF_LOGO_NAMES("Windows 8", "Windows 8.1", "Windows 10") + FF_LOGO_NAMES("Windows 8", "Windows 8.1", "Windows 10", "Windows Server 2012", "Windows Server 2012 R2", "Windows Server 2016", "Windows Server 2019") FF_LOGO_LINES( "$1 ..,\n" " ....,,:;+ccllll\n" @@ -1343,7 +1343,7 @@ static const FFlogo* getLogoWindows8() static const FFlogo* getLogoWindows() { FF_LOGO_INIT - FF_LOGO_NAMES("Windows") + FF_LOGO_NAMES("Windows", "Windows 7", "Windows Server 2008", "Windows Server 2008 R2") FF_LOGO_LINES( "$1 ,.=:!!t3Z3z.,\n" " :tt:::tt333EE3\n"