From 12bdd0e412630d988ed052701337b60943043128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Mon, 8 Jan 2018 11:31:19 +0100 Subject: [PATCH] root check is now more visible --- spectre-meltdown-checker.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/spectre-meltdown-checker.sh b/spectre-meltdown-checker.sh index ea9f06d..042c948 100755 --- a/spectre-meltdown-checker.sh +++ b/spectre-meltdown-checker.sh @@ -1,7 +1,7 @@ #! /bin/sh # Spectre & Meltdown checker # Stephane Lesimple -VERSION=0.10 +VERSION=0.11 # print status function pstatus() @@ -78,9 +78,18 @@ extract_vmlinux() # end of extract-vmlinux functions -/bin/echo "Spectre and Meltdown mitigation detection tool v$VERSION" +/bin/echo -e "\033[1;34mSpectre and Meltdown mitigation detection tool v$VERSION\033[0m" /bin/echo +# root check + +if [ "$(id -u)" -ne 0 ]; then + /bin/echo -e "\033[31mNote that you should launch this script with root privileges to get accurate information." + /bin/echo -e "\033[31mWe'll proceed but you might see permission denied errors." + /bin/echo -e "\033[31mTo run it as root, you can try the following command: sudo $0" + /bin/echo +fi + ########### # SPECTRE 1 /bin/echo -e "\033[1;34mCVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'\033[0m" @@ -293,9 +302,5 @@ else fi /bin/echo -if [ "$(id -u)" -ne 0 ]; then - /bin/echo "Note that you should launch this script with root privileges to get accurate information" - /bin/echo "You can try the following command: sudo $0" -fi [ -n "$vmlinux" -a -f "$vmlinux" ] && rm -f "$vmlinux"