From 4b1b7484d30f485332cf42f58a43084937cf7db1 Mon Sep 17 00:00:00 2001 From: Nicholas Welch <60065364+nexnwelch@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:16:50 -0400 Subject: [PATCH 1/2] Ignore inactive siteworx users for malware alerts --- files/internals/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/internals/functions b/files/internals/functions index acd3eaa..22f26c4 100644 --- a/files/internals/functions +++ b/files/internals/functions @@ -284,7 +284,7 @@ get_panel_contacts() { ;; "interworx") master_domain=$(/usr/local/interworx/bin/listaccounts.pex | grep "${user}" | awk '{print $2}') - contact_emails=$(/usr/bin/siteworx -un --login_domain ${master_domain} -c Users -a listUsers -o yaml | awk '/email:/{print $2}' | tr '\n' ',' | sed 's/,$//' | sed 's/,/, /') + contact_emails=$(siteworx -un --login_domain ${master_domain} -c Users -a listUsers -o json | python3 -c 'import json,sys;data=json.load(sys.stdin);emails=[elem["email"] for elem in data if elem["user_status"] == "active"];print(", ".join(emails))') ;; esac } From abfd8256f8feb55844313110fcfe0f159beafc3f Mon Sep 17 00:00:00 2001 From: Nicholas Welch <60065364+nexnwelch@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:18:22 -0400 Subject: [PATCH 2/2] Use system python binary Use the system python binary instead of calling python3 directly, code will still work regardless if system has python2 or python3 installed. --- files/internals/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/internals/functions b/files/internals/functions index 22f26c4..b891c1d 100644 --- a/files/internals/functions +++ b/files/internals/functions @@ -284,7 +284,7 @@ get_panel_contacts() { ;; "interworx") master_domain=$(/usr/local/interworx/bin/listaccounts.pex | grep "${user}" | awk '{print $2}') - contact_emails=$(siteworx -un --login_domain ${master_domain} -c Users -a listUsers -o json | python3 -c 'import json,sys;data=json.load(sys.stdin);emails=[elem["email"] for elem in data if elem["user_status"] == "active"];print(", ".join(emails))') + contact_emails=$(siteworx -un --login_domain ${master_domain} -c Users -a listUsers -o json | python -c 'import json,sys;data=json.load(sys.stdin);emails=[elem["email"] for elem in data if elem["user_status"] == "active"];print(", ".join(emails))') ;; esac }