File: run_bandit.sh

package info (click to toggle)
osc 0.164.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 5,308 kB
  • sloc: python: 20,832; sh: 1,848; perl: 366; xml: 157; csh: 14; makefile: 9
file content (18 lines) | stat: -rwxr-xr-x 506 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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