From 17137408d29d004e7ec1512ab7e6b7d30ff28ebe Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Fri, 26 Jul 2019 11:32:48 +0200 Subject: Use IsRunning exit code instead of variable --- include/tests_malware | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) (limited to 'include/tests_malware') diff --git a/include/tests_malware b/include/tests_malware index 19172ca6..b260c488 100644 --- a/include/tests_malware +++ b/include/tests_malware @@ -102,8 +102,7 @@ # ESET security products LogText "Test: checking process esets_daemon" - IsRunning esets_daemon - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "esets_daemon"; then FOUND=1 ESET_DAEMON_RUNNING=1 MALWARE_SCANNER_INSTALLED=1 @@ -114,8 +113,7 @@ # Bitdefender (macOS) LogText "Test: checking process epagd" - IsRunning epagd - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "epagd"; then FOUND=1 BITDEFENDER_DAEMON_RUNNING=1 MALWARE_SCANNER_INSTALLED=1 @@ -126,8 +124,7 @@ # Avast (macOS) LogText "Test: checking process com.avast.daemon" - IsRunning com.avast.daemon - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "com.avast.daemon"; then FOUND=1 AVAST_DAEMON_RUNNING=1 MALWARE_SCANNER_INSTALLED=1 @@ -138,8 +135,7 @@ # Avira LogText "Test: checking process Avira daemon" - IsRunning avqmd - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "avqmd"; then FOUND=1 AVIRA_DAEMON_RUNNING=1 MALWARE_SCANNER_INSTALLED=1 @@ -150,8 +146,7 @@ # Cylance (macOS) LogText "Test: checking process CylanceSvc" - IsRunning CylanceSvc - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "CylanceSvc"; then FOUND=1 if IsVerbose; then Display --indent 2 --text "- ${GEN_CHECKING} CylancePROTECT" --result "${STATUS_FOUND}" --color GREEN; fi LogText "Result: found CylancePROTECT service" @@ -164,11 +159,9 @@ LogText "Test: checking process cma or cmdagent (McAfee)" # cma is too generic to match on, so we want to ensure that it is related to McAfee first if [ -x /opt/McAfee/cma/bin/cma ]; then - IsRunning cma - if [ ${RUNNING} -eq 1 ]; then MCAFEE_SCANNER_RUNNING=1; fi + if IsRunning "cma"; then MCAFEE_SCANNER_RUNNING=1; fi else - IsRunning cmdagent - if [ ${RUNNING} -eq 1 ]; then MCAFEE_SCANNER_RUNNING=1; fi + if IsRunning "cmdagent"; then MCAFEE_SCANNER_RUNNING=1; fi fi if [ ${MCAFEE_SCANNER_RUNNING} -eq 1 ]; then FOUND=1 @@ -180,14 +173,12 @@ # Sophos savscand/SophosScanD LogText "Test: checking process savscand" - IsRunning savscand - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "savscand"; then FOUND=1 SOPHOS_SCANNER_RUNNING=1 fi LogText "Test: checking process SophosScanD" - IsRunning SophosScanD - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "SophosScanD"; then FOUND=1 SOPHOS_SCANNER_RUNNING=1 fi @@ -200,18 +191,15 @@ # Symantec rtvscand/smcd/symcfgd LogText "Test: checking process rtvscand" - IsRunning rtvscand - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "rtvscand"; then SYMANTEC_SCANNER_RUNNING=1 fi LogText "Test: checking process Symantec management client service" - IsRunning smcd - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "smcd"; then SYMANTEC_SCANNER_RUNNING=1 fi LogText "Test: checking process Symantec Endpoint Protection configuration service" - IsRunning symcfgd - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "symcfgd"; then SYMANTEC_SCANNER_RUNNING=1 fi if [ ${SYMANTEC_SCANNER_RUNNING} -eq 1 ]; then @@ -224,8 +212,7 @@ # TrendMicro (macOS) LogText "Test: checking process TmccMac to test for Trend Micro anti-virus (macOS)" - IsRunning TmccMac - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "TmccMac"; then if IsVerbose; then Display --indent 2 --text "- ${GEN_CHECKING} Trend Micro anti-virus" --result "${STATUS_FOUND}" --color GREEN; fi LogText "Result: found Trend Micro component" FOUND=1 @@ -267,8 +254,7 @@ Register --test-no MALW-3284 --weight L --network NO --category security --description "Check for clamd" if [ ${SKIPTEST} -eq 0 ]; then LogText "Test: checking running ClamAV daemon (clamd)" - IsRunning clamd - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "clamd"; then Display --indent 2 --text "- ${GEN_CHECKING} ClamAV daemon" --result "${STATUS_FOUND}" --color GREEN LogText "Result: found running clamd process" MALWARE_SCANNER_INSTALLED=1 @@ -286,8 +272,7 @@ Register --test-no MALW-3286 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check for freshclam" if [ ${SKIPTEST} -eq 0 ]; then LogText "Test: checking running freshclam daemon" - IsRunning freshclam - if [ ${RUNNING} -eq 1 ]; then + if IsRunning "freshclam"; then FRESHCLAM_DAEMON_RUNNING=1 Display --indent 4 --text "- ${GEN_CHECKING} freshclam" --result "${STATUS_FOUND}" --color GREEN LogText "Result: found running freshclam process" -- cgit v1.2.3