From e06db1477dde001f47f0cc3d08afe3a568055ffc Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Sat, 13 Aug 2016 16:38:07 +0200 Subject: Add notebook hardware detection --- include/consts | 1 + include/functions | 21 ++++++++++++++++++++- lynis | 3 ++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/include/consts b/include/consts index 7f07aa8a..3cbf02f7 100644 --- a/include/consts +++ b/include/consts @@ -198,6 +198,7 @@ unset LANG SSL_CERTIFICATE_PATHS="" SYSLOGNGBINARY="" SYSTEMCTLBINARY="" + SYSTEM_IS_NOTEBOOK=255 TEMP_FILE="" TEMP_FILES="" TEST_SKIP_ALWAYS="" diff --git a/include/functions b/include/functions index f68c84fc..748dd77a 100644 --- a/include/functions +++ b/include/functions @@ -53,8 +53,9 @@ # IsDebug Check if --debug is used # IsDeveloperMode Check if --developer is used # IsDeveloperVersion Check if program is a developer release -# IsRunning Check if a process is running +# IsNotebook System detection # IsOwnedByRoot Determine if file or directory is owned by root +# IsRunning Check if a process is running # IsVerbose Check if --verbose is used # IsVirtualMachine Check if this system is a virtual machine # IsWorldExecutable Check if a file is world executable @@ -1117,6 +1118,24 @@ } + ################################################################################ + # Name : IsNotebook + # Description : Check if file or directory is owned by root + # Returns : 0 (true), 1 (false), or 255 (unknown) + ################################################################################ + + IsNotebook() { + FIND=$(which laptop-detect 2> /dev/null) + if [ ! -z "${FIND}" ]; then + Debug "Testing if we are a notebook" + laptop-detect + if [ $? -eq 0 ]; then SYSTEM_IS_NOTEBOOK=1; Debug "System is a notebook according to laptop-detect" + elif [ $? -eq 1 ]; then SYSTEM_IS_NOTEBOOK=0; Debug "System is a NOT a notebook according to laptop-detect"; fi + Report "notebook=${SYSTEM_IS_NOTEBOOK}" + fi + } + + ################################################################################ # Name : IsOwnedByRoot # Description : Check if file or directory is owned by root diff --git a/lynis b/lynis index 98389d0c..c786d798 100755 --- a/lynis +++ b/lynis @@ -747,8 +747,9 @@ ${NORMAL} # ################################################################################# # - # Check if this is a virtual machine (after the appropriate binaries are found) + # Use hardware detection capabilities IsVirtualMachine + IsNotebook # ################################################################################# # -- cgit v1.2.3