From 6368761b04bbf1055c8bc75ec62fd3410e715ba1 Mon Sep 17 00:00:00 2001 From: Victor Pereira Date: Wed, 8 Apr 2015 10:02:10 +0200 Subject: [PATCH] added a simple way to verify osc code base with the python security scanner bandit --- run_bandit.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 run_bandit.sh diff --git a/run_bandit.sh b/run_bandit.sh new file mode 100755 index 00000000..a743dee3 --- /dev/null +++ b/run_bandit.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# you can pass as argument "csv","json" or "txt" (default) +if [ "$1" != "" ];then + OUTPUT=$1 +else + OUTPUT="txt" +fi + +# check if bandit is installed +command -v bandit >/dev/null 2>&1 || { echo "bandit should be installed. get the package from https://build.opensuse.org/package/show/home:vpereirabr/python-bandit. Aborting." >&2; exit 1; } + +bandit -c /usr/etc/bandit/bandit.yaml -r osc -f $OUTPUT + +if [ "$OUTPUT" == "csv" ];then + cat bandit_results.csv + rm -f bandit_results.csv +fi