diff --git a/docker-bench-security.sh b/docker-bench-security.sh index 8d9a602..2d52a82 100755 --- a/docker-bench-security.sh +++ b/docker-bench-security.sh @@ -144,7 +144,15 @@ main () { else for i in $(echo "$check" | sed "s/,/ /g"); do if command -v "$i" 2>/dev/null 1>&2; then - "$i" + if [ "$checkexclude" ]; then + checkexcluded="$(echo ",$checkexclude" | sed -e 's/^/\^/g' -e 's/,/\$|/g' -e 's/$/\$/g')" + included_checks=$(sed -ne "/$i() {/,/}/{/check/p}" functions_lib.sh | grep -vE "$checkexcluded") + for check in $included_checks; do + "$check" + done + else + "$i" + fi else echo "Check \"$i\" doesn't seem to exist." continue