From 930447928718dd60122fc5d68fe94378b9d57dce Mon Sep 17 00:00:00 2001 From: Robin Wood Date: Tue, 15 Mar 2022 15:59:21 +0000 Subject: [PATCH] Check files exist before reading them. Issue https://github.com/FortyNorthSecurity/EyeWitness/issues/563 --- Python/setup/setup.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Python/setup/setup.sh b/Python/setup/setup.sh index e66d6891..3ad192ee 100755 --- a/Python/setup/setup.sh +++ b/Python/setup/setup.sh @@ -36,16 +36,22 @@ if [[ `(lsb_release -sd || grep ^PRETTY_NAME /etc/os-release) 2>/dev/null | grep osinfo="Parrot" fi -if [[ `cat /etc/issue | cut -d" " -f3 | head -n1 | grep "Alpine"` ]]; then - osinfo="Alpine" +if [ -f /etc/issue ]; +then + if [[ `cat /etc/issue | cut -d" " -f3 | head -n1 | grep "Alpine"` ]]; then + osinfo="Alpine" + fi fi -if [[ `cat /etc/redhat-release | grep "CentOS Linux release 7\.[0-9]\.[0-9]\+ (Core)"` ]]; then - osinfo="CentOS7" -fi +if [ -f /etc/redhat-release ]; +then + if [[ `cat /etc/redhat-release | grep "CentOS Linux release 7\.[0-9]\.[0-9]\+ (Core)"` ]]; then + osinfo="CentOS7" + fi -if [[ `cat /etc/redhat-release | grep "Rocky Linux release 8\.[0-9]"` ]]; then - osinfo="RockyLinux8" + if [[ `cat /etc/redhat-release | grep "Rocky Linux release 8\.[0-9]"` ]]; then + osinfo="RockyLinux8" + fi fi # make sure we run from this directory