From 5563e53efe5c47a492c1f9d843a3116f315bfbe8 Mon Sep 17 00:00:00 2001 From: juwawe Date: Wed, 8 Oct 2014 11:09:31 +0200 Subject: [PATCH 1/2] BusyBox 'mktemp'-fixing In the BusyBox-Kernel (for instance on QNAP-NAS) the 'mktemp'-command have no support for the '-t'-switch and right problems to create subdirs in some dircetorys. --- bashcheck | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bashcheck b/bashcheck index b76bf5c..842a8ae 100755 --- a/bashcheck +++ b/bashcheck @@ -12,7 +12,9 @@ good() { echo -e "\033[92mNot vulnerable to $1\033[39m" } -tmpdir=`mktemp -d -t tmp.XXXXXXXX` +tmpdir=`mktemp -d -t /bashcheck.tmp.XXXXXXXX 2>/dev/nul` +[ -z "$tmpdir" ] && tmpdir=`mktemp -d /tmp/bashcheck.tmp.XXXXXXXX 2>/dev/nul` +[ -z "$tmpdir" ] && tmpdir=/tmp/bashcheck.tmp.`date "+%s.%N"` && mkdir $tmpdir [ -n "$1" ] && bash=$(which $1) || bash=$(which bash) echo -e "\033[95mTesting $bash ..." From d9f2861d42129abf3617312f1ddac335e16b10b0 Mon Sep 17 00:00:00 2001 From: juwawe Date: Thu, 9 Oct 2014 11:34:43 +0200 Subject: [PATCH 2/2] /dev/nul -> /dev/null --- bashcheck | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bashcheck b/bashcheck index 842a8ae..c8e3ef9 100755 --- a/bashcheck +++ b/bashcheck @@ -12,8 +12,8 @@ good() { echo -e "\033[92mNot vulnerable to $1\033[39m" } -tmpdir=`mktemp -d -t /bashcheck.tmp.XXXXXXXX 2>/dev/nul` -[ -z "$tmpdir" ] && tmpdir=`mktemp -d /tmp/bashcheck.tmp.XXXXXXXX 2>/dev/nul` +tmpdir=`mktemp -d -t /bashcheck.tmp.XXXXXXXX 2>/dev/null` +[ -z "$tmpdir" ] && tmpdir=`mktemp -d /tmp/bashcheck.tmp.XXXXXXXX 2>/dev/null` [ -z "$tmpdir" ] && tmpdir=/tmp/bashcheck.tmp.`date "+%s.%N"` && mkdir $tmpdir [ -n "$1" ] && bash=$(which $1) || bash=$(which bash)