diff --git a/src/detection/os/os_android.c b/src/detection/os/os_android.c index 8b4d748cf..bb3b6c9da 100644 --- a/src/detection/os/os_android.c +++ b/src/detection/os/os_android.c @@ -26,6 +26,12 @@ void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance) ffStrbufInit(&os->buildID); ffSettingsGetAndroidProperty("ro.build.id", &os->buildID); + ffStrbufInit(&os->systemName); + ffStrbufSetS(&os->systemName, instance->state.utsname.sysname); + + ffStrbufInit(&os->architecture); + ffStrbufSetS(&os->architecture, instance->state.utsname.machine); + ffStrbufInitA(&os->idLike, 0); ffStrbufInitA(&os->variant, 0); ffStrbufInitA(&os->variantID, 0); diff --git a/src/detection/os/os_linux.c b/src/detection/os/os_linux.c index 18635f0a0..ecdb87fc8 100644 --- a/src/detection/os/os_linux.c +++ b/src/detection/os/os_linux.c @@ -128,7 +128,6 @@ static void detectOS(FFOSResult* os, const FFinstance* instance) void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance) { - ffStrbufInit(&os->systemName); ffStrbufInit(&os->name); ffStrbufInit(&os->prettyName); ffStrbufInit(&os->id); @@ -139,6 +138,7 @@ void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance) ffStrbufInit(&os->versionID); ffStrbufInit(&os->codename); ffStrbufInit(&os->buildID); + ffStrbufInit(&os->systemName); ffStrbufInit(&os->architecture); ffStrbufSetS(&os->systemName, instance->state.utsname.sysname); diff --git a/src/modules/os.c b/src/modules/os.c index 156ac6ca8..39132c3a1 100644 --- a/src/modules/os.c +++ b/src/modules/os.c @@ -13,13 +13,11 @@ static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result) if(os->name.length > 0) ffStrbufAppend(result, &os->name); else if(os->prettyName.length > 0) - ffStrbufAppend(result, &os->name); + ffStrbufAppend(result, &os->prettyName); else if(os->id.length > 0) ffStrbufAppend(result, &os->id); - else if(os->systemName.length > 0) - ffStrbufAppend(result, &os->systemName); else - ffStrbufAppendS(result, "Linux"); + ffStrbufAppend(result, &os->systemName); //Append version if it is missing if(os->versionID.length > 0 && ffStrbufFirstIndex(result, &os->versionID) == result->length) @@ -84,7 +82,7 @@ void ffPrintOS(FFinstance* instance) { const FFOSResult* os = ffDetectOS(instance); - if(os->name.length == 0 && os->prettyName.length == 0) + if(os->name.length == 0 && os->prettyName.length == 0 && os->id.length == 0 && os->systemName.length == 0) { ffPrintError(instance, FF_OS_MODULE_NAME, 0, &instance->config.os, "Could not detect OS"); return;